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


Joined: 17 Sep 2003
Posts: 3
Location: Canada

PostPosted: Wed Sep 17, 2003 4:37 pm   

Reroll Script
 
I've tried to figure this out, but I'm no code warrior so... I can't.
I'm looking for a script to re-roll base stats... Here is the output from the mud.

Your character's base stats have been rerolled...
New Previous
Strength 18 15
Dexterity 15 15
Intelligence 14 15
Wisdom 12 12
Charisma 9 9
Constitution 14 16
Luck 13 13

I want to be able to specify what minimum stats I want and have the char reroll 'till it gets those stats...

Thanks for your help.

L
Reply with quote
PrestoPimp
Apprentice


Joined: 18 Sep 2001
Posts: 175
Location: USA

PostPosted: Wed Sep 17, 2003 6:16 pm   
 
something like..

#TRIGGER {Strength (%n) (%n)} {#IF (%1<@strwanted) {#ADD reroll 1} {}
#TRIGGER {Dexterity (%n) (%n)} {#IF (%1<@dexwanted) {#ADD reroll 1} {}
#TRIGGER {Intelligence(%n) (%n)} {#IF (%1<@intwanted) {#ADD reroll 1} {}
#TRIGGER {Wisdom (%n) (%n)} {#IF (%1<@wiswanted) {#ADD reroll 1} {}
#TRIGGER {Charisma (%n) (%n)} {#IF (%1<@chawanted) {#ADD reroll 1} {}
#TRIGGER {Constitution (%n) (%n)} {#IF (%1<@conwanted) {#ADD reroll 1} {}
#TRIGGER {Luck (%n) (%n)} {#IF (%1<@lckwanted) {reroll} {#IF (@reroll=0) {dokeep} {reroll;#VAR reroll 0}

That should work for you.. you wanna put the min. values of that stat in the proper variables.
Reply with quote
Limbless
Newbie


Joined: 17 Sep 2003
Posts: 3
Location: Canada

PostPosted: Wed Sep 17, 2003 9:47 pm   
 
Sorry I didn't realize that the spaces got stripped out of my last post... Will that make a difference? The actual output from the mud looks like this without the '.'s:

Your.character's.base.stats.have.been.rerolled...
.....................New.............Previous
Strength..............14...................14
Dexterity.............14...................16
Intelligence..........13...................12
Wisdom................12...................13
Charisma...............9...................11
Constitution..........18...................16
Luck..................15...................13
Reply with quote
PrestoPimp
Apprentice


Joined: 18 Sep 2001
Posts: 175
Location: USA

PostPosted: Wed Sep 17, 2003 11:34 pm   
 
Try the way I said before.. and if it doesnt work.. try this instead.

#TRIGGER {Strength*(%n)*(%n)} {#IF (%1<@strwanted) {#ADD reroll 1} {}
#TRIGGER {Dexterity*(%n)*(%n)} {#IF (%1<@dexwanted) {#ADD reroll 1} {}
#TRIGGER {Intelligence*(%n)*(%n)} {#IF (%1<@intwanted) {#ADD reroll 1} {}
#TRIGGER {Wisdom*(%n)*(%n)} {#IF (%1<@wiswanted) {#ADD reroll 1} {}
#TRIGGER {Charisma*(%n)*(%n)} {#IF (%1<@chawanted) {#ADD reroll 1} {}
#TRIGGER {Constitution*(%n)*(%n)} {#IF (%1<@conwanted) {#ADD reroll 1} {}
#TRIGGER {Luck*(%n)*(%n)} {#IF (%1<@lckwanted) {reroll} {#IF (@reroll=0) {dokeep} {reroll;#VAR reroll 0}

* should match any amount of blank space in between the stats and numbers.
Hope this works for you.
Reply with quote
Limbless
Newbie


Joined: 17 Sep 2003
Posts: 3
Location: Canada

PostPosted: Thu Sep 18, 2003 12:53 am   
 
Hmmm... I'm so close to having this working. Now the %n is capturing only the second part of the two digit number. ie. if strength were to equal 16, %n is only storing 6... Thanks for all of your help.

L
Reply with quote
PrestoPimp
Apprentice


Joined: 18 Sep 2001
Posts: 175
Location: USA

PostPosted: Thu Sep 18, 2003 1:26 am   
 
Did you try it the first way before the *'s were added? I think zmud automatically will go for any white space without the *'s now and maybe that's whats messing it up.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Thu Sep 18, 2003 4:40 am   
 
You can match white space with %s (first trigger). In this case, there will always be at least two spaces so you can also use * with spaces on both sides so it won't pick up any digits (second trigger). You can also leave spaces with %s, to improve readability, when you are certain there will be at least three spaces which there will be in this case (third trigger).

#TRIGGER {Strength%s(%n)%s(%n)} {#IF (%1 < @strwanted) {#ADD reroll 1}}
#TRIGGER {Dexterity * (%n) * (%n)} {#IF (%1 < @dexwanted) {#ADD reroll 1}}
#TRIGGER {Intelligence %s (%n) %s (%n)} {#IF (%1 < @intwanted) {#ADD reroll 1}}

Wildcards always match as much as they can before giving way to the next character/wildcard in the pattern. When you use *(%n) to match spaces followed by a two-digit number, the * matches all the spaces AND the first digit, but leaves the second digit so the %n will have something to match. But when you use * (%n) instead, the * has to leave a space to match the space in the pattern so all the digits are left for the %n.
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