|
shaun.murray Magician
Joined: 23 Jul 2005 Posts: 334 Location: Chicago
|
Posted: Thu Dec 17, 2009 8:14 pm
Need help with my alias |
This isn't exactly a repost, more of a "corrected" post. I keep getting a loop error, and unsure how to go about fixing it, and still having it work correctly. ANY feedback is greatly appreciated.
Here is the alias:
Code: |
<alias name="act" id="55">
<value>#if (@autoregen = 10) {#var autoregen 1};#if (@autoheal = 10) {#var autoheal 1}
healme;regenme;buffme
#LOCAL $temp $nextmob $break
#if (@bsleep = 1) {#if (@tick <= 4) {
sleep
#var bcombat 0
#var bsleep 10
}
}
#if (@act_lock = 0) {#IF (@hit_cur >= 1000) {
#loopdb @mob_list {
#IF ($break = 1) {#BREAK}
#if %val {#forall %dbkeys( @order_list) {#if (%db( @order_list, %i) = @tempcount) {#if (%i = %key) {
$nextmob = %key
#addkey mob_list %key %eval( %val - 1)
$break = 1
#break
} {
#IF (%db( @mob_list, %i) = 0) {tempcount = @tempcount + 1}
#BREAK
}}}}}
#IF $nextmob {
#IF (%db( @mob_list, $nextmob) = 0) {tempcount = @tempcount + 1}
#var bdetect 0
#var bmove 0
#var bcombat 1
#var act_lock 1
#send %concat( @attack, " ", $nextmob)
} {
#LOOPDB @mob_list {#IF (%val >= 1) {$temp = 1}}
#IF $temp {act} {#var bmove 1;move}
}
}
}</value>
</alias> |
Here are the variables:
Code: |
#var bsleep 2
#var tick 7
#var act_lock 0
#var hit_cur 32966
#var mob_list {Bloodfly=1|Slug=0|Dragonfly=0|Ochre=0|Spider=0|Pangolins=0|Murkdog=0|Bladderwort=0|Annelid=0|Catoblepas=0|Adder=0|Frog=0|Tree=0|Chisel|Light=0|Loon=0|Chimera=0|Cat=0}
#var order_list {dder=18|Annelid=17|Bladderwort=16|Bloodfly=15|Cat=14|Catoblepas=13|Chimera=11|Chisel=12|Dragonfly=10|Frog=9|Light=8|Loon=7|Murkdog=5|Ochre=6|Pangolins=4|Slug=3|Spider=2|Tree=1}
#var tempcount 12
#var attack {vici fist} |
Here are the called aliases:
Code: |
<alias name="healme" id="282">
<value>#if (@nocast = 0) {
$PossibleHeals = 0
$NeededHeals = 0
#if (@autoheal = 1) {
#if (@hit_cur <= @hit_min) {
#var autoheal 10
$NeededHeals = ((@hit_max - @hit_cur) / 903) - 3
$PossibleHeals = @spi_cur / 40
#loop %min( $NeededHeals, $PossibleHeals) {heal}
}
}
}</value>
</alias>
<alias name="regenme" id="266">
<value>#if (@nocast = 0) {$PossibleRegens = 0
$NeededRegens = 0
#if (@autoregen = 1) {
#if (@end_cur <= @end_min) {
#var autoregen 10
$NeededRegens = (@end_min - @end_cur) / 198
$PossibleRegens = @spi_cur / 10
#loop %min( $NeededRegens, $PossibleRegens ) { regen }
}
}
}</value>
</alias>
<alias name="buffme" id="261">
<value>#if (@autobuffrad = 1) {#if (@autorad = 1) {rad;#variable autorad 10}}
#if (@nocast = 0) {#if (@autobuffglobe = 1) {#if (@autoglobe = 1) {globe;#variable autoglobe 10}}}
#if (@autoannstance = 1) {#if (@stanceann = 1) {#if (@countAnnStance = 0) {#var bsleep -1;ann;#var autoannstance 10}}}
#if (@autohaostance = 1) {#if (@stancehao = 1) {#if (@countHaoStance = 0) {#var bsleep -1;hao;#var autohaostance 10}}}
#if (@autodragstance = 1) {#if (@stancedrag = 1) {#if (@countDragStance = 0) {#var bsleep -1;drag;#var autodragstance 10}}}
#if (@autosymmstance = 1) {#if (@stancesymm = 1) {#if (@countSymmStance = 0) {#var bsleep -1;symm;#var autosymmstance 10}}}
#if (@automantstance = 1) {#if (@stancemant = 1) {#if (@countMantStance = 0) {#var bsleep -1;mant;#var automantstance 10}}}</value>
</alias>
<alias name="move" id="57">
<value>#if (@bmove = 1) {#READ 1 @line
#var bcombat 0
#var bmove 10
#var tempcount 1
}</value>
</alias> |
|
|
|
|
rakasha681 Newbie
Joined: 08 Dec 2009 Posts: 9
|
Posted: Thu Dec 17, 2009 8:30 pm |
Take a look at this part for the act alias:
#LOOPDB @mob_list {#IF (%val >= 1) {$temp = 1}}
#IF $temp {act} {#var bmove 1;move}
the value of $temp gets set to 1, and then your IF statement basically says "if one equals one, then run act again" so that would create a nice big loop, since 1 always equals one. |
|
|
|
shaun.murray Magician
Joined: 23 Jul 2005 Posts: 334 Location: Chicago
|
Posted: Thu Dec 17, 2009 8:36 pm |
hmmm... then, by the time the alias gets to that point, the %val in the @mob_list db should all be zero'd right? so then, going along with that train of thought, i can just take out that reset, and just force it to launch the move alias, right?
|
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Thu Dec 17, 2009 9:23 pm |
I think I see an error in your definitions of @order_list. "dder" should probably be "Adder". If you have an error in that list, that might cause an odd loop.
|
|
|
|
shaun.murray Magician
Joined: 23 Jul 2005 Posts: 334 Location: Chicago
|
Posted: Thu Dec 17, 2009 9:29 pm |
That is just a copy/paste issue on my part. It does read "Adder" in the client.
|
|
|
|
shaun.murray Magician
Joined: 23 Jul 2005 Posts: 334 Location: Chicago
|
Posted: Thu Dec 17, 2009 11:34 pm |
So something odd..... I put in a check, that will echo something when the act alias is called within itself. My question then, is why is it being called within itself so randomly? At least, that is what it seems like to me. See log:
this is the check -- this is commands sent to the mud
Quote: |
Within the Kon-Taro [ exits: north east south west ]
A female Thari is here, holding an armful of berries.
A wolfen berzerker snarls angrily.
Golden eyes gleaming, [ 2 ] wolfen fighters watch you fiercely.
[Lag: 0] [Align: -626] [ 316572152 ] [Reply: ]
[H:32552/32967] [M:100/100] [S:7166/7166] [E:20558/21970]vici fis berserker
The power of your dextrous hands EVISCERATES (2054) a wolfen berzerker!!
You land [ 13 of 14 ] attacks on a wolfen berzerker: RUPTURING (499) damage!
[Lag: 4000] [Sheykh: (perfect condition)] [wolfen berzerker: (covered in blood)]
[h:32552/32967] [m:100/100] [s:7166/7166] [e:20516/21970]
A wolfen berzerker misses [ 8 ] attacks on you!
You land [ 7 of 7 ] attacks on a wolfen berzerker: DEHISCING (805) damage!!
A wolfen berzerker falls to the ground! He is dead!
You receive 1,812,793 (+226,263 learn, +93,029 rp) exp.
You get a pile of 79,644 gold.
[Lag: 1000] [Align: -626] [ 318750009 ] [Reply: ]
[H:32552/32967] [M:100/100] [S:7166/7166] [E:20516/21970]vici fis warrior
just called act from within act alias
The power of your dextrous hands EVISCERATES (2341) a wolfen warrior!!
You land [ 11 of 12 ] attacks on a wolfen warrior: RUPTURING (465) damage!
[Lag: 4000] [Sheykh: (perfect condition)] [wolfen warrior: (badly wounded)]
[h:32552/32967] [m:100/100] [s:7166/7166] [e:20474/21970]
A wolfen warrior misses [ 13 ] attacks on you!
You land [ 13 of 14 ] attacks on a wolfen warrior: MUTILATING (514) damage!!
[Lag: 3188] [Sheykh: (perfect condition)] [wolfen warrior: (mortally wounded)]
[h:32552/32967] [m:100/100] [s:7166/7166] [e:20474/21970]
A wolfen warrior misses [ 12 ] attacks on you!
You land [ 2 of 2 ] attacks on a wolfen warrior: CREMATING (1858) damage!!
A wolfen warrior falls to the ground! He is dead!
You receive 2,301,466 (+284,907 learn, +117,464 rp) exp.
You get a pile of 116,725 gold.
[Lag: 1000] [Align: -626] [ 321510438 ] [Reply: ]
[H:32552/32967] [M:100/100] [S:7166/7166] [E:20474/21970]vici fis warrior
The power of your dextrous hands CREMATES (1806) a wolfen warrior!!
You land [ 9 of 12 ] attacks on a wolfen warrior: MUTILATING (563) damage!!
[Lag: 4000] [Sheykh: (perfect condition)] [wolfen warrior: (severely wounded)]
[h:32552/32967] [m:100/100] [s:7166/7166] [e:20432/21970]
A wolfen warrior lands [ 1 of 11 ] attacks on you: wounding (48) damage.
You land [ 14 of 14 ] attacks on a wolfen warrior: RUPTURING (499) damage!
[Lag: 2985] [Sheykh: (perfect condition)] [wolfen warrior: (near death)]
[h:32504/32967] [m:100/100] [s:7166/7166] [e:20432/21970]
A wolfen warrior brings forth the warring shield gambit.
[Lag: 2781] [Sheykh: (perfect condition)] [wolfen warrior: (near death)]
[h:32504/32967] [m:100/100] [s:7166/7166] [e:20432/21970]
A wolfen warrior misses [ 11 ] attacks on you!
You land [ 6 of 7 ] attacks on a wolfen warrior: DEHISCING (969) damage!!
A wolfen warrior falls to the ground! He is dead!
You receive 2,635,000 (+324,939 learn, +134,144 rp) exp.
You get a pile of 142,912 gold.
[Lag: 500] [Align: -626] [ 324669617 ] [Reply: ]
[H:32504/32967] [M:100/100] [S:7166/7166] [E:20432/21970]vici fis female
just called act from within act alias
just called act from within act alias
just called act from within act alias
The power of your dextrous hands EVISCERATES (2121) a Thari gatherer!!
You land [ 11 of 11 ] attacks on a Thari gatherer: MUTILATING (702) damage!!
A Thari gatherer falls to the ground! She is dead!
You receive 881,231 (+114,483 learn, +46,454 rp) exp.
You get a pile of 61,056 gold.
[Lag: 1000] [Align: -626] [ 325739477 ] [Reply: ]
[H:32504/32967] [M:100/100] [S:7166/7166] [E:20390/21970]south
Within the Kon-Taro [ exits: north east south west ]
This shadow ape stares at you with blood red eyes.
[Lag: 0] [Align: -626] [ 325739477 ] [Reply: ]
[H:32504/32967] [M:100/100] [S:7166/7166] [E:20389/21970]vici fis ape
just called act from within act alias
just called act from within act alias
The power of your dextrous hands EVISCERATES (2234) a shadow ape!!
You land [ 12 of 13 ] attacks on a shadow ape: MUTILATING (509) damage!!
[Lag: 4000] [Sheykh: (perfect condition)] [shadow ape: (bleeding freely)]
[h:32504/32967] [m:100/100] [s:7166/7166] [e:20347/21970]
A shadow ape misses [ 8 ] attacks on you!
You land [ 9 of 9 ] attacks on a shadow ape: MUTILATING (686) damage!!
A shadow ape falls to the ground! He is dead!
You receive 1,860,709 (+232,023 learn, +95,429 rp) exp.
You get a pile of 75,528 gold.
[Lag: 1000] [Align: -626] [ 327974906 ] [Reply: ]
[H:32504/32967] [M:100/100] [S:7166/7166] [E:20347/21970]south
|
|
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Fri Dec 18, 2009 5:43 pm |
I think your code is overly complex and isn't doing what you actually wanted. I will step through the whole process. Let us assume the following values exist:
Code: |
mob_list = {A=0|B=0|C=1}
order_list = {A=1|B=2|C=3} |
So, the act alias starts, and reaches "#loopdb @mob_list {". It will loop until if finds C=1. It starts "#forall %dbkeys(@order_list)".
In the first forall loop, it hits "#if (%db( @order_list, %i) = @tempcount)". Since @tempcount presumably started at 1, it matches A=1 in @order_list.
So it checks "{#if (%i = %key)". Since A != C, this test fails, and we go to the failure condition:
Code: |
#IF (%db( @mob_list, %i) = 0) {tempcount = @tempcount + 1}
#BREAK
|
This will cause @tempcount to increment to 2, then break out of the forall loop.
It goes back to the loopdb, but the loopdb has just finished going through all the keys in mob_list!
It continues to the next line, "#IF $nextmob {". Since the loopdb never set $nextmob, this fails, and we go to the failure condition:
Code: |
#LOOPDB @mob_list {#IF (%val >= 1) {$temp = 1}}
#IF $temp {act} {#var bmove 1;move}
|
Since C=1 in @mob_list, $temp will be set to 1, and a new 'act' will occur. This new 'act' starts with @tempcount=2.
Note that the first 'act' does not finish until the last one does!!
Your routine will keep spawning new 'act' aliases until @tempcount finally reaches the right mob.
If @mob_list gets too long, you will eventually reach the limit for recursion, and get an error.
I believe you need to rethink this whole procedure. You have it more complex than you need, and that complexity is hiding your logical errors. |
|
|
|
shaun.murray Magician
Joined: 23 Jul 2005 Posts: 334 Location: Chicago
|
Posted: Fri Dec 18, 2009 10:19 pm |
you are totally right. and i started today, decrypting, and redo'n that whole thing. in fact, i'm redo'n my whole core. figured now is a good time. lol here is what i have as so far.
Code: |
<alias name="script_act" id="1508">
<value>#if (@script_act_lock) {#if (@script_detect) {#window debugwindow ~[ALIAS~] script_act
#local $break $mobnumber $mobname
#loopdb @script_mob_list {#if (%val) {#var $mobnumber %val;#var $mobname %key;#addkey script_mob_list %key %eval( %val - 1);#break};#if (%db( @script_mob_list, %i) = 0) {#window debugwindow ~[ALIAS~] script_move}}
#if ($mobnumber) {#send %concat( vic, " ", $mobnumber, ".", $mobname)} {#window debugwindow ~[ALIAS~] script_move;#var script_act_lock 0;#var script_move 1;script_move}}} {#if (@script_move) {script_move}}</value>
</alias> |
its very basic right now, but as so far, its working fine. =] |
|
|
|
|
|
|
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
|
|