Forum Jump :

Author Message


Posts: 23
Rank:


Level: Member

Country: us
Location:
Occupation:
Age: 21
In-game name:

 
#1 Posted at 2015-08-18 23:30        
     
Hello for some reson the while is not working does anyone know why ? Thanks in advance

refilltarg = cursorTarget;
fuelamount = fuel refilltarg;
while {fuelamount < 1} do {
refilltarg setFuel fuelamount + 0.1;
hint format ["Fuel: %1",fuelamount ]
};


Author Message


Posts: 1589
Rank:


Level: Member

Country: pf
Location: Tahiti
Occupation: too many Arma
Age: 60
In-game name: Kobayashi Maru

 
#2 Posted at 2015-08-19 00:41        
     
Using while in a non-scheduled environment is not recommended, but it works as far as you don't need more than 10000 iterations. In other words, without scheduled code, you can't see the difference with: cursortarget setfuel 1;
because there is no pause in you while loop.

The good way to "see" something like a resplenishment is to schedule the code. It's simple: wrap it with:
0=[] spawn { your code here}; this enables the use of sleep (pause):
Try:
0 = [] spawn {while {fuel cursorTarget < 1} do {cursorTarget setFuel (fuel cursorTarget) +0.1; sleep 1}};
Full resplenishment from 0 to 1 takes 10 secondes. Increase sleep at will.

PLEASE CONTACT ME ON BI FORUMS FOR ANY SCRIPT / MOD QUESTION. TKS

Advertisement


Author Message


Posts: 23
Rank:


Level: Member

Country: us
Location:
Occupation:
Age: 21
In-game name:

 
#3 Posted at 2015-08-19 02:58        
     
Thanks You. I will give it a try and see if it meets my needs