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
Terrapin
Newbie


Joined: 05 Jun 2002
Posts: 1

PostPosted: 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=-
Reply with quote
wth
Novice


Joined: 14 Nov 2001
Posts: 37
Location: Poland

PostPosted: 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
Reply with quote
NiteTrip
Novice


Joined: 21 May 2002
Posts: 40
Location: Canada

PostPosted: 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.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: 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}}".
Reply with quote
NiteTrip
Novice


Joined: 21 May 2002
Posts: 40
Location: Canada

PostPosted: 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.
Reply with quote
jeuda
Newbie


Joined: 02 Jul 2002
Posts: 2
Location: Singapore

PostPosted: 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?
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: 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
Reply with quote
Psyrex
Beginner


Joined: 28 Jun 2002
Posts: 15
Location: USA

PostPosted: 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=-
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Wed Jul 03, 2002 4:25 pm   
 
To send an enter to the MUD use the #CR command.

Kjata
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