|
Post by commended on Jul 14, 2017 18:24:01 GMT
Ok, I'm sure the answer is very obvious but I just can't figure it out, I've just started learning to write my own scripts and just improve my general understanding, I watched all of GH Games 's videos (very good) and I've started with a very simple if iKeyDown add 1 to value print. Not working, anyone know the problem? Script: void Main() { if (iKeyDown(iKeyCode("DIK_A"))) { OUT_0 = OUT_0 + 1; } }
|
|
|
Post by Power Supersport on Jul 14, 2017 18:55:23 GMT
It has to be OUT_0 = IN_0 + 1;
OUT values are only used for setting data, you can't get data from them... IN values are completely opposite...
|
|
|
Post by TinSoldier on Jul 14, 2017 19:47:00 GMT
Here's a little more to add a oneshot key press.
bool KeyDown = false;
void Main(){
if(!iKeyDown(-1)) KeyDown = false;
if(iKeyDown(iKeyCode("DIK_A")) && !KeyDown){ KeyDown = true; OUT_0 = IN_0+1; } }
|
|
|
Post by WhyNot on Jul 15, 2017 3:27:18 GMT
Maybe Storing the value as a int would make things simpler... int MyValue = 0; //your value
void Main() {
if(iKeyDown(iKeyCode("DIK_A"))) { MyValue += 1; //add 1 to the value OUT_0 = MyValue; //Display the value } }
|
|