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
darmir
Sorcerer


Joined: 10 Oct 2000
Posts: 706
Location: USA

PostPosted: Thu Oct 07, 2010 10:27 pm   

[v3.30] Room Scripts
 
I have a script that I would like to run in certain rooms. What this script does is changes the word farm in the description to a MXP link, but it is firing on the word farmstead also. I just want it to fire on farm.
Here is the room script:

#sub {farm} {<send 'enter farm' 'Goto farm'><color PaleGreen>farm</color></send>}
_________________
Run as hard as a wild beast if you will, but you won't get any reward greater than that destined for you.
Source: (Egyptian)
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Thu Oct 07, 2010 11:58 pm   
 
Use %q around the pattern.
_________________
EDIT: I didn't like my old signature
Reply with quote
darmir
Sorcerer


Joined: 10 Oct 2000
Posts: 706
Location: USA

PostPosted: Fri Oct 08, 2010 12:13 am   
 
Thanks Matt. I was trying the wrong pattern. When I did that it creates another trigger under the session window, not for the room script.
_________________
Run as hard as a wild beast if you will, but you won't get any reward greater than that destined for you.
Source: (Egyptian)
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Fri Oct 08, 2010 12:27 am   
 
#sub {pattern} {code} always creates a new trigger. You will see the same behavior if you used #trigger, #alias, and other settings-creating commands. This version of the #SUBSTITUTE command is saying create a new #TRIGGER that matches "pattern" and replace it with "code".

In the v3 mapper, if you want to create a room script, create a new folder (its key ID must follow the format of Room###, where ### is the roomkey), and create your triggers and other settings you want to have for the script. The mapper will automatically look for the class key with that identifier and will automatically enable/disable it as needed.
_________________
EDIT: I didn't like my old signature
Reply with quote
darmir
Sorcerer


Joined: 10 Oct 2000
Posts: 706
Location: USA

PostPosted: Fri Oct 08, 2010 1:09 am   
 
Okay. I think I found a bug if you edit an existing room script it doesn't modify. For some reason it creates another one. I'll test this a little more and see if I can duplicate it a few more times.
_________________
Run as hard as a wild beast if you will, but you won't get any reward greater than that destined for you.
Source: (Egyptian)
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Fri Oct 08, 2010 2:43 pm   
 
What exactly do you mean by "room script"? If you mean a script that runs when you enter or leave a room, it is done very differently in v3.xx than the old v2 method. Now those scripts are done as 'enable' and 'disable' scripts on a class whose key matches the room.

If you mean a script inside that class, and trying to change the script from the command line, the problem is probably that the class is disabled. The room class is enabled automatically when you enter the room, and disabled when you leave the room. If the class is disabled, all the scripts inside it are invisible to your other scripts, including your command line. So, if you type that on the command line or in another script while the class is disabled, Cmud won't see your room script and will create a new one.
Reply with quote
darmir
Sorcerer


Joined: 10 Oct 2000
Posts: 706
Location: USA

PostPosted: Fri Oct 08, 2010 3:04 pm   
 
I went to the edit scripts for this button. It opens the editor. I changed the scripts and saved it. Then I left the room and re entered it. The old scripts fires. Then I go look at the editor and under the MUD window is the new trigger I created. I goto the map under Map: <mud name> I click the + icon to expand to see all of the Room Classes. I expand the room class for the room I changed the trigger in and I see the old trigger NOT the new one I created.
_________________
Run as hard as a wild beast if you will, but you won't get any reward greater than that destined for you.
Source: (Egyptian)
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Fri Oct 08, 2010 6:55 pm   
 
If you are using v.3.xx, you should not use the Edit Scripts button. As I mentioned above, room scripts have changed radically for v.3.xx. See the sticky note above, "CMUD, CMUD Pro and TeSSH v3.30 RC4 version released": http://forums.zuggsoft.com/forums/viewtopic.php?t=36040.
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