For Sphere and/or JavaScript newbies: this tutorial is written for you guys! 8)
Here it is (http://wiki.spheredev.org/DaVince_scripting_tutorial).
I improved it. Well, most of it. I rewrote some sections and a bunch of sentences so it's hopefully more clear and accurate than before. I formatted some examples and other stuff.
Also, I got off my lazy ass and wrote the tutorial on objects (http://wiki.spheredev.org/DaVince_scripting_tutorial#Objects). I tried taking an approach where an example is followed. It only teaches the basics, but the basics should be good enough for this tutorial. Could anyone read through it and see if I haven't made any dumb mistakes (or suggest improvements)? Some stuff I should really, really add?
Its really neat and well organized 8)
Thanks, I know its a mini-bible of text to edit. I'm sure this will be of help to newbies, I know I learned a lot especially from the objects and variables which where more clear to see and understand.
That's good to know!
And I've working on trimming things so it's less Bible-like. It's still a lot of text. :P
One question though
this.unequip = function(what)
{
var theitem = all_equipment_ever[what]; //Get the item
var itemindex = this.equipment.indexOf(theitem); //Get the numerical position of the item in the array
this.equipment.splice(itemindex, 1); //Remove the item from the array
}
what is the 1 for?
this.equipment.splice(itemindex, 1); //Remove the item from the array
Good question! I didn't explain Array.splice at all, kind of on purpose, in order to make you look it up yourself. :P
It defines how many elements to remove in the array from the given index onward. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice
Thanks ;)