Custom Variables, Key binds,If Statements, and Mouse Control
13 posts • Page 1 of 1
Custom Variables, Key binds,If Statements, and Mouse Control
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
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.
-
niffirg1 - Posts: 376
- Joined: Mon Aug 31, 2009 10:31 pm
- Location: The Great American South!
Re: Custom Variables, Key binds,If Statements, and Mouse Control
thanks niffrig i understood variables before but not mouse control made the car
- thebeech
- Posts: 241
- Joined: Mon Aug 31, 2009 8:32 pm
- Location: Your Hardrive
Re: Custom Variables, Key binds,If Statements, and Mouse Control
You didn't type anything about key binding.
-
Laraso - Posts: 241
- Joined: Tue Sep 01, 2009 12:54 am
- Location: What are you, a stalker?
Re: Custom Variables, Key binds,If Statements, and Mouse Control
Laraso wrote:You didn't type anything about key binding.
It was in the Video also for a written tutorial check this link http://www.phunland.com/forum/viewtopic.php?id=8778
-
niffirg1 - Posts: 376
- Joined: Mon Aug 31, 2009 10:31 pm
- Location: The Great American South!
Re: Custom Variables, Key binds,If Statements, and Mouse Control
yes, but that only makes a set point in withch the farther away from the spot, the faster the hinges, how do you make it stop at your mouse?
Thymer... Sorta :/
Like my avatar? Google it: gif it's pretty cool, just get the original sorce and put it for the URL of a pic like this:
http://www.imitationpickles.org/galcon/ ... /zarah.gif
neeed more help? Pm me :^)
My site/forum:
http://way2crazy.iforums.us/
^a ninja was here
Like my avatar? Google it: gif it's pretty cool, just get the original sorce and put it for the URL of a pic like this:
http://www.imitationpickles.org/galcon/ ... /zarah.gif
neeed more help? Pm me :^)
My site/forum:
http://way2crazy.iforums.us/
^a ninja was here
-
Way2crazy - Posts: 20
- Joined: Mon Sep 21, 2009 4:38 am
Re: Custom Variables, Key binds,If Statements, and Mouse Control
Here look at the scripts for this
-
niffirg1 - Posts: 376
- Joined: Mon Aug 31, 2009 10:31 pm
- Location: The Great American South!
Re: Custom Variables, Key binds,If Statements, and Mouse Control
As to your mouse control, it makes no difference, but i put all of the stuff you put in your hinges, into the oncollide section. You may also point out that it will work differently depending on how big the objects are. Good tut
-
kilebantick - Posts: 1267
- Joined: Tue Sep 01, 2009 9:50 am
Re: Custom Variables, Key binds,If Statements, and Mouse Control
ok but to bind an arrow key would it be the same?
Thymer... Sorta :/
Like my avatar? Google it: gif it's pretty cool, just get the original sorce and put it for the URL of a pic like this:
http://www.imitationpickles.org/galcon/ ... /zarah.gif
neeed more help? Pm me :^)
My site/forum:
http://way2crazy.iforums.us/
^a ninja was here
Like my avatar? Google it: gif it's pretty cool, just get the original sorce and put it for the URL of a pic like this:
http://www.imitationpickles.org/galcon/ ... /zarah.gif
neeed more help? Pm me :^)
My site/forum:
http://way2crazy.iforums.us/
^a ninja was here
-
Way2crazy - Posts: 20
- Joined: Mon Sep 21, 2009 4:38 am
Re: Custom Variables, Key binds,If Statements, and Mouse Control
Not Excactly, No
-
niffirg1 - Posts: 376
- Joined: Mon Aug 31, 2009 10:31 pm
- Location: The Great American South!
Re: Custom Variables, Key binds,If Statements, and Mouse Control
how do you make it so the mouse control follows when you move your mouse up and down?
-
simey j dude - Posts: 61
- Joined: Sat Sep 05, 2009 3:11 am
- Location: under your bed!
Re: Custom Variables, Key binds,If Statements, and Mouse Control
app.mousepos is a integrated variable that will show the known location of the mouse.
app.mouse(1) is the Y axis (I.E Up and down)
using this we can make a code to make your object behave differently to the height of the mouse
So in plain English.
If the mouse is higher then my current location, turn the motor on, otherwise turn it off.
To make the script more personalized i would actually need to see the scene.
app.mouse(1) is the Y axis (I.E Up and down)
using this we can make a code to make your object behave differently to the height of the mouse
- Code: Select all
{app.mousepos(1) >= e.pos(0)}?{scene.my.motor = true}:{scene.my.motor = false}
So in plain English.
If the mouse is higher then my current location, turn the motor on, otherwise turn it off.
To make the script more personalized i would actually need to see the scene.
-
Mystery - Posts: 2802
- Joined: Thu Sep 03, 2009 1:16 pm
- Location: Southern Australia
Re: Custom Variables, Key binds,If Statements, and Mouse Control
How do you make something follow another geometry other than a mouse?
What is the script?
I am trying to create a GUided rocket
What is the script?
I am trying to create a GUided rocket
live to learn
learn to survive
survive to eventually die successful
learn to survive
survive to eventually die successful
-
Blackonyx2234 - Posts: 24
- Joined: Sun Jan 31, 2010 5:12 am
Re: Custom Variables, Key binds,If Statements, and Mouse Control
Can I make a bind a so that when it is not pressed, it is acivated?
-
FuzzyLogicBrain - Posts: 315
- Joined: Mon Jan 31, 2011 7:48 pm
- Location: when online, on the computer. when not, probably on it anyways. ;D lulz
13 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 2 guests