Jump to content
Bode_DHSF

Simple question abt a number in a script

Recommended Posts

I didn't want to make a post abt a question that could easily be answered by someone with some scripting knowledge, but the guys in the Discord "Ask Questions Channel" , don't like answering questions (I realize they don't want to do your work for u & it's better to research & learn it for yourself, but just reading & trying to teach yourself with no context doesn't help either)  ....... So, after looking thru the scripting section of the wiki, I still couldn't find an answer.. BUT, I just want to know the significance of the zero in the second script.. **sorry for the rant, here's the script:

 

["AmmoboxInit",[this,true]] call BIS_fnc_arsenal;

&

0 = ["AmmoboxInit",[this,true]] spawn BIS_fnc_arsenal;

 

I know one calls & one spawns, the difference being instant & delayed creation of the arsenal within the thread (also, not sure what a thread is in an scripting context, but that's not a concern right now, I'm still researching), so what is the purpose of the zero? 

 

Thanks

Share this post


Link to post
Share on other sites

As a non-answer about this non-post, I'd said it's an handle. As explained in this not-yet-read BIKI.

0 is a common, simple use as far as you don't need this handle but sometimes mandatory like in trigger's fields.

You could use _null as well but it's longer and more tiresome.

Not needed when written in another sqf.

 

Share this post


Link to post
Share on other sites
7 minutes ago, pierremgi said:

As explained in this not-yet-read BIKI.

this is what I'm talking abt... How was I supposed to get here with no context.. I was searching thru Arma 3 not Armed assault, I see that it says spawn, but when someone tells u read the BIKI & nothing more, to someone who is not as experienced, getting from A-B is not so clear.. I appreciate the non explanation.. Even with the sarcasm u have done more than the rest..

 

Look, I'm just trying to learn. I'm reading guides, forums & anything else I can to teach myself , but yea, sometimes I have questions, as simple as they seem to u guys, I'm not on your level yet & trust when I get there, I promise I won't show my face around a forum or discord again, as to not disturb the genius of the Arma scripting community

 

I apologize.. my disappointment is not aimed at u (even tho it's here in my reply to u).. I've seen u help plenty of ppl, myself included.. there's just so much looking down on those who aren't as skilled as the rest.. We just want to learn & regardless of the subject, asking questions is a part of the process.. thanks again for your response 

  • Like 1

Share this post


Link to post
Share on other sites
15 hours ago, Bode_DHSF said:

so what is the purpose of the zero? 

Its purpose is to trigger the only real bug in the SQF language, to workaround another bug in the Arma mission editor.

the = returns nothing, nothing at all, it basically leaves back a empty hole.

The script textboxes in the editor are bugged in that they require you to return nothing from them (CBA mod fixes that) and the 0= or dummy= or _null= or whateveryouwant= is just a common way to work around that bug.

 

Its btw the same with the call, if the called function returns something, you need 0= there too.

 

14 hours ago, pierremgi said:

As a non-answer about this non-post, I'd said it's an handle.

no the 0 is not "a handle", spawn returns a handle but the zero that the user asked about has nothing to do with what spawn really returns

 

 

15 hours ago, Bode_DHSF said:

but the guys in the Discord "Ask Questions Channel" , don't like answering questions

That's a plain lie.

Here was what you asked with full context:

Quote

whats the dif in these 2 scripts:
["AmmoboxInit",[this,true]] call BIS_fnc_arsenal;

&

0 = ["AmmoboxInit",[this,true]] spawn BIS_fnc_arsenal;

as far as I can tell they do the same thing

and here is the answer

Quote

result is the same, but one is call and the other is spawn

you can lookup the difference in the BIKI

 

Which is the correct answer to that exact question, you never stated you wanted to know anything about the 0=, so how was anyone supposed to know that?

 

14 hours ago, Bode_DHSF said:

there's just so much looking down on those who aren't as skilled as the rest..

The guy who answered your question assumed you are a beginner who isn't skilled enough to know the difference between call and spawn. He didn't look down at you at all, he assumed your experience and answered appropriately.

 

14 hours ago, Bode_DHSF said:

I see that it says spawn, but when someone tells u read the BIKI & nothing more, to someone who is not as experienced, getting from A-B is not so clear..

Why not ask "what is biki" then? How is anyone supposed to know that you don't know what "biki" is if you don't tell them about it? People cannot read your mind online.

If you don't know something and have a question, then you have to ask the question and not go "ah he's just calling me dumb and doesn't want to help me"

Share this post


Link to post
Share on other sites
16 hours ago, Dedmen said:

Its purpose is to trigger the only real bug in the SQF language, to workaround another bug in the Arma mission editor.

the = returns nothing, nothing at all, it basically leaves back a empty hole.

The script textboxes in the editor are bugged in that they require you to return nothing from them (CBA mod fixes that) and the 0= or dummy= or _null= or whateveryouwant= is just a common way to work around that bug.

 

Its btw the same with the call, if the called function returns something, you need 0= there too.

 

no the 0 is not "a handle", spawn returns a handle but the zero that the user asked about has nothing to do with what spawn really returns

 

 

That's a plain lie.

Here was what you asked with full context:

and here is the answer

 

Which is the correct answer to that exact question, you never stated you wanted to know anything about the 0=, so how was anyone supposed to know that?

 

The guy who answered your question assumed you are a beginner who isn't skilled enough to know the difference between call and spawn. He didn't look down at you at all, he assumed your experience and answered appropriately.

 

Why not ask "what is biki" then? How is anyone supposed to know that you don't know what "biki" is if you don't tell them about it? People cannot read your mind online.

If you don't know something and have a question, then you have to ask the question and not go "ah he's just calling me dumb and doesn't want to help me"

I just wrote a whole response to all your replies, but I hit backspace & it took me off the page & I lost it.. I'm not going to rewrite it. I'll just say,  It's not a lie, I do know what the BIKI is, I never said I didn't, & telling me it's call & spawn gives me no additional info, I see that in the script..but thanks for taking 2 second to explain the answer.. I do appreciate when u guys do help.. I don't want u guys to think I'm an asshole for no reason, but I don't expect to treated like one cuz I don't have the years of experience as some of u, just want a little more guidance than just a link to a guide that I would need to spend the next few months studying to find an answer to a specific , simple question, which I am & I do try not to ask question that are easily found.. Thanks again

Share this post


Link to post
Share on other sites

OK, just remind, (if I'm right):

1 -

The editor (and especially the triggers act/deact fields), is bugged (see dedmen's explanation), returning error if your code doesn't return nothing. And the best way for that, is to write the:   0 = [] spawn {} which doesn't return anything. You don't need that running it from an sqf.

NB: I ought to write 0 is "at the place of" the handle...

 

2 -

0 here is not a workable variable (identifier).     a0 is a workable one (example), _null also. That makes a little difference.

For test, in debug console, watch for myVar , then run:

_null = [] spawn {hint "Hello world!";uiSleep 5; hint "bye"}; myVar = _null;

As you can see myVar (then _null in an accurate context) will return the script during its execution, then <NULL-script> when terminated.

 

 

Share this post


Link to post
Share on other sites
58 minutes ago, pierremgi said:

OK, just remind, (if I'm right):

1 -

The editor (and especially the triggers act/deact fields), is bugged (see dedmen's explanation), returning error if your code doesn't return nothing. And the best way for that, is to write the:   0 = [] spawn {} which doesn't return anything. You don't need that running it from an sqf.

NB: I ought to write 0 is "at the place of" the handle...

 

2 -

0 here is not a workable variable (identifier).     a0 is a workable one (example), _null also. That makes a little difference.

For test, in debug console, watch for myVar , then run:

_null = [] spawn {hint "Hello world!";uiSleep 5; hint "bye"}; myVar = _null;

As you can see myVar (then _null in an accurate context) will return the script during its execution, then <NULL-script> when terminated.

 

 

Thanks Pierre

Share this post


Link to post
Share on other sites
6 hours ago, Bode_DHSF said:

telling me it's call & spawn gives me no additional info

But thats what it is, and thats what you asked about. If you need more info you gotta say that, and not go away like "they don't want to help me"

You never asked about 0=, so people just assumed that you aren't asking about that, because thats a thing that most beginners just copy-paste out of habit without knowing or even caring what its for or if it even makes sense in that place.

We literally see it every day and just got used to ignoring it, or maybe drop a "thats useless btw" comment once in a while.

So when you want to ask about something thats maybe asked once every couple months, and then mix it in with something thats asked on a weekly basis, people just assume you mean the more common thing if your question is not detailed enough.

 

6 hours ago, Bode_DHSF said:

I see that in the script..but thanks for taking 2 second to explain the answer..

He doesn't know you, beginners often ask about the difference between call and spawn, if you want to know something else you have to be more specific.

 

6 hours ago, Bode_DHSF said:

I don't want u guys to think I'm an asshole for no reason, but I don't expect to treated like one cuz I don't have the years of experience as some of u

You are not treated like one. But now you are treating the people in Arma discord like that, because they genuinely tried to help you, but your inability to ask the question that you really wanted to ask made them give you a different answer than you expected.

And now you make this angry complaining post here denouncing them as "looking down on people" and "not wanting to help" even though its not their fault at all that you cannot ask proper questions.

 

5 hours ago, pierremgi said:

0 here is not a workable variable (identifier).     a0 is a workable one (example), _null also. That makes a little difference.

0 is a valid variable name, just not retrieve-able in plain script.

You can retrieve the value with

missionNamespace getVariable "0"

 

5 hours ago, pierremgi said:

And the best way for that, is to write the:   0 =

 

Thats the easiest way, but not the best way. As 0 is a global variable, it has to be looked up in missionNamespace, and gets set to the value you provide, and then it stays there.

So the lookup is "relatively" slow, and the value stays around "forever" in memory wasting space.

 

A local variable would be better, like _0 or smth, they aren't looked up in the big global namespace but only the local one, which in init boxes is almost empty and the lookup is very fast.

Also after the end of the script, that variable will be deleted and not stay around.

 

Share this post


Link to post
Share on other sites
17 hours ago, Dedmen said:

You are not treated like one.

We obviously see things dif, I know when someone is being short with me & when someone truly has the intention of helping.. & I already said, that with that question, he did.. I thanked him for it.. I wouldn't have done that, if not.. If u recall, I've thanked u before when u help me & I've not thanked u when u haven't.. 

 

17 hours ago, Dedmen said:
On 12/5/2019 at 8:49 PM, Bode_DHSF said:

I see that in the script..but thanks for taking 2 second to explain the answer..

He doesn't know you, beginners often ask about the difference between call and spawn, if you want to know something else you have to be more specific.

this was a genuine thank u, don't turn it into one of your arguing points

 

17 hours ago, Dedmen said:

but your inability to ask the question that you really wanted to ask made them give you a different answer than you expected.

And now you make this angry complaining post here denouncing them as "looking down on people" and "not wanting to help" even though its not their fault at all that you cannot ask proper questions.

I asked exactly what I wanted to know, he answered, just because I added the part abt the zero here, doesn't mean I didn't ask what I intended in Discord.. & that's that.. & If u don't feel like u guys have the tendency to "look down on people" and "not want to help" doesn't mean that's not how the new guys feel when u pass them off to the BIKI or any other guide that, as I said would take a while to understand.. you're treating me like an asshole with this whole statement, because it's false, just because it doesn't happen EVERY time, doesn't mean it never happens.. Have some self awareness.. BUT, I'll make sure to tag u with all the rest of my questions, so u can prove me wrong, I got a few incoming soon too.. unless of course you're planning on banning me for having an opinion that doesn't agree with yours.. Now, are we done here. I don't want to keep on with this bullshit, I've got a BIKI to study....

Share this post


Link to post
Share on other sites
12 hours ago, Bode_DHSF said:

I know when someone is being short with me & when someone truly has the intention of helping..

Weird, most folks I know (including myself) usually have trouble reading emotions out of plain text, especially if it's from people you haven't personally met before.

That's what smilies are for.

Spoiler

:yay:

 

Cheers

Share this post


Link to post
Share on other sites
4 hours ago, Grumpy Old Man said:

Weird

it's not the science of rockets to recognize the pattern of well thought out, helpful explanations against a, "the BIKI is a useful tool." to a question of how to fix or understand something.. Especially in a forum u visit often with the same people.. It's not abt knowing someone personally the display of emotion in text (never seen a sad Q personally)*that was a joke* .. I'm sorry the world wide web is so difficult for u, sir, but I appreciate u poppin on in to add on.. smilies


BTW.. Since I have u here.. I'm having an issue with seeing my Unit insignia in game. I can see it on my guys & they can see it on me.. launcher, vehicles & player menu included.. I just can't see it myself.. I created the arma3.com page & I also created an .xml .. Could they possibly interfere with each other if I have them both in my game (even tho, it only lets u use one or the other), & if not, what kind I do to fix this? No one in any of the Googles I've read has found a solution but plenty experience the same issue.. (**Do I need to make another post for this question?) Thanks in advance for your help.. 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×