sábado, 28 de septiembre de 2013

Custom Variables, Key binds,If Statements, and Mouse Control

Custom Variables, Key binds,If Statements, and Mouse Control

Postby niffirg1 » Fri Sep 04, 2009 3:23 am
Custom Variables
Brief Explaination 
A variable is something that holds a value, alphanumeric in general, used to store information, and vital in programming languages (otherwise your programming language wouldn't work very well, or would have to use another to help). (Gradfitz Explanation)
Creating a Variable 
1. First open up the console by pressing ~ or the tilde key 
2.Type in Scene.my.Var = 0
3.0 is the value of which the variable is set to 
4.Doesnt have to scene.my.var, Can be scene.my.hasdfl. Can be anything as long as it is scene.my.
5.Use that Variable to do any thing (Not Literally of course)
6. Use it to Control MotorSpeed, Spring length, counters, etc.
Here is a Video Tutorial on Custom Variable and Key binding

[youtube]UQBBse72DAY[/youtube]
If Statements
Explaination
An if statement is if this happens than this will happen as a result
Creating an If statement
1.Create a Fast colliding Object like a probe 
2.Type {scene.my.var == 10} ? {scene.my.hasdfl = 129} : {} in the oncollide menu of the Probe
3.This Says that is Scene.my.var gets to the value ten then as a result scene.my.hasdfl is set equal to the value 129
4. Use this in what ever way you want 
Mouse Control
Mouse Controlled Hinge
Mouse Control can be helpful in many ways. Like Video Games
Creating a Mouse Controlled Hinge
1.Go into the Console and type scene.my.pos = [0,0] and hit enter 
2.Create a Probe or fast colliding object 
3.In the oncollide of that probe type scene.my.pos = e.pos
4.Create a simple Car and put the Probe on the car 
5.In the script menu of the Car hinges type in th motorspeed space -{app.mousepos(0) - scene.my.pos(0)}
6. The car will now Follow the Mouse
Last edited by niffirg1 on Mon Sep 07, 2009 4:46 am, edited 4 times in total.
User avatar
niffirg1
 
Posts: 376
Joined: Mon Aug 31, 2009 10:31 pm
Location: The Great American South!

No hay comentarios:

Publicar un comentario