|
DantragBaenre Newbie
Joined: 06 Jan 2013 Posts: 3
|
Posted: Sun Jan 06, 2013 8:00 am
I was wondering... |
I have this code that works on zMUD, but when I upgraded to CMUD it doesn't fire, or work right.
#TRIGGER {There is nobody here called (%*) which you can hit.} {#var combat 0;#var target 0}
#TRIGGER (@combat=0) {#if (%numitems( @moblist)>0) {#var combat 1;#var target %pop( MobList);k @target}} "" {notrig}
#TRIGGER {is dead!} {#if (%numitems( @moblist)=0) {#var target 0};#var combat 0}
#TRIGGER {A sheep has arrived} {#var MobList %additem( "sheep", @MobList);#SAY ADDED 1 SHEEP}
#TRIGGER {^A sheep is grazing here.$} {#var MobList %additem( "sheep", @MobList);#SAY ADDED 1 SHEEP}
#TRIGGER {~[x2~] A sheep is grazing here.$} {#var MobList %additem( "sheep", @MobList);#var MobList %additem( "sheep", @MobList);#SAY ADDED 2 SHEEP}
#TRIGGER {A sheep leaves} {#var MobList %delitem( "sheep", @MobList);#SAY REMOVED 1 SHEEP}
The purpose is obviously when seeing the sheep to add them to @moblist and then kill them off one, by one. Theres a lot more code I have all the zones and mobs coded that work perfectly on zmud, but not even this small set of them work on CMUD, I was wondering if theres some cmd that was changed or something on CMUD that would affect these and make this not work? |
|
|
|
Daern Sorcerer
Joined: 15 Apr 2011 Posts: 809
|
Posted: Sun Jan 06, 2013 8:26 am |
You need to make your (@combat=0) trigger expression type. I believe the syntax to do it on the command line is "#TRIGGER (@combat=0) {#if (%numitems( @moblist)>0) {#var combat 1;#var target %pop( MobList);k @target}} "" {notrig|expression}", but you can just edit it in the package editor and choose expression in the type box at the bottom.
|
|
|
|
DantragBaenre Newbie
Joined: 06 Jan 2013 Posts: 3
|
Posted: Sun Jan 06, 2013 10:16 am |
It said illegal token for "" {notrig|expression} ? When I manually added it to package editor it still doesn't work. I still don't grasp why these triggers work on zmud and not cmud, I enjoy cmud so much better but still use zmud because the triggers work on that lol.
|
|
|
|
DantragBaenre Newbie
Joined: 06 Jan 2013 Posts: 3
|
Posted: Sun Jan 06, 2013 11:38 am |
Your advice put me on the right track and I finally figured out how to make it work. While it was already set to expression on the drop down and that didn't work. I decided to set it to "Looping Expression" and set it to -1 times. Now it works like a charm. Thank you =)
|
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Sun Jan 06, 2013 6:35 pm |
In CMud, expression triggers only fire when the variables used in the expression change. If the combat variable already had a value of 0, then #var combat 0 wouldn't make this trigger fire again. I know it's not relevant here, but in the case of datarecord variables the individual keys are not considered separate variables so changing 5 different keys in the same datarecord variable will cause the expression trigger evaluating one specific key to fire 5 times.
In ZMud, expression triggers would always fire when any variable at all was assigned to even if the assigned value was the same as the existing value. |
|
_________________ EDIT: I didn't like my old signature |
|
|
|
|
|