|
yarddog62801 Newbie
Joined: 12 Jun 2006 Posts: 4
|
Posted: Sun Feb 23, 2014 8:49 pm
zmud to cmud trigger convert help needed |
#DELCLASS {Rescue}
#ALIAS rescoff {#t- Rescue;#say RESCUE TRIGGERS DISABLED!!!}
#ALIAS rescon {#t+ Rescue;#say RESCUE TRIGGERS ENABLED!!!}
#CLASS {Rescue}
#ALIAS radd {#class {Rescue};#if @Rescuelist="NONE!" {#unvar RescueList {Rescue}};#forall %replace( %-1, " ", "|") {#if %ismember( %proper( %{i}), @RescueList) {#say Already on the List: %proper( %i)} {#additem RescueList %proper( %{i});#say Added to Rescue List: %proper( %{i})}};%null;#noop;#class 0;rescrep;#t+ Attacks;#t+ Combat;#t+ Fighting;#t+ Gating;#t+ Stabbing;#t+ Switches;#t+ Tank}
#ALIAS rclear {#unvar RescueList {Rescue};#class {Rescue};#additem RescueList "NONE!";#class 0;#say Rescue List Cleared!;#t- Attacks;#t- Combat;#t- Fighting;#t- Gating;#t- MiscEnabler;#t- Stabbing;#t- Switches;#t- Tank}
#ALIAS rlist {#say Current Rescue List: %sort( @RescueList)}
#ALIAS rrem {#forall %replace( %-1, " ", "|") {#if %ismember( %proper( %{i}), @RescueList) {#delitem RescueList %proper( %{i});#say Removed from Rescue List: %proper( %{i})} {#say Not on the List: %proper( %{i})}};#if @RescueList=%null {#class {Rescue};#additem RescueList "NONE!";#class 0};%null;#noop;rescrep}
#VAR RescueList {NONE!}
#TRIGGER {Variable RescueAttempt removed.} {#gag;#cr}
#TRIGGER {Variable RescueList removed.} {#gag;#cr}
#CLASS 0
#CLASS {Rescue|Attacks}
#TRIGGER {(*){beat|beats|choke|chokes|touch|touches|hit|hits|slash|slashes|crush|crushes|misses|whip|whips|pierce|pierces|smash|smashes|sting|stings|drain|drains|strike|strikes|pummel|pummels|pound|pounds|claw|claws|nip|nips|burn|burns|bite|bites} ({@RescueList})*} {#t+ Position;rescue %2;#var RescueAttempt %additem( %2, @RescueAttempt) {} {Rescue};#t+ MiscEnabler;#t- Tank;#t- Attacks}
#TRIGGER {(*) attacks ({@RescueList})} {#t+ Position;rescue %2;#var RescueAttempt %additem( %2, @RescueAttempt) {} {Rescue};#t- Tank;#t- Attacks}
#TRIGGER {Upon being struck, a mirror image of ({@RescueList}) shatters into a million particles of light!} {#t+ Position;rescue %1;#var RescueAttempt %additem( %1, @RescueAttempt) {} {Rescue}};#t- Attacks
#CLASS 0
#CLASS {Rescue|Combat}
#TRIGGER {You fail the rescue.} {rescue @RescueAttempt}
#TRIGGER {Banzai! To the rescue...} {#unvar RescueAttempt {Rescue};#t- Position;#t+ Attacks;#t+ Fighting;#t+ Tank;#t+ Switches}
#TRIGGER {But nobody is fighting {him|her|it}?} {#unvar RescueAttempt {Rescue};#t- Position;#t+ Attacks;#t+ Tank;#t+ Switches}
#TRIGGER {Who do you want to rescue?} {#unvar RescueAttempt {Rescue};#t- Position;#t+ Attacks;#t+ Tank;#t+ Switches}
#TRIGGER {(*) strikes out wildly about the area in a mighty burst of power!} {#t- Attacks;#t+ MiscEnabler}
#TRIGGER {(*) enshrouds ({@RescueList}) in a mist of blood} {#t+ Position;rescue %2;#var RescueAttempt %additem( %2, @RescueAttempt) {} {Rescue}}
#TRIGGER {({@RescueList}) is nearly slain by the force of} {#t+ Position;rescue %1;#var RescueAttempt %additem( %1, @RescueAttempt) {} {Rescue}}
#TRIGGER {({@RescueList}) gasps from (*) awesome} {#t+ Position;rescue %1;#var RescueAttempt %additem( %1, @RescueAttempt) {} {Rescue}}
#TRIGGER {futilely tries to rescue ({@RescueList})!} {#t+ Position;rescue %1;#var RescueAttempt %additem( %1, @RescueAttempt) {} {Rescue}}
#TRIGGER {heroically rescues ({@RescueList}).} {#unvar RescueAttempt {Rescue};#t- Position;#t+ Tank;#t+ Switches;#t+ Attacks}
#TRIGGER {({@RescueList}) staggers from a fearsome} {#t+ Position;rescue %1;#var RescueAttempt %additem( %1, @RescueAttempt) {} {Rescue}}
#TRIGGER {lands a mighty (*) on ({@RescueList})!} {#t+ Position;rescue %2;#var RescueAttempt %additem( %2, @RescueAttempt) {} {Rescue}}
#TRIGGER {(*) tried to backstab ({@RescueList}), but nearly cuts {his|her|its} own finger.} {#t+ Position;rescue %2;#var RescueAttempt %additem( %2, @RescueAttempt) {} {Rescue}}
#TRIGGER {(*) places (*) in the back of ({@RescueList}), resulting in some strange noises and some blood.} {#t+ Position;rescue %3;#var RescueAttempt %additem( %3, @RescueAttempt) {} {Rescue}}
#CLASS 0
#CLASS {Rescue|Fighting}
#TRIGGER {fighting ({@RescueList}).} {#t+ Position;rescue %1;#var RescueAttempt %additem( %1, @RescueAttempt) {} {Rescue};#t+ MiscEnabler;#t- Fighting}
#CLASS 0
#CLASS {Rescue|Gating}
#TRIGGER {^With an arcane motion of {his|her|its} hand, (*) gates in (*)!} {look;#t+ MiscEnabler;#t- Gating}
#CLASS 0
#CLASS {Rescue|MiscEnabler} {disable}
#TRIGGER {^< (*) T: (*) >} {#t+ Attacks;#t+ Fighting;#t+ Gating;#t+ Stabbing;#t+ Switches;#t- Tank;#t- MiscEnabler}
#CLASS 0
Can any give me some pointers on how to convert the above to cmud? |
|
|
|
Scarn Apprentice
Joined: 24 Jul 2005 Posts: 137
|
Posted: Sun Feb 23, 2014 11:49 pm |
What happens when you paste them into CMUD. Most of my triggers worked fine, I only had problems with my map scripts.
|
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Mon Feb 24, 2014 4:11 am |
I don't see any of the obvious compatability fixes, so in all likelihood your script should work as-is. There could be some improvements made but those might not necessarily be needed:
1)using multistate triggers versus single-state triggers. All those #T+/#T- commands can sometimes get out of whack (this was more true in ZMud where triggers were NOT executed in sequence). By using multistates, you can get rid of them and have CMud completely control which trigger state is the active state. Not always an improvement, but it can definitely help declutter your code.
2)#class versus //module/class/var syntax. #CLASS is one of them weird commands that you technically can use but which you probably shouldn't. This again goes back to ZMud era where stuff could execute in parallel, as zmud would automatically change the default class during execution.
3)this one's a bit counter-intuitive and not necessarily better, but a simple wildcard like %w is better than a stringlist. With a single stringlist, cmud has to first unroll the list to check each possible element so essentially you have a number of trigger patterns equal to the number of elements in that stringlist. This number would grow more quickly when you introduce multiple stringlists. The downside, of course, is that the pattern becomes more widely matchable and thus easier to spoof/misfire.
4)be as specific as you can with wildcards. * is quite convenient, but if you are looking for a single word that consists of only letters and numbers you should instead use %a. Sometimes you may wish to use a character class (range), which you build using [] and listing every character you wish to include (wildcards can also be used here, and you'll need to quote any characters from the special characters list and the trigger-pattern special characters set).
5)#SAY and #ECHO output can be matched by triggers. If you really want this to not happen, should probably change these to #PRINT, but keep in mind that some things like secure mxp tags (ie, send) won't work.
6)in relation to #5, if you have plain text you wish to show you should surround it in double quotes. Double quotes now mean "do not process" rather than "all this stuff is one entity", which is why you do not use "%1" versus %1.
7)take advantage of multiline syntax, if for no other reason than to help you easily read your own code (or someone else's for that matter). Tracking down a bug is SO much easier that way. |
|
_________________ EDIT: I didn't like my old signature |
|
|
|
yarddog62801 Newbie
Joined: 12 Jun 2006 Posts: 4
|
Posted: Tue Feb 25, 2014 2:07 am |
ok to be honest, i didnt write the above script. and what you just said (@MattLofton) might as been written in wingdings... I apologize in advance for my noobness. I get a ton of illegal chars errors.
If anyone would be willing to stream line this abit, I would be all kinds of happy.
Happy mudding |
|
|
|
|
|
|
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
|
|