OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: Terox on 23 Jan 2003, 20:36:11
-
estimatedtimeleft param1
I want to use the above line , which is normally placed in the init.sqs
in a script, and its value be returned in the hint box
something basic like this
#start
~60
_countdownmsg=format["You have %1 mins remaining",estimatedtimeleft param1]
hint _countdownmsg
goto "start"
[/i]
when i run it, i get
You have <null> mins remaining
My understanding is that estimatedtimeleft param1
has got to be either a function or a global variable
My problem i believe is my syntax (as it nealry always is)
Could somebody explain what i have done wrong , not just give me the fix, thanks
I have easy ways to work around it using a set of variables etc and a looping counter, so please dont post your timer scripts.
I just want to incorporate the estimatedtimeleft param1
-
I don't think you can use it like that at all. It seems to just affect the "xx Minutes Remaining" shown when you presss 'P' and the time left from the browser. There is another way:
;; begin timeLeft.sqs
_timeLeft = param1 - time
_timeLeft = _timeLeft - (timeLeft mod 1)
hint format["You have %1 minutes left", _timeLeft]
;; end timeLeft.sqs
This rounds the minutes remaining down to a whole number. The result of the time function, of course, will be a little different for each client, but it's nothing life-threatening.
-
yeah thats what i am using at the moment or something similar
???? whats the mod1 statement do????
Thx m8
-
Refer to the ComRef if you don't know what a command does.
a mod b
Operand types:
a: Number
b: Number
Type of returned value:
Number
Description:
remainder of a divided by b. Note remainer is calculated in real domain. 1
Example:
3 mod 2 , result is 1
In his script, he used it to subtract the fractional part from the _timeleft variable so that you get a whole number to display in the hint.