OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: General Barron on 27 Apr 2005, 00:28:44

Title: "Null" command missing from online com ref!
Post 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?
Title: Re:"Null" command missing from online com ref!
Post by: Planck on 27 Apr 2005, 00:35:11
Its not in the offline version either.   ;D

There is always 'nil' though  ::)


Planck
Title: Re:"Null" command missing from online com ref!
Post by: General Barron on 27 Apr 2005, 00:45:06
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.  ::)
Title: Re:"Null" command missing from online com ref!
Post by: macguba on 27 Apr 2005, 00:51:06
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.
Title: Re:"Null" command missing from online com ref!
Post by: Planck on 27 Apr 2005, 01:02:07
Quote
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
Title: Re:"Null" command missing from online com ref!
Post by: macguba on 27 Apr 2005, 13:20:51
typeOf was added.  I'm not sure if there is anything else either added or missing.
Title: Re:"Null" command missing from online com ref!
Post by: THobson on 29 Apr 2005, 17:39:35
I was intrigued by this so did some experimenting.  I didn't use scripts I just used triggers, but I cannot replicate:
Quote
_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.
Title: Re:"Null" command missing from online com ref!
Post by: Chris Death on 03 May 2005, 14:39:09
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
Title: Re:"Null" command missing from online com ref!
Post by: Bluelikeu on 04 May 2005, 13:57:14
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
Title: Re:"Null" command missing from online com ref!
Post by: Fragorl on 05 May 2005, 09:23:06
A quick play round in the editor confirms what Bluelikeu says.

null is not reserved and can be assigned, hence it is nothing.
Title: Re:"Null" command missing from online com ref!
Post by: THobson on 05 May 2005, 22:14:33
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
Title: Re:"Null" command missing from online com ref!
Post by: Bluelikeu on 05 May 2005, 22:27:18
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.
Title: Re:"Null" command missing from online com ref!
Post by: Fragorl on 08 May 2005, 09:10:59
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
Title: Re:"Null" command missing from online com ref!
Post by: General Barron on 09 May 2005, 06:29:17
Quote
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...

Quote
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.
Title: Re:"Null" command missing from online com ref!
Post by: Fragorl on 09 May 2005, 06:39:33
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!

::)
Quote
I would have a bit of egg on my face....
Now I'm positively drenched in it :P
Title: Re:"Null" command missing from online com ref!
Post by: Bluelikeu on 10 May 2005, 17:27:37
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
Title: Re:"Null" command missing from online com ref!
Post by: Planck on 10 May 2005, 20:19:52
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
Title: Re:"Null" command missing from online com ref!
Post by: h- on 01 Oct 2005, 08:29:02
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>
Title: Re:"Null" command missing from online com ref!
Post by: Planck on 01 Oct 2005, 16:48:06
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