|
Caled Sorcerer
Joined: 21 Oct 2000 Posts: 821 Location: Australia
|
Posted: Mon Feb 02, 2009 7:11 am
[2.37] 'Corrupted stack (1)' - error during function call |
Code: |
<func name="move" id="17">
<value>$movetype=%null
#IF (%null($movetype)) {~go $dir} {$movetype $dir}
#return</value>
<arglist>$dir</arglist>
</func>
|
This function was originally more complex, but I stripped it down trying to find the fault. It compiles successfully, but when I use
#call @move(e)
from the command line, a "Parse error" window appears, telling me there is "Corrupted stack (1)" and in the field below that, displays "#call @move(e)"
Does anyone know what I am doing wrong, here? |
|
_________________ Athlon 64 3200+
Win XP Pro x64 |
|
|
|
gamma_ray Magician
Joined: 17 Apr 2005 Posts: 496
|
Posted: Mon Feb 02, 2009 11:19 am |
This may be a bug or may just be lacking documentation. I don't think functions are supposed to send commands to the game quite like that. Presumably you had a reason for choosing a function over an alias, but it might be easier to just ask "how can I make this work as a alias" and outline everything you want it to do.
|
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Mon Feb 02, 2009 3:26 pm |
Functions can definitely return commands to the game like this, but you're suffering from this problem.
|
|
|
|
oldguy2 Wizard
Joined: 17 Jun 2006 Posts: 1201
|
Posted: Tue Feb 03, 2009 12:45 am |
What exactly are you trying to do with that function anyway? It makes no sense. $movetype is always going to be %null so the if else statement makes no sense. You don't need the return either if you aren't returning anything. I'm curious what you are trying to do. :-)
You could just do #send {go $dir}. |
|
|
|
Caled Sorcerer
Joined: 21 Oct 2000 Posts: 821 Location: Australia
|
Posted: Tue Feb 03, 2009 8:07 pm |
Thanks Fang.
Oh.. and Oldguy, I did say I stripped it down to find the exact faulty line.
In the full function, I don't set $movetype like that - its a second argument and is set by whichever key I hit before hitting the direction. INS for example, sets it to tumble.
I've had the script for years, but not using a function. I changed it a bit when I decided to change it to a function (everything always gets more complex >.>) |
|
_________________ Athlon 64 3200+
Win XP Pro x64 |
|
|
|
|
|