|
Dyron Apprentice
Joined: 08 Apr 2004 Posts: 103 Location: USA
|
Posted: 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? |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: 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.
|
|
|
|
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: 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 |
|
|
|
|
|