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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
xavros2188
Newbie


Joined: 07 Nov 2012
Posts: 5

PostPosted: Wed Nov 07, 2012 3:33 am   

converting cmud script to zmud 7.21 script PLEASE HELP
 
<class name="Party Attack" id="49">
<trigger priority="500" id="50">
<pattern>You lead your party into combat against (*)</pattern>
<value>$npc_list=%replace( %1, ". ", "")
$npc_list=%replace( $npc_list, ".", "")
$npc_list=%replace( $npc_list, ", and ", "|")
$npc_list=%replace( $npc_list, "and ", "|")
$npc_list=%replace( $npc_list, ", ", "|")

#FORALL $npc_list {#SWITCH (%word( %i, 1)="a" || %word( %i, 1)="an") {#ADD curr_mobs 1}
(%word( %i, 1)="two") {#ADD curr_mobs 2}
(%word( %i, 1)="three") {#ADD curr_mobs 3}
(%word( %i, 1)="four") {#ADD curr_mobs 4}
(%word( %i, 1)="five") {#ADD curr_mobs 5}
(%word( %i, 1)="six") {#ADD curr_mobs 6}
}</value>
</trigger>
<var name="curr_mobs" id="51">0</var>
<trigger priority="520" id="52">
<pattern>dealt the death blow</pattern>
<value>#IF (@curr_mobs) {curr_mobs=(@curr_mobs - 1)}</value>
</trigger>
</class>
Reply with quote
shalimar
GURU


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

PostPosted: Wed Nov 07, 2012 6:01 am   
 
zMUD has no $local variables, you need to change them into @actual variables
_________________
Discord: Shalimarwildcat
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Wed Nov 07, 2012 6:21 am   
 
1)there are no local variables in ZMud, so change all references to such to regular variables

2)system variables like %1 or %i are preprocessed and then the script code is executed. While not strictly necessary when you know there's only one word in them, it's considered best practice to place them in double quotes. Double quotes will group the contents during parsing so that the entire value is considered one entity.

3)there is no #SWITCH, so revert that to nested #IFs.

4)there is no priority property associated with individual settings. Priority is determined as explained below:

First checked is the current default class. The default class is set via the #CLASS command. If nothing in the default class matches, the search then checks the root level. If nothing matches in the root level, then class folders are checked with all subfolders in a class being checked in like manner before the next class folder on the same level is checked.
Code:

Root
|
---Class1
|   |
|   ---Class4
|   |   |
|   |   ---Class6
|   |   |   |
|   |   |   ---trigger4 = priority 5
|   |   |
|   |   ---trigger3 = priority 4
|   |
|   ---Class5
|   |
|   ---trigger2 = priority 3
|
---Class2 (default class)
|   |
|   ---trigger5 = priority 1
|
---Class3
|
---trigger1 = priority 2


Sometimes you want particular pieces of code to be finished before other things are allowed to happen. For these cases, you would use the #priority command.

5)It probably won't be a factor in this case, but * will no longer match special characters as defined by your Special Characters preferences (ie, the semi-colon for command-separation). Should you need to match on content containing these characters, use %* instead (but keep in mind that this will open up your scripts to hacking such that other players could potentially do bad things to you in terms of your character such as making you drop and destroy all your eq or give all your gold away, as well as in terms of your zmud configuration such as deleting all your scripts.)

6)triggers run in parallel. What this basically means is that for every line received ALL of the matching triggers will execute all at once. What THAT means, is that a higher-priority trigger with complex code will begin executing before a lower-priority trigger but finish executing its code AFTER that later trigger finishes executing its code. Normally this isn't much of a problem, but it can affect your results if you are depending on trigger order.
_________________
EDIT: I didn't like my old signature
Reply with quote
xavros2188
Newbie


Joined: 07 Nov 2012
Posts: 5

PostPosted: Thu Nov 08, 2012 4:08 am   
 
ya i dont really know how to do that on zmud its way old anyway someone could help me farther on this?
Reply with quote
xavros2188
Newbie


Joined: 07 Nov 2012
Posts: 5

PostPosted: Thu Nov 08, 2012 4:13 am   
 
what im looking for it to do on zmud is count npcs in rooms no matter the names of npcs and take away so that i can set my other script files and alias to autorun me through an area basically someone mailed me this cmud thing and prob is i dont have cmud apparently and im NOT good enough by any means to convert this without major help
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD 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