Page 1 of 1

help - i don't understand why im getting this error

PostPosted: Tue Jul 11, 2006 9:14 pm
Author: Crimzonfist
ok heres the thing im trying to get a generic trigger to send a message to the pc entering it. Except i get the error: parsing the variable list. now this is normaly just a case of having not put the semicolon at the end of a line of code but it is there. So my question is why am i getting this error. Im fairly new to scripting but as far as i can tell this should run fine. Thanx in advance

code:
Code: Select all
void main()
{
   object oPC = GetNearestPC();
   SendMessageToPC(oPC, "This room is cold.");
   }


edit: later im going to try and figure out how to change the color of the text to green but that's a subject for another day.

PostPosted: Tue Jul 11, 2006 9:37 pm
Author: Final Shinryuu
Try using GetEnteringPC(), and make sure the script is on the OnEnter event of the trigger.

PostPosted: Tue Jul 11, 2006 9:39 pm
Author: Crimzonfist
ah, thanx i didn't see that one :)

PostPosted: Tue Jul 11, 2006 9:42 pm
Author: Crimzonfist
ok im in the onenter event and chanded it GetEnteringPC() and it still says im parsing the variable list. again the exact code i have for this is...

code
Code: Select all
void main()
{
   object oPC = GetEnteringPC();
   SendMessageToPC(oPC, "This room is cold.");
   }

PostPosted: Tue Jul 11, 2006 9:48 pm
Author: Final Shinryuu
Here, use this instead. This script does what you want, and is much more flexible.
Put it on the onEnter event of a trigger.

Code: Select all
void main()
{
    object oArea     = GetArea(OBJECT_SELF);

    object oEntering = GetEnteringObject();
    if (GetIsPC(oEntering) && !GetIsDM(oEntering))
    {
        SendMessageToPC(oEntering, GetName(OBJECT_SELF));
    }
}


Copyright for this one goes to Red Golem.

To use it, just write the message you want in the "Name" field of the trigger itself. Give the trigger an unique tag of some sort. Doesn't matter what.

You can probably knock out the oArea bit, too. ;) Isn't used by anything, but since I'm posting RG's code, I'm posting it unchanged.

So, in this case, you'd write "The room is cold." in the name field of the trigger.

PostPosted: Tue Jul 11, 2006 10:08 pm
Author: Crimzonfist
Final Shinryuu,

Thanx for sharing Red Golem's code with me it worked great. :)

PostPosted: Fri Aug 18, 2006 11:46 am
Author: jaythespacehound
Not sure GetEnteringPC actually exists, hence your initial error.
Should have been:
Code: Select all
void main()
{
   object oPC = GetEnteringObject();
   SendMessageToPC(oPC, "This room is cold.");
}


Nice code by the way Final Shinryuu, I've been using one that stores a string on the trigger, never thought of using the GetName :D

PostPosted: Fri Aug 18, 2006 1:14 pm
Author: JollyOrc
in case you have access to the subcontractor and script library forum:

Look for onent_atmosphere. I think it's also in the player housing .erf. It's a generic script doing exactly what Final Shinryuu described.