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
decantor
Apprentice


Joined: 14 Nov 2001
Posts: 100

PostPosted: Wed Nov 14, 2001 7:37 am   

Noobie-ish integer question
 
There is one little thing that has always managed to escape my grasp with every zmud version that I have ever used(and I think I've used them all). It's quite a simple question with a hopefully just-as-simple answer... How can you trigger on an integer that can be negative or positve without using * to replace the negative sign if it is there?

The reason that I ask is that I have basically been writing duplicates of 2 sets of triggers(for prompt and fprompt) ever since I can remember to allow for the alignment of my characters to be displayed properly(Since -1000 does not trigger the same as 1000 does). I have browsed everywhere I could possibly think of to browse, and read through most of this forum bank, but this question did not arise. I have also tried faking zmud out into thinking I knew what I was doing by trying things such as %i, %int, %integer etc., all to no avail. Am I doomed to be forced to use a * just to catch a minus sign?
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Wed Nov 14, 2001 11:40 am   
 
Use %n

Kjata
Reply with quote
decantor
Apprentice


Joined: 14 Nov 2001
Posts: 100

PostPosted: Wed Nov 14, 2001 3:52 pm   
 
A million times, thank-you.
Reply with quote
decantor
Apprentice


Joined: 14 Nov 2001
Posts: 100

PostPosted: Fri Nov 16, 2001 4:51 pm   
 
Hmm ok I finally remembered to try this, and it doesn't seem to work... so my years of making 2 trigger sets due to aligns have yet to end... I will post the trigger tho.

Pattern:
.(%d)|(%d)/(%d)|(%d)/(%d)|(%n)|(%w)|(%w) -

Script:
gold = %1
current_hp = %2
max_hp = %3
current_mana = %4
max_mana = %5
align = %6
#IF %7="E" {style = EVASIVE}
#IF %7="D" {style = DEFENSIVE}
#IF %7="S" {style = STANDARD}
#IF %7="A" {style = AGGRESSIVE}
#IF %7="B" {style = BERSERK}
ihs = %8

This trigger won't fire if my align is evil :(
Reply with quote
Acaila
Apprentice


Joined: 30 Aug 2001
Posts: 187
Location: Netherlands

PostPosted: Fri Nov 16, 2001 7:08 pm   
 
Doesn't %n only capture strings preceded by either a "+" or a "-"? So, -1000 will work, as does +1000, but just 1000 won't. I could be wrong though.

Acaila
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Fri Nov 16, 2001 11:12 pm   
 
quote:

Doesn't %n only capture strings preceded by either a "+" or a "-"? So, -1000 will work, as does +1000, but just 1000 won't. I could be wrong though.

Acaila



If %n fails, you can always use %x. (%x) will capture one-word increments of any combination of symbols (with the possible exception of the special characters), letters, and numbers. Thus, -1000, +1000, and 1000 will all match the pattern.

You might even be able to get something like ({+|-|}%d) to work as well.

li'l shmoe of Dragon's Gate MUD
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Sun Nov 18, 2001 1:23 pm   
 
%n will match any number preceded or not preceded by a plus or minus sign.

I tried the pattern that you supplied:
.(%d)|(%d)/(%d)|(%d)/(%d)|(%n)|(%w)|(%w) -

and it works with no problems. This pattern matches all of these texts:
#sh ~.550|400/400|250/250|+1000|E|jdsds -
#sh ~.550|400/400|250/250|-1000|E|jdsds -
#sh ~.550|400/400|250/250|1000|E|jdsds -

so the problem has to be somewhere else.

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