|
Death Apprentice
Joined: 25 Jun 2002 Posts: 109 Location: USA
|
Posted: Fri Oct 18, 2002 1:47 am
can zmud do a do-while loop? |
I can't exactly access the help files or I'd look. But does anyone know if zmud can process do-while loops for triggers/variables/etc.?
Thanks,
Death |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Fri Oct 18, 2002 2:11 am |
Yes. #WHILE
LightBulb
Senior Member |
|
|
|
Death Apprentice
Joined: 25 Jun 2002 Posts: 109 Location: USA
|
Posted: Fri Oct 18, 2002 2:17 am |
Do you think you could give a small example and syntex? If not, that's cool too...thanks for the info so far...I'll be playing around with it I guess.
-Death
ps. can't access help because it uses java runtime or something. i've messed that up on my computer...just have to get a cd and i can fix it...= |
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Fri Oct 18, 2002 2:36 am |
The online help on the website or the one that comes with zMUD?
Anyway, #WHILE takes the form of:
#WHILE (condition) {commands}
Example:
#VAR number 1
#WHILE (@number < 10) {#SH The number is @number;#ADD number 1}
Kjata |
|
|
|
Death Apprentice
Joined: 25 Jun 2002 Posts: 109 Location: USA
|
Posted: Fri Oct 18, 2002 2:48 am |
Would the following work?...
#VAR bless_success {You feel righteous.)
#VAR message {}
#TRIGGER {You Failed.} {#VAR message {Failed}
#TRIGGER {You lost your concentration.} {#VAR message {Failed}
#WHILE (@message != @bless_success) {cast bless}
-Death |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Fri Oct 18, 2002 5:56 am |
You'd need another trigger, since neither of the ones you have changes @message to the value of @bless-success
#TR {You feel righteous} {#VAR message {You feel righteous.}}
I don't recommend this though. zMUD is very fast and I'm sure if you try this you'll end up getting a spam disconnect. A better approach is to use the triggers to recast the spell:
#TRIGGER {You Failed.} {cast bless}
#TRIGGER {You lost your concentration.} {cast bless}
You can replace bless with a variable, such as @spell, to make a more generic script.
LightBulb
Senior Member |
|
|
|
Death Apprentice
Joined: 25 Jun 2002 Posts: 109 Location: USA
|
Posted: Fri Oct 18, 2002 2:07 pm |
But what if multiple spells go at once. how will it know which ones to recast if failed? When I get home, I'll paste up what I got so far if you'd like to see where I'm coming from on some things.
-Death |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Fri Oct 18, 2002 5:31 pm |
If you insist on screwing up your scripts by deliberately casting lots of spells at the same time so it won't be able to keep track of which one to recast, it probably won't work.
LightBulb
Senior Member
P.S Sorry, I only just realized you meant if you had several spells run out at the same time and various triggers trying to recast them all. |
|
|
|
Death Apprentice
Joined: 25 Jun 2002 Posts: 109 Location: USA
|
Posted: Sat Oct 19, 2002 4:31 am |
Ok, here is what I've thought of myself...feel free to mock me :)
It's like my first script I've ever written..I know it's not totally complete...but yea...i'm kinda running out of ideas...hehe...any ideas or changes would be beneficial.
CLASS {Spell Bot}
#SAY Welcome to Sacrifice's Spell Bot
#SAY Installing...
#CLASS 0
#CLASS {Spell Bot|Variables}
#VAR armor {on}
#VAR shield {on}
#VAR stone {on}
#VAR frenzy {on}
#VAR bless {on}
#VAR haste {on}
#VAR giant {on}
#VAR vise {on}
#VAR sanc {on}
#VAR pass {on}
#VAR infra {on}
#VAR fly {on}
#VAR bless_success {"You feel righteous.")
#VAR armor_success {"You feel someone protecting you."}
#VAR shield_success {"You are surrounded by a force shield."}
#VAR stone_success {"Your skin turns to stone."}
#VAR frenzy_success {"You are filled with holy wrath!"}
#VAR haste_success {"You feel yourself moving more quickly."}
#VAR giant_success {"Your muscles surge with heightened power!"}
#VAR vise_success {"You couldn't be disarmed by the biggest of giants!"}
#VAR sanc_success {"You couldn't be disarmed by the biggest of giants!"}
#VAR pass_success {"You turn translucent."}
#VAR infra_success {"Your eyes glow red."}
#VAR fly_success {"Your feet rise off the ground."}
#VAR message {}
#CLASS 0
#CLASS {Spell Bot|Triggers}
#TRIGGER {You Failed.} {#VAR message {"Failed"}
#TRIGGER {You lost your concentration.} {#VAR message {"Failed"}
#TRIGGER {You feel less righteous.} {@bless = "off";#WHILE (@message != @bless_success) {#WAIT 5000;cast bless}}
#TRIGGER {Your rage ebbs.} {@frenzy = "off";#WHILE (@message != @frenzy_success) {#WAIT 5000;cast frenzy}}
#TRIGGER {You feel weaker.} {@giant = "off";#WHILE (@message != @giant_success) {#WAIT 5000;cast giant}}
#TRIGGER {You feel yourself slow down.} {@haste = "off";#WHILE (@message != @haste_success) {#WAIT 5000;cast haste}}
#TRIGGER {You slowly float to the ground.} {@fly = "off";#WHILE (@message != @fly_success) {#WAIT 5000;cast fly}}
#TRIGGER {You feel less armored.} {@armor = "off";#WHILE (@message != @armor_success) {#WAIT 5000;cast armor}}
#TRIGGER {Your force shield shimmers then fades away.} {@shield = "off";#WHILE (@message != @shield_success) {#WAIT 5000;cast shield}}
#TRIGGER {You no longer see in the dark.} {@infra = "off"#WHILE (@message != @infra_success) {#WAIT 5000;cast infra}}
#TRIGGER {Your hands relax as your grip weakens.} {@vise" = off";#WHILE (@message != @vise_success) {#WAIT 5000;cast vise}}
#TRIGGER {The white aura around your body fades.} {@sanc = "off";#WHILE (@message != @sanc_success) {#WAIT 5000;cast sanc}}
#TRIGGER {Your skin feels soft again.} {@stone = "off";#WHILE (@message != @stone_success) {#WAIT 5000;cast stone}}
#TRIGGER {You feel solid again.} {@pass = "off";#WHILE (@message != @pass_success) {#WAIT 5000;cast pass}}
#TRIGGER {You feel someone protecting you.} {@armor = "on"}
#TRIGGER {You are surrounded by a force shield.} {@shield = "on"}
#TRIGGER {Your muscles surge with heightened power!} {@giant = "on"}
#TRIGGER {You feel yourself moving more quickly.} {@haste = "on"}
#TRIGGER {You are filled with holy wrath!} {@frenzy = "on"}
#TRIGGER {You feel righteous.} {@bless = "on"}
#TRIGGER {Your eyes glow red.} {@infra = "on"}
#TRIGGER {Your feet rise off the ground.} {@fly = "on"}
#TRIGGER {You turn translucent.} {@pass = "on"}
#TRIGGER {You are surrounded by a white aura.} {@sanc = "on"}
#TRIGGER {You couldn't be disarmed by the biggest of giants!} {@vise = "on"}
#TRIGGER {Your skin turns to stone.} {@stone = "on"}
#SAY Done.
#CLASS 0 |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Sat Oct 19, 2002 7:38 am |
Well, #WAIT 5000 should slow the loops enough, although we generally recommend against using #WAIT in version 6.16. I'm not sure what will happen when you have several different spells running their #WHILE loops simultaneously, it's an interesting approach.
I'd probably do something like this:
#VAR SpellList %null
#VAR cast 1 1
#VAR bless {on}
#VAR armor {on}
#VAR shield {on}
#CLASS {Spell Bot|Triggers}
#TRIGGER {You Failed.} {cast %item(@SpellList, 1)}
#TRIGGER {You lost your concentration.} {cast %item(@SpellList, 1)}
#TRIGGER {You feel less righteous.} {#VAR bless {off};#ADDITEM SpellList bless;#IF (@cast) {#VAR cast 0;cast %item(@SpellList, 1)}}
#TRIGGER {You feel less armored.} {#VAR armor {off};#ADDITEM SpellList armor;#IF (@cast) {#VAR cast 0;cast %item(@SpellList, 1)}}
#TRIGGER {Your force shield shimmers then fades away.} {#VAR shield {off};#ADDITEM SpellList shield;#IF (@cast) {#VAR cast 0;cast %item(@SpellList, 1)}}
#TRIGGER {You feel righteous.} {#VAR bless {on};#DELITEM SpellList bless;#IF (%numitems(@SpellList)) {cast %item(@SpellList, 1)} {#VAR cast 1}}
#TRIGGER {You feel someone protecting you.} {#VAR armor {on};#DELITEM SpellList armor;#IF (%numitems(@SpellList)) {cast %item(@SpellList, 1)} {#VAR cast 1}}
#TRIGGER {You are surrounded by a force shield.} {#VAR shield {on};#DELITEM SpellList shield;#IF (%numitems(@SpellList)) {cast %item(@SpellList, 1)} {#VAR cast 1}}
#CLASS 0
I only did 3 spells, if you like the approach you should be able to finish the list. @cast is a control variable which makes sure only one spell gets cast at a time. @SpellList is a list variable, each spell is added to it as the spell expires and removed once it is succesfully cast.
LightBulb
Senior Member |
|
|
|
|
|