Server Totals
Deglos - (0)
Le'Or - (0)
Ferrell - (0)
Elysia - (0)
M'Chek - (0)
Mikona - (0)
Wilderness - (0)
Visimontium - (0)
Underdark - (0)
Total players: 0
Gallery

Links Menu

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

Moderators: Nighthawk4, Dungeon Masters

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

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

PostAuthor: 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
Final Shinryuu
Sage
 
Posts: 2060
Joined: Thu Jun 24, 2004 3:20 am
Location: http://hades.mercuric.net/

PostAuthor: 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

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

PostAuthor: 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
Final Shinryuu
Sage
 
Posts: 2060
Joined: Thu Jun 24, 2004 3:20 am
Location: http://hades.mercuric.net/

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

PostAuthor: 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
jaythespacehound
Apprentice Scholar
 
Posts: 941
Joined: Wed Sep 22, 2004 6:52 am
Location: Hobart Australia (feels like a small island sometimes...hang on it is) GMT+10

PostAuthor: 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.
User avatar
JollyOrc
QA Resource
 
Posts: 3900
Joined: Fri Jan 17, 2003 11:41 am
Location: Germany
Timezone: GMT+1


Return to NWN Scripting

Who is online

Registered users: Bing [Bot], Google [Bot]