Author Topic: Could i get some help with scripting  (Read 930 times)

I have been learning scripting but i'm still not very good at it. i need to learn for an app making course i'm taking this summer and so i can make add-ons. if anyone has any suggestions or would like to help m then please reply. i know i know look at script and i'll learn well that's what i've been doing for the past two months!

Also:
to other people learning scripting i found this great program that comes with unity and makes writing/reading code much easier. i can't upload it to media fire but you can go to the unity website and download unity. the program is called unitron and i color codes things and does indents for you which is nice.
« Last Edit: February 26, 2011, 06:19:27 PM by Hazmat »


Also:
to other people learning scripting i found this great program that comes with unity and makes writing/reading code much easier. i can't upload it to media fire but you can go to the unity website and download unity. the program is called unitron and i color codes things and does indents for you which is nice.
Notepad++

thanks for the tutorials
i was also just curios is there anyway to delay a code from executing like tell it to wait 1 second then echo?
« Last Edit: February 27, 2011, 03:34:27 AM by Hazmat »

thanks for the tutorials
i was also just curios is there anyway to delay a code from executing like tell it to wait 1 second then echo?
yeppers.

Code: [Select]
schedule(1000, 0, "echo", "Hello, late world.");
Code: [Select]
schedule(time ms, 0, "command name", "argument 1", "argument 2");(I'm not quite sure what the 0 is for. It doesn't appear in official Torque documentation but it is needed in Blockland's version of Torque.)

If you're scheduling an object's function,
Code: [Select]
%obj.schedule(1000, "delete");
Code: [Select]
%objectID.schedule(time ms, "command", "argument 1", "argument 2");

yeppers.

Code: [Select]
schedule(1000, 0, "echo", "Hello, late world.");
Code: [Select]
schedule(time ms, 0, "command name", "argument 1", "argument 2");(I'm not quite sure what the 0 is for. It doesn't appear in official Torque documentation but it is needed in Blockland's version of Torque.)

If you're scheduling an object's function,
Code: [Select]
%obj.schedule(1000, "delete");
Code: [Select]
%objectID.schedule(time ms, "command", "argument 1", "argument 2");
thanks but is that in miliseconds or seconds
« Last Edit: February 27, 2011, 11:24:50 AM by Hazmat »

It specifically states "time ms"

sorry i didn't read past the first one.

if someone could give me a list of functions like how to generate a random number or other stuff that would be great. but i guess those aren't functions really, but i don't know what to call them

Those are functions.
As for random numbers, getRandom(min, max) returns a random number between min and max, or getRandom(max) returns a random number between 1 and max.

Also, you should check out the stickies in coding help.

Those are functions.
As for random numbers, getRandom(min, max) returns a random number between min and max, or getRandom(max) returns a random number between 1 and max.

Also, you should check out the stickies in coding help.
thanks

Code: [Select]
schedule(1000, 0, "echo", "Hello, late world.");
Code: [Select]
schedule(time ms, 0, "command name", "argument 1", "argument 2");(I'm not quite sure what the 0 is for. It doesn't appear in official Torque documentation but it is needed in Blockland's version of Torque.)
the 2nd argument is a "guard" that means "if the object is gone when the schedule happens, then dont bother"

So something like this:  schedule(<somevalue>, MissiongGroup, "function", "args");
Will do the schedule on time -- but if the MissionGroup (your map) goes away then dont bother (map change anybody?).  This is helpful when you arent able to do a cancel() on everything thats scheduled and you want to make sure your script cleans things up nicely.