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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
DSL_Character
Beginner


Joined: 18 Aug 2010
Posts: 13

PostPosted: Sat Aug 18, 2012 7:48 am   

[Q]Trouble converting script from zmud to cmud (Answered: 8/18/12)
 
I have a script that I use for various tasks ranging from gear gathering, money gathering, questing, etc etc. Problem is, I've recently upgraded to cmud and I'm having trouble migrating everything over. I'm hoping one of you could explain to me what I'm doing wrong.

The following script (simplified for viewing ease):

Code:

#CASE RandomQuest {n;#wait 500;get @item;#wait 500} {e;#wait 500;get @item;#wait 500} {s;#wait 500;get @item;#wait 500}


The script basically enters a room, attempts to get @item, which is populated by an earlier piece of the script that tells it what to pick up, but if it can't find the item in the room, then it triggers "#ADD RandomQuest 1" to a separate file which tells the script to go to the next step and try and find the @item again. The problem is that since converting to cmud, it no longer goes to the next step, it simply stays at step 1 and repeats it over and over again.

The following is a more complete portion of the script for you see what all is involved and what could possibly be the problem:

Code:

<?xml version="1.0" encoding="ISO-8859-1"?>
-<cmud> -<class enabled="false" name="RandomQuestScript"> +<alias name="scriptbegin"> -<alias name="scriptstart"> <value>#CASE RandomQuest {up;#wait 500;g @item;#wait 500} {up;#wait 500;g @item;#wait 500} {ne;#wait 500;g @item;#wait 500} {nw;#wait 500;g @item;#wait 500} {sw;#wait 500;g @item;#wait 500} {up;#wait 500;g @item;#wait 500} {se;#wait 500;g @item;#wait 500} {ne;#wait 500;g @item;#wait 500} {recall;n;n;#wait 500;pqdone;pq info}</value> </alias> <var name="RandomQuest" type="String">1</var> -<class name="BackEnd"> -<trigger priority="24210"> <pattern>I see no 2.@item here.</pattern> <value>#ADD RandomQuest 1;scriptstart</value> </trigger> -<trigger priority="24220"> <pattern>I see no @item here.</pattern> <value>#ADD RandomQuest 1;scriptstart</value> </trigger> -<trigger priority="24230"> <pattern>Looting is not permitted.</pattern> <value>g 2.@item</value> </trigger> -<trigger priority="24240"> <pattern>That does not belong to you!</pattern> <value>g 2.@item</value> </trigger> -<trigger priority="24250"> <pattern>You scratch your head.</pattern> <value>scriptbegin;scriptstart</value> </trigger> -<trigger priority="24260"> <pattern>You mount a wild black horse.</pattern> <value>n;n;e;e;s;s;scratch</value> </trigger> </class> </class> </cmud>


Last edited by DSL_Character on Sat Aug 18, 2012 5:27 pm; edited 1 time in total
Reply with quote
Daern
Sorcerer


Joined: 15 Apr 2011
Posts: 809

PostPosted: Sat Aug 18, 2012 4:34 pm   
 
Looks like you're missing a @ before RandomQuest in your case to make it a variable reference, the case is actually running on the string "RandomQuest", not the contents of the variable. I'm shocked that even worked in zMUD.
Reply with quote
DSL_Character
Beginner


Joined: 18 Aug 2010
Posts: 13

PostPosted: Sat Aug 18, 2012 5:07 pm   
 
Actually, the above is modified code as per the cmud reference manual. The original code looked like this:

Code:
#CASE {@RandomQuest} {n;#wait 500;g  @item;#wait 500} {n;#wait 500;g  @item;#wait 500}


Cmud Manual told me to remove the {}'s and @'s in the #case, changing the above line into this:

Code:
#CASE RandomQuest {n;#wait 500;g  @item;#wait 500} {n;#wait 500;g  @item;#wait 500}


Am I misinterpreting the help manual and I'm supposed to keep the @ in?
Reply with quote
DSL_Character
Beginner


Joined: 18 Aug 2010
Posts: 13

PostPosted: Sat Aug 18, 2012 5:26 pm   
 
DSL_Character wrote:
Am I misinterpreting the help manual and I'm supposed to keep the @ in?


Super lame. I added the @ back in and now everything works again. Thanks for the help.
Reply with quote
Daern
Sorcerer


Joined: 15 Apr 2011
Posts: 809

PostPosted: Sat Aug 18, 2012 6:08 pm   
 
The CMUD documentation for #CASE is literally copy/pasted from the old zMUD documentation :P You can see in this simple example from the documentation that the @ is there:
Code:
#CASE @joincmd {join} {rescue}


So I'm not sure why you thought the CMUD manual told you to remove the @...
Reply with quote
DSL_Character
Beginner


Joined: 18 Aug 2010
Posts: 13

PostPosted: Sat Aug 18, 2012 8:10 pm   
 
Daern wrote:
The CMUD documentation for #CASE is literally copy/pasted from the old zMUD documentation :P


I already feel foolish enough without having you rub it in, haha. I just could have sworn I read somewhere that in Cmud, the @ was no longer required, but I must have read that in a context that was referring to another use.

Thanks again for the help,

Cheers!
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion 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