Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
thucar
Beginner


Joined: 06 Jan 2009
Posts: 20

PostPosted: 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.
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: 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?
Reply with quote
thucar
Beginner


Joined: 06 Jan 2009
Posts: 20

PostPosted: 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]
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: 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.
Reply with quote
Dumas
Enchanter


Joined: 11 Feb 2003
Posts: 511
Location: USA

PostPosted: 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 ?
Reply with quote
gamma_ray
Magician


Joined: 17 Apr 2005
Posts: 496

PostPosted: 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.)
Reply with quote
thucar
Beginner


Joined: 06 Jan 2009
Posts: 20

PostPosted: 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
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net