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: Tue Oct 05, 2010 5:43 pm   

MXP issue
 
I got this package from another player on my MUD and he said it broke after version 2.37.
Here is the script of one trigger which changes the text found from the database variable and replaces it with the MXP. For some reason it isn't displaying correctly. and when you click on the link it changes the value in the database variable.

Here is the database variable: (As you can see that one some of values in the database they got changed to have part of the trigger in it)
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <var name="craftList2" type="Record">
    <value><![CDATA[bin="make|<send 'mat bin|<send 'mat bin|<send 'mat bin|<send 'mat bin|<send 'mat bin|<send 'mat bin|<send 'mat bin|<send 'mat bin|<send 'mat bin|<send 'mat bin|<send 'mat bin|<send 'mat bin|<send 'mat bin|<send 'mat bin|<send 'mat bin"|bucket="fill|<send 'mat BUCKET|<send 'mat bucket|<send 'mat bucket|<send 'mat bucket|<send 'mat BUCKET|<send 'mat bucket|<send 'mat bucket|<send 'mat bucket|<send 'mat bucket"|collect=acorns|straw-pile=arrange]]></value>
    <json><![CDATA[{"bin":["make","<send 'mat bin","<send 'mat bin","<send 'mat bin","<send 'mat bin","<send 'mat bin","<send 'mat bin","<send 'mat bin","<send 'mat bin","<send 'mat bin","<send 'mat bin","<send 'mat bin","<send 'mat bin","<send 'mat bin","<send 'mat bin","<send 'mat bin"],"collect":"acorns","straw-pile":"arrange","bucket":["fill","<send 'mat BUCKET","<send 'mat bucket","<send 'mat bucket","<send 'mat bucket","<send 'mat BUCKET","<send 'mat bucket","<send 'mat bucket","<send 'mat bucket","<send 'mat bucket"]}]]></json>
  </var>
</cmud>

Here is the trigger:
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <trigger name="CraftUser" priority="90" repeat="true">
    <pattern>({@craftList})</pattern>
    <value><![CDATA[$color=slategray
#IF (%ismember( %1, @craftList)) {
  #NOOP
  #SUB {<send 'mat %1|@{craftlist.%1} %1' 'Materials for %1|Perform %1'><color $color>%1</color></send>}
  }]]></value>
  </trigger>
</cmud>

And below are screenshots: (Yes the screenshot have output in here that isn't in the script. I had print statements added to look at the output of %1)


_________________
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: Tue Oct 05, 2010 6:06 pm   
 
Three questions.
1) Why are you using an #IF statement there? If the value isn't a member of @craftList, then the trigger won't fire.
2) Why is there a #NOOP there? That command does nothing.
3) Have you tested this with the most recent version of the beta? There was a bug fix in version 3.30 (the latest) to correct a problem with #SUB with the repeat option.
Reply with quote
darmir
Sorcerer


Joined: 10 Oct 2000
Posts: 706
Location: USA

PostPosted: Tue Oct 05, 2010 6:10 pm   
 
Rahab,
This wasn't my script. I just got it from someone else.
1) I noticed that myself.
3) I am not sure why that is there.
3) I am using the lastest version of CMUD
And I did partially figure out what was wrong with his script.. A very simple change from:
Code:
#SUB {<send 'mat %1|@{craftlist.%1} %1' 'Materials for %1|Perform %1'><color $color>%1</color></send>

to
Code:
#SUB {<send 'mat %1|{@craftList.%1} %1' 'Materials for %1|Perform %1'><color $color>%1</color></send>}


But the only issue is when I do the Perform menu list it shows it in {} and fails.


So I think that there is an issue with the second part of the MXP command for a menu.
I also tried it with a local variable and it sends $task instead of the value of the variable
_________________
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
darmir
Sorcerer


Joined: 10 Oct 2000
Posts: 706
Location: USA

PostPosted: Tue Oct 05, 2010 7:25 pm   
 
