|
thucar Beginner
Joined: 06 Jan 2009 Posts: 20
|
Posted: Tue Feb 03, 2009 12:55 pm
Room Scripts only work once |
It could be I'm doing something wrong.
But I created a bunch of room scripts to change a single variable
So let's say in room1 I have
Code: |
#VAR varRoomscript cat
|
in another
Code: |
#VAR varRoomscript dog
|
and again in another one
Code: |
#VAR varRoomscript horse
|
And I am using this variable in a #SWITCH statement later on.
The problem is, everything worked fine the first time I tried this. But when moving into one of these rooms for the second time, the variable does not get changed.
The debugger tells me that the room script fired, but variable never changes. |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Tue Feb 03, 2009 4:13 pm |
From your description, I deduce the scripts you show are the 'enable' scripts for folders representing your rooms? Could you show us the XML for one of these folders? Where is the @varRoomscript variable in relation to these room folders?
|
|
|
|
thucar Beginner
Joined: 06 Jan 2009 Posts: 20
|
Posted: Tue Feb 03, 2009 8:32 pm |
Code: |
<class name="Room14732" keyword="Room14732" enabled="false" id="1404">
<onenable>#VAR varRoomscript dog</onenable>
<var name="varRoomscript" id="1429">dog</var>
</class> |
@varRoomscript was not defined when I set the triggers up. So it was created automatically and is situated in the root folder[/url] |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Tue Feb 03, 2009 9:44 pm |
Actually, it looks like there is a variable @varRoomscript in that very folder. That could be the problem.
|
|
|
|
Dumas Enchanter
Joined: 11 Feb 2003 Posts: 511 Location: USA
|
Posted: Tue Feb 03, 2009 10:52 pm |
wouldn't this be a case where he would need to use the class syntax to access and store the variable as a global? Such as #VAR /varRoomscript dog ?
|
|
|
|
gamma_ray Magician
Joined: 17 Apr 2005 Posts: 496
|
Posted: Wed Feb 04, 2009 11:12 am |
I think just manually creating the variable in the upper level of the map (i.e. NOT in one of the room classes) should fix things. Because the Room### folders are constantly being enabled and disabled, so no wonder you'd be having problems. As long as the script can see the variable somewhere else, it should be using that first instead of trying to recreate a more local version. (Just do remember to delete all of the other copies.)
|
|
|
|
thucar Beginner
Joined: 06 Jan 2009 Posts: 20
|
Posted: Fri Feb 13, 2009 12:36 pm |
yeha, that did it. Created the variables manually and now works fine.
Thank you all for your help |
|
|
|
|
|