|
Terrapin Newbie
Joined: 05 Jun 2002 Posts: 1
|
Posted: Wed Jun 05, 2002 8:17 pm
Help writing a Trigger |
Okie its been awhile so i can't remember how to do this (last version of zmud i used was 3.??)
Okie i am stat hunting on a mud that outputs your rolled stats like so
'Ability Scores: 11 13 8 7 9 6 '
then you have the option of typing yes or no.
So what i am wonder is how would i write a trigger that would say no if you don't have atleast 3 18's in the ability scores and say yes if you do
Thanks for the help
-=Terrapin=- |
|
|
|
wth Novice
Joined: 14 Nov 2001 Posts: 37 Location: Poland
|
Posted: Wed Jun 05, 2002 9:35 pm |
I.e.
#TRIGGER {Ability Scores: (%d) (%d) (%d) (%d) (%d) (%d)} {
#VARIABLE sayYes 1
#IF (%1<18) {#VARIABLE sayYes 0}
#IF (%2<18) {#VARIABLE sayYes 0}
#IF (%3<18) {#VARIABLE sayYes 0}
#IF (%4<18) {#VARIABLE sayYes 0}
#IF (%5<18) {#VARIABLE sayYes 0}
#IF (%6<18) {#VARIABLE sayYes 0}
#IF (@sayYes=1) {#SEND yes} {#SEND no}
}
--
Waldek
There are no mistakes, just learning experience |
|
|
|
NiteTrip Novice
Joined: 21 May 2002 Posts: 40 Location: Canada
|
Posted: Wed Jun 05, 2002 10:42 pm |
The script wth posted is just an example I think, but it will not work for your needs, it will give you the basic idea. Try this:
#TRIGGER {Ability Scores: (%d) (%d) (%d) (%d) (%d) (%d)} {
#VARIABLE sayYes 0
#IF (%1 < 18) {#ADD sayYes 1}
#IF (%2 < 18) {#ADD sayYes 1}
#IF (%3 < 18) {#ADD sayYes 1}
#IF (%4 < 18) {#ADD sayYes 1}
#IF (%5 < 18) {#ADD sayYes 1}
#IF (%6 < 18) {#ADD sayYes 1}
#IF (@sayYes > 2) {yes} {no}
}
Now, you could further modify this and exclude certain number, CHA for instance which may or may not be important for the class you are trying to roll. |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Wed Jun 05, 2002 11:36 pm |
#TR {^Ability Scores: (*)$} {Abil=%replace(%trim("%1")," ","|");#DELITEM Abil {18};#IF (%numitems(@Abil)>3) {no} {yes}}
A few less lines, and faster too. Your example has a trailing space, if that is not how it is sent by the mud then you will be able to remove the %trim. Also you may wish to put a small delay in there so the mud's admin doesn't get pissed autoroller can eat up bandwidth very quickly. That would be done by changing the "{no}" to "{#ALARM {+1} {no}}". |
|
|
|
NiteTrip Novice
Joined: 21 May 2002 Posts: 40 Location: Canada
|
Posted: Wed Jun 05, 2002 11:43 pm |
Sweet code Vijilante...
Goes to show how different ways of thinking can solves the same problem many different ways, and that in scripting there is no definate "right" answer, just different ways of lookign at things. |
|
|
|
jeuda Newbie
Joined: 02 Jul 2002 Posts: 2 Location: Singapore
|
Posted: Tue Jul 02, 2002 2:36 am |
wow....
I am new to all these scripting. Is there a manual or handbook where I can learn the basics? |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Tue Jul 02, 2002 5:02 am |
quote:
wow....
I am new to all these scripting. Is there a manual or handbook where I can learn the basics?
Yep, the best way is to open up the help file within ZMud by way of the contents tab. Then start at the very first section and start reading.
Another way to do it, if you're not COMPLETELY new to programming in general (or are really smart/common-sense-oriented), is to take each command found in the Help|Command/Function Wizard menu and start using it. The benefits to this approach mean you will more likely figure out the quirks of each command and you can find more direct help for questions concerning commands by clicking the More Help button.
li'l shmoe of Dragon's Gate MUD |
|
|
|
Psyrex Beginner
Joined: 28 Jun 2002 Posts: 15 Location: USA
|
Posted: Wed Jul 03, 2002 1:42 pm |
Hiya, I was wonder if there is some way to manipulate NiteTrip's idea for these mud specific lines: (the thing that stumps me is the 'hit enter' part):
Str: 10 Int: 15 Wis: 10 Dex: 12 Con: 17
Type 'keep' to keep stats, or hit enter to reroll!
-=Psyrex=- |
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Wed Jul 03, 2002 4:25 pm |
To send an enter to the MUD use the #CR command.
Kjata |
|
|
|
|
|