Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
Caled
Sorcerer


Joined: 21 Oct 2000
Posts: 821
Location: Australia

PostPosted: 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
Reply with quote
gamma_ray
Magician


Joined: 17 Apr 2005
Posts: 496

PostPosted: 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.
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Mon Feb 02, 2009 3:26 pm   
 
Functions can definitely return commands to the game like this, but you're suffering from this problem.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: 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}.
Reply with quote
Caled
Sorcerer


Joined: 21 Oct 2000
Posts: 821
Location: Australia

PostPosted: 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
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
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

© 2009 Zugg Software. Hosted by Wolfpaw.net