Frictional Games Forum (read-only)

Full Version: LookAtCallback
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
(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);

it is working, thanks!

but how does the game know, what state (int alState) it is? its not given anywhere.
(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.
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