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


Joined: 08 Apr 2004
Posts: 103
Location: USA

PostPosted: Fri Oct 10, 2008 8:59 pm   

#forall problem
 
Basically.. I've got a check for something on my game called "Illusions". IF it isn't there.. I do a forall to transfer the afflictions to an actual file to be healed.


H:100% M:100% E:95% W:99% B:93% XP:23% [csdb -b]
You cease to wield a shining steel longsword.
Your right arm snaps in two. - #ADDITEM pendafflictions "rightarmcrippled"
You cease to wield a tower shield.
Your left arm snaps in two. - #ADDITEM pendafflictions "leftarmcrippled"
You have recovered equilibrium.
reconstitute
wield tower
H:100% M:100% E:95% W:99% B:93% XP:23% [csdb eb]
As your right leg breaks, you fall to the ground in pain. - #ADDITEM pendafflictions "rightlegcrippled"
The crackling blue energy around your body disappears.
************** Kai Cripple Over! **************
You are afflicted with: leftlegcrippled, rightarmcrippled, leftarmcrippled - Line designed to tell me all the afflictions after this attack.
H:100% M:100% E:95% W:99% B:93% XP:23% [cspdb eb]

Basically, on my prompt, I do an illusion check.
Alias: illusioncheck
Pattern:
Code:

#if (@illusion = 1) {
  #VARIABLE pendafflictions %null
  #VARIABLE pendCures %null
  #say Discarding following elements: %expandlist( @pendafflictions, ", ")
  #say Discarding following cures: %expandlist( @pendCures, ", ")
  illusion = 0
  } {
  #FORALL @pendafflictions {#ADDITEM afflictions %i}
  #FORALL @pendCures {#ADDITEM Cures %i}
  #VARIABLE pendafflictions %null
  #VARIABLE pendCures %null
  }


Here's the problem.. I'm figuring somehow the rightlegcrippled gets added in AFTER the forall and gets deleted by the pendafflictions %null.. Any ideas how to fix this?
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Fri Oct 10, 2008 9:41 pm   
 
You could just trigger another illusion check for the line "The crackling blue energy around your body disappears." - you could also improve the system so that it won't attempt to detect illusions on the prompt if it knows an event is coming that it should check on instead (like if there's some message about the kai cripple starting you can trigger on) but that can be a risky approach because the system will become stuck if the message never arrives for some reason.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
ralgith
Sorcerer


Joined: 13 Jan 2006
Posts: 715

PostPosted: Sat Oct 11, 2008 2:57 pm   
 
You could also use a #while loop combined with %pop instead, its better nullifying the var.
This way, if there is anything that doesn't get healed it stays in the vars and you can just run the alias again.
This is a workaround while you implement a proper fix.

#while @pendafflictions {#additem afflictions %pop(@pendafflictions)}
#while @pendcures {#additem cures %pop(@pendafflictions)}
_________________
CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate
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