dim3 Forum

Full Version: auto scripter
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6
Is there an auto scripter out there that can easily create simple scripts for dim3?
No. Learn how to do it yourself.
Sorry but do you REALLY need that??
Just learn to script. It's fun! Smile

Code:
some basics:
//THIS IS A COMMENT
function foo123(APIs to load) //THIS IS A FUNCTION
{
//code here
}

foo123(APIs to load); //goes to function foo123

if (condition) {
Do This
}
Example:
var a;//makes a variable called a
a=1;//makes a=1
if (a==1) { //if a=1 then do the following until the closing bracker
//API and other code goes here
} //closing bracket

You can also do
if (a==1) {
//code
} else{ //If a does NOT = 1 then
//code
}//closing bracket

Theres lots of other things you can do, but those are the basics.

API are like built in functions. You can find them in the documentation.
Example of API:
Code:
obj.motionVector.turnToPlayer(); //note the capitalazation, this automatically makes the object keep turning towards the player.
so is there a list of commands and what they do?
Yes!!
Smile
Thats the documentation, open the dim3 folder<documentation<index.html. Just open the index.html with a web browser and there they are Wink.
so events are the main basis for scripting?
Think of it this way: Nothing can happen without events. Events are occurrances. In the event of an evacuation, run for your life screaming. In the event of a fire, kill people. Yah? For every event in the docs you can execute a function, custom or one in the api, set vars, unset vars, etc.
thats what I thought
so if I said
Code:
function blah(x)
{
}
then I could use the inputed value of x in my function?
Well, not exactly. function blah(x) loads API x Wink.
If you want to use a value, use a variable.
Code:
var foo; //new variable called foo
foo=5; //set foo to 5

//OR, to make it simpler:
var foo=5; //make variable foo and set it to 5

if (foo==3) {
//do something
}
//(if foo = 3 do something)

foo='lol'; //variables can also be set to strings (text)
foo=true; //or booleans (true/false)
Pages: 1 2 3 4 5 6
Reference URL's