script objects are literally just things you can use to organize stuff
i mean, i might have a stuffty view of them, but think of them SLIGHTLY like pythons modules
like suppose you make a tcpObject called "socket"
tcpObject is a subclass of a script object, i think
then you just go socket.connect("bullstuffhere.com", 808080); or whatever the syntax is
compare to python, guess what
import socket
socket.connect("stuff here")
now imagine you make a
new scriptObject(bob)
{
name = "Bob";
age = "1613";
phone_number = "867-5309";
}; //note the trailing ;. you can omit the whole bracketed portion if you want, but leave the ;. like new ScriptObject(bob);
now you can do stuff like echo(bob.phone_number); and get "867-5309" back.
you can also define methods for use with bob
function bob::getPhoneNumber(%this)
{
return %this.phone_number;
}
echo(bob.getPhoneNumber());
867-5309
Do you see what's going on? %this is set to bob because we're calling it on bob.
suppose we had...
function person::getPhoneNumber(%this)
{
return %this.phone_number;
}
new ScriptObject("bob")
{
name = "bob";
class = "person";
phone_number = "867-5309";
}
echo(bob.getPhoneNumber());
867-5309
do you see the difference? that's how it works.
a recent add-on i made had a bunch of different stuff going down. build rotation, votes, ticks, shop, etc
i made one overarching object
new ScriptObject("superobject");
then, for any new functions, i could just do
function superobject::functionname(args)
and for any variables i needed to be persistent
superobject.variable = value;
this let me tie everything into one object, it didn't clutter the namespace (which is a real problem - suppose you have an object or variable named "socket" in python, then you import socket. what happens? ostuff happens.), plus it made me feel professional