Coding Class Basics

Hi, I'm wondering if anyone can run me through class construction with NVGT. A simple class object with commented lines would be fantastic. Thanks in advance.

Okay, I think I figured it out. I will write up some code here and explain what I know.

class popper{ //Case sensitive declaration of a new class.
//Properties private to the class go here.
int pop = random(1.0,20.0);
popper() {//Class constructor. Pass variables between () to have them available during class initialization.
//Class initialization code goes here.
}
//Functions specific to the class go here.
void do_a_thing(){
speak("This is a thing. Your lucky number is "+this.pop+".");
}
}//Seals class.

Here is something to improve:

class popper{ //Case sensitive declaration of a new class.
	//Properties private to the class go here.
	int pop = random(1.0,20.0);
	private int test = random(1, 50); // Only this class can access this value, but you can make it available public via property accesser, see below.
	popper() {//Class constructor. Pass variables between () to have them available during class initialization. Also, the word this, is a special word to not confuse with class code and global code.
	//Class initialization code goes here.
	}
	// Class destructor
	~popper() { // parameters aren't allowed.
		// Class destruction code goes here.
	}
	// Starting with the word get_ is property accessers and must end with the word property.
	int get_luck_test() property {
		return random(1, 50); // Randomly return value
	}
	//Functions specific to the class go here.
	void do_a_thing(){
	speak("This is a thing. Your lucky number is "+this.pop+", and test luck number is " + this.luck_test + ".");
	}
}//Seals class.

// Note you can also declare global property accessers.
int get_something_randomized() property {
	return random(1, 100);
}
void main() {
	popper p;
	p.do_a_thing();
	alert("Global property", "Your global number is " + something_randomized);
}

Nice, some good stuff in here. Thanks.

Sure, here is a basic code snippet. Note I typed this quickly in NPP and therefore cannot confirm if it would work, but this is just to give you an idea.

class test { // Inicialicing class test
	private int tmp = 49; // an int only accessable from within the class.
	int tmp2 = 4; // An int accessable from everywhere.
void m(string x = "Alert!", int p = tmp) { // Function using several parametors customizeable or using default.
		alert(x,"You choose "+tmp);
	}
	int r(int min = 0, int max = 100) // Another function. Of course just for testing purposes since the used example makes no sense.
		return random(min,max);
	}
	void class()
		alert("Success","It works.");
	}
}
void main() { // Test case
	test tst; // Creating a new instance.
	alert("Random number","A random number is "+tst.r(0,70)+"!"); // Using the function r in taken instance tst.
	tst.tmp2 = 90; // Changing a value of the public int.
	tst.m();
	tst.class();
	exit();
}