|
easal Novice
Joined: 21 Jun 2005 Posts: 38
|
Posted: Sun Jul 23, 2006 3:12 pm
Help/advice for a nearly finished item. |
Alright, basically in Imperian there are things called circles. I'll just give the help file so you know what I'm talking about.
Code: |
Runelore - Circle
Usage: SKETCH <circle> ON GROUND
SKETCH <rune> IN CIRCLE
SKETCH <rune> IN CIRCLE AND SEAL
Circles are a way to create powerful combination of rune to a variety of
effects.
To being, once must sketch a rune circle on the ground. Once complete, the
crafter can add any number of runes to the circle. It has been determined that
3 runes create the most predictable results.
The final rune will seal the rune circle. Once sealed, the power of the runes
are instantly released, effecting all enemies of the player in the room, with
the sealing rune firing first.
In addition, several powerful combinations have been discovered to have
additional effects.
The following circles are known, but others exist:
Wall : Inguz, Algiz, and Gular.
Anti-Health : Uruz, Sowulu, and Berkana.
Anti-Mana : Pithakhan, Sowulu, and Berkana.
Slow Balance : Fehu, Nauthiz, and Sleizak.
Spying : Berkana, Wunjo, and Mannaz.
Canopy : Gebu, Hulgaz, and Gular.
Anti-Rites : Lagua, Eihwaz, and Kena.
Surge Reversal: Jera, Sleizak, and Hugalaz.
Anti-Hunger : Jera, Uruz, and Nauthiz.
Vortex : Kena, Raido, and Nairat.
The runes must be placed in this order, or their special effects will not be
felt.
|
Since it involves four balances, they're quite prone to unneccary delays from finding the right macros to push, typing etc so I wanted to come up with a semi-automatic system for them.
Here's what I came up with. basically what I'm looking for is advice on how to make it neater, if possible and a little idea of just how far I can push the "doing stuff on balance" boat out. There is a lot of things I could do in a similar manner, from basic attacking as soon as I get balance, to sending a variable change while off balance that would result in a weapon change as soon as I got balance. It's all pretty easy stuff I'm finding, though it took me a bit of wracking to get my head around the basics. Just wondering if all the nested #ifs would create performance issues.
To give you an idea, the charecter has ... 5+ sets of weapons, several attacks and responses for each, etc etc. so the #if could get pretty big.
Code: |
#CLASS {Circles}
#ALIAS wall {sketch circle on ground;#var circle1 1;#var rune1 inguz;#var rune2 algiz;#var rune3 gular}
#ALIAS vortex {sketch circle on ground;#var circle1 1;#var rune1 kena;#var rune2 raido;#var rune3 nairat}
#ALIAS hunger {sketch circle on ground;#var circle1 1;#var rune1 jera;#var rune2 uruz;#var rune3 nauthiz}
#ALIAS surge {sketch circle on ground;#var circle1 1;#var rune1 jera;#var rune2 sleizak;#var rune3 hugalaz}
#ALIAS rites {sketch circle on ground;#var circle1 1;#var rune1 lagua;#var rune2 eihwaz;#var rune3 kena}
#ALIAS canopy {sketch circle on ground;#var circle1 1;#var rune1 gebu;#var rune2 hugalaz;#var rune3 gular}
#ALIAS spying {sketch circle on ground;#var circle1 1;#var rune1 berkana;#var rune2 wunjo;#var rune3 mannaz}
#ALIAS balance {sketch circle on ground;#var circle1 1;#var rune1 fehu;#var rune2 nauthiz;#var rune3 sleizak}
#ALIAS mana {sketch circle on ground;#var circle1 1;#var rune1 pithakhan;#var rune2 sowulu;#var rune3 berkana}
#ALIAS health {sketch circle on ground;#var circle1 1;#var rune1 uruz;#var rune2 sowulu;#var rune3 berkana}
#VAR circle1 {0} {0}
#VAR circle2 {0} {0}
#VAR circle3 {0} {0}
#VAR rune1 {gebu}
#VAR rune2 {hugalaz}
#VAR rune3 {gular}
#TRIGGER {^You are balanced.$} {#if (@circle1) {sketch @rune1 in circle;#va circle1 0;#va circle2 1;} {#if (@circle2) {sketch @rune2 in circle;#va circle2 0;#va circle3 1} {#if (@circle3) {sketch @rune3 in circle and seal;#va circle3 0} {The script is working}}}}
#CLASS 0
|
Thanks a bunch for anything you can offer. You guys have always been verra helpful! |
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Sun Jul 23, 2006 4:21 pm |
The script looks ok. There nested ifs shouldn't be too much of a problem, as zMUD should be able to quickly determine if the condition is not met and go to the next if. If you want code that is a bit cleaner, though, you could use #CASE. Its performance shouldn't be too different from the nested ifs, but the code will look better.
For #CASE, you would only need one variable to keep track of the point in the sequence that you are in. For example, just a variable named @circle that would contain a 1 when the first rune is to be sketched, a 2 for the second rune and a 3 for the final rune. This variable is then used as the first parameter to #CASE that tells it which of the commands to execute, and the actual commands of the #CASE would be the current commands of each of the nested ifs. |
|
_________________ Kjata
Last edited by Kjata on Mon Jul 24, 2006 2:21 am; edited 1 time in total |
|
|
|
easal Novice
Joined: 21 Jun 2005 Posts: 38
|
Posted: Sun Jul 23, 2006 5:15 pm |
Thanks Kjata, I was fairly sure I could use a load of nested ifs safely, it's good to be sure though. I'll fiddle about with #case tonight. Even if I leave it as it is, it's good to learn new things!
|
|
|
|
edb6377 Magician
Joined: 29 Nov 2005 Posts: 482
|
Posted: Sun Jul 23, 2006 8:34 pm |
personally i would have done this with database variables of sorts i.e.
Code: |
VARIABLE: Combos
Key - value
Wall - inguz+algiz+gular
Anti-Health - Uruz+Sowulu+Berkana
Anti-Mana - Pithakhan+Sowulu+Berkana
Slow Balance - Fehu+Nauthiz+Sleizak
Spying - Berkana+Wunjo+Mannaz
Canopy - Gebu+Hulgaz+Gular
Anti-Rites - Lagua+Eihwaz+Kena
Surge Reversal - Jera+Sleizak+Hugalaz
Anti-Hunger - Jera+Uruz+Nauthiz
Vortex - Kena+Raido+Nairat
|
Just a different way to do it.
Would have had an alias draw or something
i.e
Draw wall
Code: |
#alias draw {
#IF (%1 = %null) {#ECHO "Please Enter the type of circle you would like to draw} {
#VAR circle 1
#VAR rune1 {%word(@combos.%1,1,"+")}
#VAR rune2 {%word(@combos.%1,2,"+")}
#VAR rune3 {%word(@combos.%1,3,"+")}
SKETCH %1 ON GROUND
}
}
#TRIGGER {^You are balanced.$} {
#CASE @circle {sketch @rune1 in circle;#VAR circle 2} {sketch @rune2 in circle;#Var circle 3} {sketch @rune3 in circle;#unvar circle}
}
|
I have no real output from your mud to see commands as you sketch runes but this is an idea of how it works and its dynamic so add a new circle to the combos variable and you can do draw XXXX and it will pick it up. |
|
_________________ Confucious say "Bugs in Programs need Hammer" |
|
|
|
easal Novice
Joined: 21 Jun 2005 Posts: 38
|
Posted: Mon Jul 31, 2006 7:40 pm |
Oooh! I like that too!
I especially like the null part. I can think of some other things I need something like that!
Going to fiddle around I guess.
Thanks again! |
|
|
|
|
|
|
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
|
|