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

Moderator: Event DM

Post Reply
User avatar
Crimzonfist
Prince of Bloated Discourse
Posts: 199
Joined: Thu Aug 25, 2005 7:44 am
Location: Michigan

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

Post by Crimzonfist » Tue Jul 11, 2006 9:14 pm

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.
Member - Ivory Order of the Sun
Journeyman of the AKN

"True integrity is doing the right thing, even when no ones watching."
User avatar
Final Shinryuu
Sage
Posts: 2060
Joined: Thu Jun 24, 2004 3:20 am
Location: http://hades.mercuric.net/

Post by Final Shinryuu » Tue Jul 11, 2006 9:37 pm

Try using GetEnteringPC(), and make sure the script is on the OnEnter event of the trigger.
Image
User avatar
Crimzonfist
Prince of Bloated Discourse
Posts: 199
Joined: Thu Aug 25, 2005 7:44 am
Location: Michigan

Post by Crimzonfist » Tue Jul 11, 2006 9:39 pm

ah, thanx i didn't see that one :)
Member - Ivory Order of the Sun
Journeyman of the AKN

"True integrity is doing the right thing, even when no ones watching."
User avatar
Crimzonfist
Prince of Bloated Discourse
Posts: 199
Joined: Thu Aug 25, 2005 7:44 am
Location: Michigan

Post by Crimzonfist » Tue Jul 11, 2006 9:42 pm

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.");
   }
Member - Ivory Order of the Sun
Journeyman of the AKN

"True integrity is doing the right thing, even when no ones watching."
User avatar
Final Shinryuu
Sage
Posts: 2060
Joined: Thu Jun 24, 2004 3:20 am
Location: http://hades.mercuric.net/

Post by Final Shinryuu » Tue Jul 11, 2006 9:48 pm

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.
Image
User avatar
Crimzonfist
Prince of Bloated Discourse
Posts: 199
Joined: Thu Aug 25, 2005 7:44 am
Location: Michigan

Post by Crimzonfist » Tue Jul 11, 2006 10:08 pm

Final Shinryuu,

Thanx for sharing Red Golem's code with me it worked great. :)
Member - Ivory Order of the Sun
Journeyman of the AKN

"True integrity is doing the right thing, even when no ones watching."
User avatar
jaythespacehound
Apprentice Scholar
Posts: 940
Joined: Wed Sep 22, 2004 6:52 am
Location: Hobart Australia (feels like a small island sometimes...hang on it is) GMT+10

Post by jaythespacehound » Fri Aug 18, 2006 11:46 am

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
User avatar
JollyOrc
Elder Sage
Posts: 3984
Joined: Fri Jan 17, 2003 11:41 am
Timezone: Europe, CE(S)T
Location: Germany
Contact:

Post by JollyOrc » Fri Aug 18, 2006 1:14 pm

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.
Post Reply