Home   Help Search Login Register  

Author Topic: In scripting, What are arguments???  (Read 805 times)

0 Members and 1 Guest are viewing this topic.

Offline NightJay0044

  • Former Staff
  • ****
  • Let's make OFPEC great again
    • My Steam Workshop
In scripting, What are arguments???
« on: 20 Jul 2004, 06:06:49 »
Okay, i have talked to people about arguments in a script. They  have no idea what im talking about sometimes. I think what an argument is. when you have more then 1 array in an execute line in a trigger. such as this.

[array,array] exec "script.sqs"

would that be an argument since there is more then 1 array. I could be wrong? if anybody has the answer please help thanks.

I'm learning the very basics of scripting right now
Who's hyped for Arma4, long live Arma!

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:In scripting, What are arguments???
« Reply #1 on: 20 Jul 2004, 08:57:38 »
Well, I may be a bit off here because my native language is not english so I have never studied any other programming than OFP programming in english...

But afaik arguments are sort of the same as a variable.

If you have _varib = 3, it's an argument that _varib is 3....

The name 'argument' is probably used more with boolean (true/false) variables/sentences...

But as I said, I can be wrong ::)
(and I probably am, it's been a long while since I have been dealing with any 'real' programming...)

So anybody with correct information, please share... :P
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline MI_Fred

  • Members
  • *
  • AA
    • OFP Team Finlanders
Re:In scripting, What are arguments???
« Reply #2 on: 20 Jul 2004, 09:21:19 »
Perhaps an old skool ofpec'er should explain this  :P

I'n my learning days I got the impression that an argument is an item that you pass into a script. There can be multiple ones as you have there, that makes an array and you have to surround it with the []. If you want to pass arrays in arrays use
Code: [Select]
[[],[]]. So more than one array doesn't make an argument, contradiction, error or whatever you were implying  ::)

Edit: ok silly me trying to use the yabb tags without code tags...
« Last Edit: 20 Jul 2004, 09:22:46 by MI_Fred »
There's gooks over there, there's mines over there, and watch out those goddamn monkeys talk, I'll bite ya.

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:In scripting, What are arguments???
« Reply #3 on: 20 Jul 2004, 09:32:00 »
Quote
I'n my learning days I got the impression that an argument is an item that you pass into a script.
At first I was going for this but left it out... :P

So, in a way what in OFP (at least in the comref) is referred as element is actually an argument...

So argument can be a variable, value, whatever (?)...
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline MI_Fred

  • Members
  • *
  • AA
    • OFP Team Finlanders
Re:In scripting, What are arguments???
« Reply #4 on: 20 Jul 2004, 09:44:06 »
Yea, an argument as an element of an array .. is an argument... perhaps I should rephrase: an element as an item of an array is an argument  ;D

Looks like you were as much right HateR_Kint, as an element of an array a variable for instance can be an argument, even as itself. But that's just semantics that doesn't help the beginners  ;)
There's gooks over there, there's mines over there, and watch out those goddamn monkeys talk, I'll bite ya.

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:In scripting, What are arguments???
« Reply #5 on: 20 Jul 2004, 10:37:39 »
Hmm, some of this is not quite right.   Let's take a couple of  examples:-


[loon1, loon2] join grpA

The join command has two arguments:  the array of units, and the group they will join.


[loon1, loon2, grpB] exec "joinscript.sqs"

The exec command has two arguments:  the array of parameters and the name of the script.    The array has three elements, which suggests that three parameters must be passed to the script.    The script may have additional parameters hard coded into it.


None of these are variables.   A variable is something whose value can vary:  in other words, at any given moment you can say that variable myVariable is equal (or not equal, or greater than or whatever you like) to something else.   However you can of course use variables as parameters or arguments:

[_firstLoon] join myVariable

where firstLoon is a local variable representing a unit and myVariable is a global variable representing a group.   _firstLoon is therefore an element in an array, and a parameter, and a variable, but it is not an argument.


To summarise:

An element is an item in an array

A parameter is a piece of data (such as a unit name) that you pass to a script.  (Or a piece of data already in a script.)

A variable is something that can have its value changed

An argument is something that command requires in order to make it work


Does that help?
Plenty of reviewed ArmA missions for you to play

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:In scripting, What are arguments???
« Reply #6 on: 20 Jul 2004, 13:47:15 »
Quote
But that's just semantics that doesn't help the beginners
;D
Quite...
I'm about to get confused myself... ;D

