OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: General Barron on 27 Apr 2005, 00:28:44
-
The title of this topic really says it all: the "null" command is missing from the online command reference! I know this command is usable in-game, as in:
_var = null
So wtf is up?
-
Its not in the offline version either. ;D
There is always 'nil' though ::)
Planck
-
Hmm... that is odd. I wonder where I saw the command to be able to use it? Maybe it from the autocomplete function or something...
Actually, on second thought.... perhaps this isn't really a command? I'll have to do some more experimenting, but I've done things like this:
_var = null
hint format ["%1", _var]
And it will display: "<null>"
Perhaps that happens because I am trying to assign a non-initialized variable to _var? In which case, I would have a bit of egg on my face.... I'll have to look into this. ::)
-
We know about objNull and grpNull and I suspect there are other null-type things .... but I'm not sure there is a pure "null". In the context you describe the command is nil.
I had a quick look through and I couldn't find it anywhere. Or course half the really useful stuff is not listed in the alphabetical section.
The online comref was based on the 1.85 official comref I believe. Anything that is in one is in the other.
-
The online comref was based on the 1.85 official comref I believe. Anything that is in one is in the other.
I think one or two are missing from the offline version as it was never updated to take in the newer commands that came in.
Planck
-
typeOf was added. I'm not sure if there is anything else either added or missing.
-
I was intrigued by this so did some experimenting. I didn't use scripts I just used triggers, but I cannot replicate:
_var = null
hint format ["%1", _var]
And it will display: "<null>"
If I set global variable to null, or if I set it to anything valid anything and then set it to null it returns the ubiquitous: 'scale bool array string ....' as it does if I set the variable to nil.
According to comref setting a variable = nil doesn't so much set its value as destoy the variable. Useful if you know you have finished with it.
-
I can't access OFP at the mo so no way for me to try out,
but did anybody yet try: _var = nullnull
(or whatever else)?
What will be displayed then:
<null>?
or
<nullnull>?
~S~ CD
-
I think that we've all been decieved by ourselves. There seems to be no "null" command. I've checked it out in local variables and in global variables, in-game, and from scripts. It always produces "scalar bool string array." I've tested creating a variable with the name "null", and made its value a string, and then used the hint command to show it. The string I placed into the variable, "HELLO", was visible on the screen. This means that "null" is not a reserved variable, or command. Which also means that the "null" command, as we all were led to believe was real, does not exit.
Thanks,
Bluelikeu
-
A quick play round in the editor confirms what Bluelikeu says.
null is not reserved and can be assigned, hence it is nothing.
-
I don't quite see that.
I set a repeatable Alpha radio trigger with an activation field of
blob = "Hello"
and a repeatable Beta radio radio trigger that has in its activation filed:
hint format["%1",blob]
a repeatable Charlie radio trigger that has
blob = null
and a repeatable Delta radio trigger that has
blob = nil
Using this I can see no difference between
variable = null
and
variable = nil
-
Now try setting "variable" to something else like "forge." Make sure "forge" is not a real variable. The output will be the same as before.
-
The fact that you can say "null = player", or whatever, means null is not reserved. It's just like any other variable name you chose
-
I would have a bit of egg on my face....
::)
Funny thing is I've seen at least two threads just like this one in the last few months or so...
The fact that you can say "null = player", or whatever, means null is not reserved. It's just like any other variable name you chose
Actually, that isn't entirely true, since it is possible to assign variables that have the same names as commands. For example, in one ECP cutscene, someone named a unit "leader". It took me hours to figure out why a certain script I had just implemented kept throwing errors at me... until I finally noticed that.
-
Oops. I'm thoroughly guilty of making an assumption there. Sorry.
EDIT: So what happens if you name a unit, for example, 'nil', and then say _myUnit = nil. What does _myUnit become then?
Interestingly, _myUnit becomes whatever your unit named 'nil' is. So, nil as a variable has a higher precendence than nil as a null reference. Interesting stuff.
For example, in one ECP cutscene, someone named a unit "leader". It took me hours to figure out why a certain script I had just implemented kept throwing errors at me... until I finally noticed that.
That's a bit of a bugger!
::)
I would have a bit of egg on my face....
Now I'm positively drenched in it :P
-
Ok, "leader" is a usable name. However, as you said, when you try to access the variable "leader", OFP looks for the command leader instead. Since you can do the same thing with "null", but OFP doesn't look for the command null, it still means that null is not a command, and is not different from any other random text. "dsdfsf" seems to produce the same effect that "null" has.
Thanks,
Bluelikeu
-
No, really guys, there is no 'null' command.
Even the autocomplete feature in the editor doesn't come up with it.
Mind you, it doesn't come up with 'nil' either, but 'nil' is listed in the command reference.
Planck
-
Btw, the online comRef and others are missing the function (ok, a command.. ) engineOn which was added in with some 1.9x patch...
Usage is
<vehicle> engineOn <true/false>
-
Ahhh....my version of the BIS command reference has been updated with all the 'newer' commands.
I tend to forget that and assume everyone has the same. ;D
Planck