Infinite loop

by Sylphas

Back to Mechanic's Corner.

Sylphas2005-04-18 02:32:14
#AL {t} {target = %1; #SA %crlf%ansi( cyan)"Targeting:" %ansi( cyan, hi)%proper( %1)}
#AL {aim} {#IF (%2) {t %2; #EXEC %1} {#EXEC %1}
#AL {seize} {aim "~seize @target" %1}

Everytime I try to seize someone, I get spammed by an infinite loop with my targetting. I get "Targetting: whoever" until zMUD gives up and dies.

EVERY other attack alias I have uses my aiming system, and they're never done this. Shove does the same thing. I can't see how it could loop; the attack calls aim, aim may or may not call t, and t nevers calls anything.

Before I forget the ~ in the alias, so it looped. Ok, I fixed that, but it STILL does it. Why?
Unknown2005-04-18 02:38:16
Uhh is it because your alias to actually seize the person is the same as the syntax to seize them ingame, meaning it just makes the alias go over and over and over again, hence the infinate loop. Change the client alias to seize2 or something but i could be wrong
Sylphas2005-04-18 02:41:53
That's what the ~ does, escapes that so it doesn't read as an alias. That's what was broken before, but I fixed that.
Daganev2005-04-18 02:45:43
I think its the way Seize reads the aim alias and the aim alias gets set off, however, I can't understand what aim does exactly and how its bieing implemented so I'm not sure.
Sylphas2005-04-18 02:48:12
Basically, if aim has a second parameter, it targets that, then sends the comman. If not, it just expands the target variable and sends the command through.
Lyridae2005-04-18 02:50:16
Try making

#AL {seize} {aim "~seize @target" %1}

into

#AL {seize} {aim "~seize @target}

...or maybe I'm stupid. blink.gif
Daganev2005-04-18 02:50:23
Seize appears to always have a second praramter....

I think he has the %1 so that if he targets Daganev, but types Sieze Daevos it won't accidently seize Daganev.
Sylphas2005-04-18 02:57:03
#AL {pc} {aim "point cudgel @target" %1}

t daganev
Targeting: Daganev
pc
point cudgel daganev

Nothing can be seen here by that name.
2609h, 3380m, 3044e, 10p, 10760en, 15800w ex-
pc
point cudgel daganev

You detect nothing here by that name.
2609h, 3380m, 3044e, 10p, 10760en, 15800w ex-
pc
point cudgel daganev

You detect nothing here by that name.
2609h, 3380m, 3044e, 10p, 10760en, 15800w ex-
pc daevos
Targeting: Daevos
point cudgel daevos

You detect nothing here by that name.
2609h, 3380m, 3044e, 10p, 10760en, 15800w ex-
Daganev2005-04-18 02:59:14
Ahah! ~ only makes the next charachter literal, not the next whole word...
Sylphas2005-04-18 04:07:09
#AL {twirl} {~twirl cudgel}
#AL {whirl} {~whirl cudgel}

twirl
twirl cudgel
You twirl your cudgel before you, bringing forth an emerald shield that
surrounds you.
2609h, 3231m, 3044e, 10p, 10760en, 15764w e-
You have recovered balance on all limbs.
2609h, 3231m, 3044e, 10p, 10760en, 15770w ex-
whirl
whirl cudgel
You whirl your cudgel by one end, sending emerald motes of light flying in all directions.
2609h, 3123m, 3044e, 10p, 10760en, 15746w e-
Drago2005-04-18 04:18:22
Hmm

In my test you don't need to put the ~ in front of the seize -if- you don't use #EXEC. In fact, there's no reason to use #EXEC there, because just sending %1 works.

Getting rid of the #EXEC makes it work without looping.

#AL {t} {target = %1; #SA %crlf%ansi( cyan)"Targeting:" %ansi( cyan, hi)%proper( %1)}
#AL {aim} {#IF (%2) {t %2;%1} {%1}}
#AL {seize} {aim "seize @target" %1}


Edit: As for the why, #EXEC might strip ~ from "~seize @target" so it sends the alias again, which makes it execute again, etc, etc.
Sylphas2005-04-18 04:40:40
Hmm. Lemme try it. Although I still don't know what makes those two different then every other alias I've made.

Sure just sending it expands the variable?
Drago2005-04-18 04:51:00
100%, I tried it four times.
Sylphas2005-04-18 04:53:24
Bleh, I'll have to log in again. Doing it offline doesn't show it expanding.
Sylphas2005-04-18 04:55:16
Doesn't work for me. Sends @target instead of the variable.
Sylphas2005-04-18 06:48:02
Changing the alias name worked. #EXE apparently parses the whole string, then sends it, and strips the ~ as it goes. So it WOULD work, if the ~ managed to stay somehow. Much easier to just go with 'shv' and 'sz'
Unknown2005-04-18 19:36:11
A question not 100% related to your problem but still, what's the use of all this? Granted, I have a flu and my brain is wobbly but I don't quite get the use of aim.

Is this so you can target new people just by entering your attack alias with a name to specify and set a new target? (pc -> point at old target, pc -> target , point at new target?)

Also, I guess the problem might indeed be that the ~ gets stripped once "aim" is called, and you end up calling your alias "seize" again. Possible solution: add another ~ to escape the first ~ character.

:
QUOTE
Daganev:
Ahah! ~ only makes the next charachter literal, not the next whole word...


Aye, ~ is an escape character and escapes only the following character. One "layer" of these escape characters gets stripped every time something in your script tries to parse a string as code, like #EXEC.

: If you want to expand a variable, like @target here, you can also do <@target> in most circumstances, to get the value of the variable rather than the variable itself.
Sylphas2005-04-18 19:41:22
Hmm, never thought of the double escape, that might work. I'll test it when I get home.

But yeah, that's the point. Although I usually target before hand, this way I can switch on the fly without worrying about it.
Amaru2005-04-18 20:00:26
QUOTE(Sylphas @ Apr 18 2005, 03:32 AM)
#AL {t} {target = %1; #SA %crlf%ansi( cyan)"Targeting:" %ansi( cyan, hi)%proper( %1)}
#AL {aim} {#IF (%2) {t %2; #EXEC %1} {#EXEC %1}
#AL {seize} {aim "~seize @target" %1}

Everytime I try to seize someone, I get spammed by an infinite loop with my targetting.  I get "Targetting: whoever" until zMUD gives up and dies.

EVERY other attack alias I have uses my aiming system, and they're never done this.  Shove does the same thing.  I can't see how it could loop; the attack calls aim, aim may or may not call t, and t nevers calls anything.

Before I forget the ~ in the alias, so it looped.  Ok, I fixed that, but it STILL does it.  Why?
100906



The ""s make it ignore the ~.
Sylphas2005-04-18 20:04:25
doh.gif

Probably work fine if I used {}, wouldn't it?