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
cxs410
Beginner


Joined: 04 Oct 2005
Posts: 20

PostPosted: Sun Oct 16, 2005 7:27 pm   

Spells memorized, trouble getting value from a line.
 
I can't seem to get zmud to get the number from this line.

1: ( 2)cure light
1: ( %d)cure light

? I've tried a couple things but I'm not understanding.. I think I need to say there are special characters.. any thoughts.
Reply with quote
cxs410
Beginner


Joined: 04 Oct 2005
Posts: 20

PostPosted: Sun Oct 16, 2005 7:39 pm   
 
^1: ~( (%d)~)cure light

solved it ;)
Reply with quote
cxs410
Beginner


Joined: 04 Oct 2005
Posts: 20

PostPosted: Sun Oct 16, 2005 7:47 pm   
 
err.. maybe not.. i don't this is working.. please advise..
Reply with quote
alaric
Novice


Joined: 13 Aug 2005
Posts: 32
Location: Cherry Point, NC

PostPosted: Sun Oct 16, 2005 8:05 pm   
 
first thought on my end would be something like thise

^%d: ~((%d)~) (%w) (%w)

value would be something like this....

spellnumber=%1
spell=%2 %3
Reply with quote
cxs410
Beginner


Joined: 04 Oct 2005
Posts: 20

PostPosted: Sun Oct 16, 2005 8:13 pm   
 
well, 1: is static and so is cure light, there is also a space between the ( 2) i think tha tis causing the problem
Reply with quote
alaric
Novice


Joined: 13 Aug 2005
Posts: 32
Location: Cherry Point, NC

PostPosted: Sun Oct 16, 2005 8:27 pm   
 
you could try throwing in a %s, though I would tend to think the space would take care of that without needing the %s
Reply with quote
cxs410
Beginner


Joined: 04 Oct 2005
Posts: 20

PostPosted: Sun Oct 16, 2005 8:35 pm   
 
no.. *sigh*
Code:
[Spells Memorized]
 1: ( 7)cure light         
 2: ( 3)cure serious       
 3: ( 5)cure critic         ( 1)aid                 
 4: ( 3)holy armor     
That is a more exact list of what I'm trying to capture. Basically I am trying to capture the number of spells that are memorized. The # in ( ) is the number that can be cast.

Edit Vijilante: added code tags so formatting could be seen.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sun Oct 16, 2005 11:03 pm   
 
I am going to assume a blank line indicates the end of the list.
Code:
#CLASS SpellCapture
#VARIABLE SpellCapTemp {} {}
#VARIABLE MemorizedSpells {}
#TRIGGER "SpellCap" {^~[Spells Memorized~]$} {SpellCapTemp="";MemorizedSpells=""}
#COND {} {#IF (%line="") {#STATE SpellCap 3;#SET SpellCap 3 1} {SpellCapTemp=%concat(@SpellCapTemp,%subchar(%line,"()","!"),"`")}} {looplines|param=10}
#COND {*} {#STATE SpellCap 0;#ECHO Error in SpellCap: Exceeded 10 lines}
#COND {} {MemorizedSpells.Pos=%match(@SpellCapTemp,"!(&2)(*){`|!}",MemorizedSpell.Number,MemorizedSpells.Name,MemorizedSpells.Len);#WHILE (@MemorizedSpells.Pos) {#ADDKEY MemorizedSpell {%trim(@MemorizedSpells.Name)} {%trim(@MemorizedSpells.Number)};SpellCapTemp=%delete(@SpellCapTemp,@MemorizedSpells.Pos,@MemorizedSpells.Len);MemorizedSpells.Pos=%match(@SpellCapTemp,"!(&2)(*){`|!}",MemorizedSpell.Number,MemorizedSpells.Name,MemorizedSpells.Len)};#DELKEY MemorizedSpells.Name;#DELKEY MemorizedSpells.Number;#DELKEY MemorizedSpells.Pos;#DELKEY MemorizedSpells.Len}
#CLASS 0
That should do it, but it is written off the top of my head and may be missing something. I should just put that disclaimer in my signature.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
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