Frictional Games Forum (read-only)
LookAtCallback - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: LookAtCallback (/thread-20323.html)



LookAtCallback - tonitoni1998 - 02-14-2013

actually thought i know how its working, but i always get an error
(" expected "," or ")" ") i dont knw how to solve. i have this
Code:
SetEntityPlayerLookAtCallback("diary_look_at", "SetMessage2", false);

void SetMessage2(string &in "diary_1", int 1)
{
   SetMessage("map1_messages", "DiaryInfo", 3);
}

it always tells me there should be "," or" ")" before "diary_1". but when i do that the data type is missing.

thanks for helping


RE: LookAtCallback - MulleDK19 - 02-14-2013

(02-14-2013, 03:55 PM)tonitoni1998 Wrote: actually thought i know how its working, but i always get an error
(" expected "," or ")" ") i dont knw how to solve. i have this
Code:
SetEntityPlayerLookAtCallback("diary_look_at", "SetMessage2", false);

void SetMessage2(string &in "diary_1", int 1)
{
   SetMessage("map1_messages", "DiaryInfo", 3);
}

it always tells me there should be "," or" ")" before "diary_1". but when i do that the data type is missing.

thanks for helping

PHP Code:
void SetMessage2(string &in "diary_1"int 1)
{
   
SetMessage("map1_messages""DiaryInfo"3);


That makes absolutely no sense.

It should be something like:
PHP Code:
SetEntityPlayerLookAtCallback("diary1""SetMessage2"false);

void SetMessage2(string &in asEntityint alState)
{
   
SetMessage("map1_messages""DiaryInfo"3);




RE: LookAtCallback - tonitoni1998 - 02-14-2013

it is working, thanks!

but how does the game know, what state (int alState) it is? its not given anywhere.


RE: LookAtCallback - MulleDK19 - 02-14-2013

(02-14-2013, 03:59 PM)tonitoni1998 Wrote: it is working, thanks!

but how does the game know, what state (int alState) it is? its not given anywhere.

Doesn't matter. The callback will check for both looking at, and not looking at, and pass 1 or -1 respectively to your callback function.


RE: LookAtCallback - FlawlessHappiness - 02-14-2013

If you put it like you did it, it will happen like if you wrote 0 = It will happen both when you look at it, and when you move the cursor out of the object.

To do it, only when you look at it, you put an if-statement inside the callback like this:

if(alState == 1)
{
//Do stuff
}

this way the game is asking: If the player looks onto the object //Do stuff, otherwise do what you wrote outside the if-statement