I've done a little more research on this issue and I think I found a bug. When you have any value used for the right click menu option command it fails. I changed the menu on the second command
to use the $task variable and it shows, but the command doesn't. When I click on "Perform" option. It gives the the incorrect value to the mud.
Here is the trigger code:
Code:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <trigger name="CraftUser" priority="90" repeat="true">
    <pattern>%q({@craftList})%q</pattern>
    <value><![CDATA[$color=slategray
$task = {@craftList.%1}
#print $task
#SUB {<send 'mat %1|$task %1' 'Materials for %1|Perform $task %1'><color $color>%1</color></send>}
]]></value>
  </trigger>
</cmud>


Here is the output:
The 'mat lantern' is when I left click on the link called lantern. The '$task lantern' is the output I get when I right click the menu and select "Perform lang lantern". It displays the variable correctly in the menu.
Code:


<****** / ||||||> mat lantern

General-labor: hang lantern
Phase 1:  20 seconds
Held or in Room (Consumed): a small, metal hook.
Phase 2:  5 seconds
Held or in Room (Consumed): a brass lantern.
Held or in Room (Consumed): a thin-walled tin container.
Produced: a plain tin container.
Phase 3:  1 seconds
Produced: a lantern hanging from the wall.

<****** / ||||||> $task lantern
Input with the '$' character is not permitted.
_________________
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
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4662
Location: Pensacola, FL, USA

PostPosted: Tue Oct 05, 2010 7:48 pm   
 
I found that error as well, wrapping the command in #EXEC like the original thread for this issue shows, fixes it....
I still dont understand how this would have corrupted the variable to start with

P.S. Darmir, you might wanna check your own variable to ensure that the value on your pairs didn't get corrupted, i check by typing 'send' into the filter for the variable in the settings editor.
_________________
Discord: Shalimarwildcat
Reply with quote
darmir
Sorcerer


Joined: 10 Oct 2000
Posts: 706
Location: USA

PostPosted: Tue Oct 05, 2010 8:06 pm   
 
shalimar wrote:
I found that error as well, wrapping the command in #EXEC like the original thread for this issue shows, fixes it....
I still dont understand how this would have corrupted the variable to start with

P.S. Darmir, you might wanna check your own variable to ensure that the value on your pairs didn't get corrupted, i check by typing 'send' into the filter for the variable in the settings editor.

Wrap what in EXEC? If you wrap the SUB in EXEC it doesn't work
_________________
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
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4662
Location: Pensacola, FL, USA

PostPosted: Tue Oct 05, 2010 8:12 pm   
 
Just the command for sending the craft.

After you send me your fix on the other forums i went in and tweaked it a bit to be:

#EXEC {~@{craftList.%1} %1}
_________________
Discord: Shalimarwildcat
Reply with quote
darmir
Sorcerer


Joined: 10 Oct 2000
Posts: 706
Location: USA

PostPosted: Tue Oct 05, 2010 9:20 pm   
 
Cool. Awesome I like really like this script.. Are you going to upload the latest version to library.
I also changed it a little from yours to have one more word in the perform menu and it uses a the local variable.
Here is the trigger completed:
Code:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <trigger name="CraftUser" priority="90" repeat="true">
    <pattern>%q({@craftList})%q</pattern>
    <value><![CDATA[$color=slategray
$task = {@craftList.%1}
#SUB {<send 'mat %1|#EXEC {$task %1}' 'Materials for %1|Perform $task %1'><color $color>%1</color></send>}
]]></value>
  </trigger>
</cmud>
_________________
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: Wed Oct 06, 2010 12:27 pm   
 
The right-click statement has to be a command. $task is not a command. That was the problem. Commands cannot start with a variable or function.
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Thu Oct 14, 2010 5:25 pm   
 
The other problem is that the | character in the #SUB is being parsed as a string list creation character. If you create the #SUB command using a %concat statement, then you won't have this problem. Or, you can put a ~ character in front of the | to send it to the SEND tag properly.

For example:
Code:
$color=slategray
$task = {@craftList.%1}
#sub {<send 'mat %1~|$task %1' 'Materials for %1~|Perform $task %1'><color $color>%1</color></send>}


The issue of $task not being a command isn't a problem in this case. The $task variable is expanded when the #sub command is compiled and executed, so it actually works properly and you do not need the #EXEC command. Having a command starting with a variable is only a problem when that is the only thing on the line...it's not a problem when creating the argument to another function, like #SUB.
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