Functions Fail After One Use, Succeed Upon Script Reload

Posted by Krizykronz on Fri 03 Dec 2004 05:15 PM — 3 posts, 14,228 views.

#0
When I execute a function via an alias in MUSHclient, it succeeds once, but chokes the second time. I am completey baffled.

Error number: -2146823286
Event: Execution of line 1 column 1
Description: Function expected
Line in error:
Called by: Immediate execution


Here's the code (no line numbers, since there were no line numbers in the error message):


var afk_message;
var afk;

function afk()
{
	afk = world.GetVariable("afk");

	if (afk == "true")
	{
		world.SetVariable("afk", "false");
		afk = world.GetVariable("afk");
	}
	else
	{
		world.SetVariable("afk", "true");
		afk = world.GetVariable("afk");
	}
	world.send("afk");
	world.note(afk);
}
#1
Hm, okay. Didn't realize that I couldn't have a function name that was the same as a variable name. I'm in Java mode. Hope a moderator deletes this topic soon. How embarrassing. :)
Australia Forum Administrator #2
You can delete your own posts you know, but I rather you didn't, since this may happen to someone else one day.