Spherical forums

Sphere Development => Sphere Support => Script Support => Topic started by: Jonadb on November 02, 2013, 03:38:59 am

Title: Error with tutorial
Post by: Jonadb on November 02, 2013, 03:38:59 am
I used all the scripts from this tutorial http://wiki.spheredev.org/Making_a_Menu and im having problems trying to open the menu, when i press the key escape it says that the name variable is not defined!
here, have a look
i leave my scripts over here so you can tell me if theres anything wrong. i don't know anything about programming just a very little tiny bit.
Title: Re: Error with tutorial
Post by: DaVince on November 02, 2013, 05:34:35 am
Just a note for the future: you can add attachments to your post in the full reply mode! Should save some trouble of having to go through Mega.

Also, why are they in txt file? Did you copy-paste over the content into a different text editor? There's no need for that - all your project files exist in Sphere/games/YourGameName/scripts/ so you can just directly zip that up! And even better: since the contents of your scripts are so short, you can use the [ code ] tag and paste them right into your posts. :)

Now, about your problem, I think it's here:

Code: [Select]
Menu.prototype.addItem(name, description, callback, color)

This calls addItem rather than defining addItem as a function, so it should be this:

Code: [Select]
Menu.prototype.addItem = function(name, description, callback, color)

So yeah, it's a mistake in the tutorial! Will edit that (even though it's not my tutorial).