Quote
An argument is something that command requires in order to make it work
To be pedantic (and more confusing): there's no such thing as a command ::) :P

They are either functions like getIn or saveGame or operators like =, ==, AND, OR...

But still, macgubas explanation has some points:
Quote
[loon1, loon2] join grpA

The join command has two arguments:  the array of units, and the group they will join.
True...

The [loon1,loon2] join grpA is an command line argument...

The join is a function that needs two arguments, the array of parameters (elements) and a variable (group)...

So we all have been kind of right in our posts :P
(more or less ::) )

an argument can be a variable (object, unit, integer, string...) or an array of parameters (variables, strings, integers, booleans...)...
Or an array of array(s) of parameters...
Or even array(s) of parameters and arguments...

example:
_var = 3
the operator  =  needs two arguments, the _var and the value 3...

typeOf player == "SoldierWB"
the function typeOf needs one argument to work, a variable (in this case player)
the operator  ==  needs two arguments to work, a variable (in this case returned by the typeOf function, a string) and a value (in this case a string)...
I left out the ?  from that example because otherwise this explanation would not end... ever... :P

Code: [Select]
this addeventHandler ["fired",{if (_this select 2 != "throw") then {[(nearestObject [_this select 0, _this select 4]),_this select 0,_this select 1,_this select 3] call htr_dispFire}}] here are arrays of arguments and variables passed into a function as an argument... Inside an argument :P
this addEventHandler [stuff] is an command line argument...


So yes, the argument is something that a function (command in OFP...) needs in order to work, but the argument(s) can be almost anything...
It depends on the function... :P

And the answer to the original question:
Don't use the word argument ;D
It's irrelevant as a program is a pile of arguments arguing and then coming to some conclusion(s)... (hugely simplified...) :P

If I have been talking holes in my head for the whole of this post, I will move to Botswana and start farming Carbalach tomatoes... :-X  :beat: :tomato:
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline NightJay0044

  • Former Staff
  • ****
  • Let's make OFPEC great again
    • My Steam Workshop
Re:In scripting, What are arguments???
« Reply #7 on: 20 Jul 2004, 16:10:02 »
Hey thanks everyone for your replies. i kind of get it, it's still alll a little confusing to me, but once i study more i'm sure i'll get the hang of it, but i have a pretty good idea.    :) .
Who's hyped for Arma4, long live Arma!

Dubieman

  • Guest
Re:In scripting, What are arguments???
« Reply #8 on: 20 Jul 2004, 16:15:37 »
Well I never saw it the way you guys did about arrays and arrays contradicted themselves and such. I'm no programmer, but I always theink of arguemnts as ways to move from one part of the script to the other or to have something happen.


Like:
?trig1done: goto "arm"       a boolean(true/false)



Ahh well I like dealing with simple stuff...
I hate being the dark with 250 lines of OFP code. :D :P
 

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:In scripting, What are arguments???
« Reply #9 on: 20 Jul 2004, 16:39:50 »
Quote
I hate being the dark with 250 lines of OFP code.
lol... ;D
Don't be afraid of the code, the code is afraid of you... :D

I actually have never thought of anything passed into scripts as arguments... ::)
Until now, as I seen a few people use that term...

If you say string, everybody understands...
If you say array, everybody understands...
If you say variable, everybody understands...

But when you start talking about arguments, that's another thing...
As quite a big presentage here are not from english speaking country, so many people here may understand an 'argument' being what it usually means, a 'verbal fight'...
In my native language argument also means a point made by some one when debating on some issue...

like for example [dude1,dude2] orderGetIn true...
That has two arguments ([dude1,dude2] and true), but that doesn't seem like there would be a debate inside the orderGetIn function to get the dude1 and dude2 to agree that they need to get in because the order is now true... ::) :P

Quote
Ahh well I like dealing with simple stuff...
Well, that is the best way...
I myself tend to think things in redicilously complex ways, and usually end up writing miles of code until understanding there's a much simplier way of doing that same thing ::)

Quote
I'm no programmer
Me neither...
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline Roni

  • Members
  • *
  • Play the Game !
Re:In scripting, What are arguments???
« Reply #10 on: 21 Jul 2004, 03:36:37 »
"Hey you - you're completely wrong !"

"No I'm not !"

"Yes you are !"

etc


Now THAT'S an argument . . .   :D

(That's not an argument !  That's just a simple gainsaying of what the other person says . . . see: Python, Monty)   ;D



Roni