Mikero – User talk

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "Killzone Kid" to "Killzone_Kid")
 
(18 intermediate revisions by 7 users not shown)
Line 1: Line 1:
I edited several changes you made about scripting types, because they were not valid for scripting. I suppose you mixed scripting and config writing here.
--[[User:Suma|Suma]] 11:41, 30 June 2006 (CEST)


yes. i did. Since there's nothing really 'out there' for addon token names, i'm starting somewhere




Hi Mikero, please check [[Talk:CfgVehicles Config Reference | this]]. Thanks.
== Booleans ==


--[[User:Raedor|Raedor]] 13:19, 3 July 2006 (CEST)
I believe your version of the description of boolean is misleading so I reverted it, and this is why. For mission config you do not need any #defines for true or false, it works fine without any. Also implying that such #define is required, means that you cannot use TRUE or True or TrUe, because #define is case sensitive, however, it is possible to use any of the above. Here is a little experiment. Create description.ext with
<code style="display: block">thisistrue = truE;
thisisfalse = FaLse;
</code>


done, thanks
then run the following commands in debug console:


--[[User:Mikero|ook?]] 14:37, 7 July 2006 (CEST)
<code style="display: block">hint str getMissionConfigValue "thisistrue"; //"truE"
hint str getMissionConfigValue "thisisfalse"; //"FaLse"
</code>


== Terry Pratchett fan? ==
As you can see, in config they are indeed treated as strings like you said. However when forced to number in the engine, they become 1 or 0 accordingly:


Just wondered, because of your alias :-) --[[User:Hardrock|hardrock]] 01:57, 21 July 2006 (CEST)
<code style="display: block">hint str getNumber (getMissionConfig "thisistrue"); //1
hint str getNumber (getMissionConfig "thisisfalse"); //0
</code>


I would sometimes prefer my Sig to be Vimes );  --[[User:Mikero|ook?]] 02:00, 21 July 2006 (CEST)
If there are #defines in config that explicitly link true to 1 and false to 0, then it could be for some other reason. [[User:Killzone_Kid|Killzone_Kid]] ([[User talk:Killzone_Kid|talk]]) 01:24, 13 July 2016 (CEST)
----
you are confusing what the engine is coded to look for with the sqX language processor. sqx 'accepts' case insensitive "true" and "false" as being a boolean const. The engine does not. A string is a string is a string. In the (equivalent of) the engine's c language


here we go [[User:Mikero|ook?]]
if (some_boolean==1)  do_something();


Why are you adding the return value in the command syntax?? Isn't it obvious with the return value section? --[[User:Doolittle|Doolittle]] 07:48, 25 August 2007 (CEST)
There is no engine code to:


because they are far from obvious. They are syntactically incorrect not to state the return value in those instances
if (!strcmp(some_boolean,"true")) do_something();


it is far easier to see them 'at a glance' [[User:Mikero|ook?]]
All paramfiles (config,rvmat,bisurf, fsm, desc.ext, mission.sqm) require true and false to be defined. This is why #include "commondefs.h"  exists and why it is normally placed at top of file.


----
Note that in paramfiles  "true" is not the same thing as true. eg quotes are intended to specifically retain this expression as a string and is done so with the express knowledge that the variable is intended for use by the sqx language processor, not, the engine.


Thanks for the good updates you are doing in the BIKI Mikero! --[[User:WGL.Q|WGL.Q]] 09:13, 25 August 2007 (CEST)
Your example of using sqx hints is misleading you. You are using sqx on an engine variable and assuming they are one and the same.
:: OK, I will not use sqx. Pure config this time. I think we can agree that #define is case sensitive therefore if
<code style="display: block">#define true 1</code>
is used then every <tt>true</tt> will be replaced with 1 on preprocessor level, however <tt>TrUe</tt> will not. So I tweaked config param for APC_Wheeled_03_base_F to see if <tt>TrUe</tt> will be recognised as <tt>true</tt> without define
<syntaxhighlight lang=cpp>
........
gunnerGetOutAction = GetOutLow;
gunnerOpticsModel = "\A3\weapons_f\reticle\Optics_Commander_02_F";
gunnerOpticsEffect[]= {};


thanks, Q. I am writing a sqs/sqf grammar (lint) checker to get over the need to run the scripts real-time to discover errors and typis. So, just going thru each command in my own engine and fixing up the wiki as I go.
isPersonTurret = TrUe; /* <-- over here, was true originally */
personTurretAction = "vehicle_turnout_2";


Incredible work here, Mikero :) Thks for all.--[[User:Whisper|Whisper]] 16:37, 27 August 2007 (CEST)
minOutElev = -10; maxOutElev = +25; initOutElev = 0;
minOutTurn = -90; maxOutTurn = +40; initOutTurn = 0;
......
</syntaxhighlight>
After this ^^^ nothing has changed. Then I tweaked it other way round to see if <tt>FAlse</tt> will be recognised as <tt>false</tt> without define.
<syntaxhighlight lang=cpp>
........
gunnerGetOutAction = GetOutLow;
gunnerOpticsModel = "\A3\weapons_f\reticle\Optics_Commander_02_F";
gunnerOpticsEffect[]= {};


== Minor edits? ==
isPersonTurret = FAlse; /* <-- over here, was true originally */
personTurretAction = "vehicle_turnout_2";


It seems to me you are routinely marking your edits as minor, even when in fact they are not - can you please check if it is what you intended? In Wiki change is considered minor when it changes only a formatting or fixing a typo. Any change into the structure or content should not be considered minor. --[[User:Suma|Suma]] 10:28, 6 September 2007 (CEST)
minOutElev = -10; maxOutElev = +25; initOutElev = 0;
 
minOutTurn = -90; maxOutTurn = +40; initOutTurn = 0;
== Syntax style guidelines ==
......
 
</syntaxhighlight>
It seems to me we should formalise some guidelines about how is command syntax written, as currently the style seems to be somewhat inconsistent. I am creating a new policy page for this, with a discussion:
Rest assured FFV got removed in this configuration. I think this shows it pretty well that #define true/false is not nescessary, however when used there could be other reasons for it. [[User:Killzone_Kid|Killzone_Kid]] ([[User talk:Killzone_Kid|talk]]) 21:04, 16 July 2016 (CEST)
---
----
that's good research. would you be good enough to test that variable against 0 and 1 please?


[[Policy: Scripting Command Page Syntax]]
bis have moved goalposts here. true/false did not work at some time in the past, perhaps still doesn't for some vars and was the reason for them being defined in #include "commondefs.h" in arma2.  Hmmmmmm............


Mikero, please, stop changing the style of the scripting command descriptions until something is agreed about this. --[[User:Suma|Suma]] 10:38, 6 September 2007 (CEST)
: Also, can you please change your wiki signature to something containing your nick, so that it is obvious at first sight which discussion posts are by you? Having to remember it is you who signs his post as ook is not very comfortable. --[[User:Suma|Suma]] 17:00, 6 September 2007 (CEST)


== String to Code ==
I'll have to search around for how i tested this. small memory jog was canFloat  for the bmp/m113 vehicles.


You change quite a few commands from accepting String as a parameter to Code. ctrlSetEventHandler or OnMapSingleClick being some of them. Maybe this will change in 1.09 or I have a different version of ArmA , but in my version this commands require Strings and will result in an error if supplied with Code. Some clarification on those changes would be appreciated. --[[User:Lwlooz|lwlooz]] 15:15, 6 September 2007 (CEST)
The other thing you have to be aware of is that the above true false declarations are actually invalid. In a properly written config, they will be converted by the compiler (or the engine) into 1 and zero because of the almost-always-included commondefs.h (or equivalent).  Bis can't have it both ways. They either want true and false to be 1 and zero, or not. They can't be half-pregnant. since the very same config MIGHT also have other true false variables that expect, or at least, formerly expected 1 and zero. This holds true *even* if they now account for this internally because commondefs will still be there in legacy addons (and missions).

Latest revision as of 14:48, 12 March 2024


Booleans

I believe your version of the description of boolean is misleading so I reverted it, and this is why. For mission config you do not need any #defines for true or false, it works fine without any. Also implying that such #define is required, means that you cannot use TRUE or True or TrUe, because #define is case sensitive, however, it is possible to use any of the above. Here is a little experiment. Create description.ext with thisistrue = truE; thisisfalse = FaLse;

then run the following commands in debug console:

hint str getMissionConfigValue "thisistrue"; //"truE" hint str getMissionConfigValue "thisisfalse"; //"FaLse"

As you can see, in config they are indeed treated as strings like you said. However when forced to number in the engine, they become 1 or 0 accordingly:

hint str getNumber (getMissionConfig "thisistrue"); //1 hint str getNumber (getMissionConfig "thisisfalse"); //0

If there are #defines in config that explicitly link true to 1 and false to 0, then it could be for some other reason. Killzone_Kid (talk) 01:24, 13 July 2016 (CEST)


you are confusing what the engine is coded to look for with the sqX language processor. sqx 'accepts' case insensitive "true" and "false" as being a boolean const. The engine does not. A string is a string is a string. In the (equivalent of) the engine's c language

if (some_boolean==1) do_something();

There is no engine code to:

if (!strcmp(some_boolean,"true")) do_something();

All paramfiles (config,rvmat,bisurf, fsm, desc.ext, mission.sqm) require true and false to be defined. This is why #include "commondefs.h" exists and why it is normally placed at top of file.

Note that in paramfiles "true" is not the same thing as true. eg quotes are intended to specifically retain this expression as a string and is done so with the express knowledge that the variable is intended for use by the sqx language processor, not, the engine.

Your example of using sqx hints is misleading you. You are using sqx on an engine variable and assuming they are one and the same.

OK, I will not use sqx. Pure config this time. I think we can agree that #define is case sensitive therefore if

#define true 1 is used then every true will be replaced with 1 on preprocessor level, however TrUe will not. So I tweaked config param for APC_Wheeled_03_base_F to see if TrUe will be recognised as true without define

........
						gunnerGetOutAction	= GetOutLow;
						gunnerOpticsModel	= "\A3\weapons_f\reticle\Optics_Commander_02_F";
						gunnerOpticsEffect[]= {};

						isPersonTurret 		= TrUe; /* <-- over here, was true originally */
						personTurretAction 	= "vehicle_turnout_2";

						minOutElev = -10;	maxOutElev = +25;	initOutElev = 0;
						minOutTurn = -90;	maxOutTurn = +40;	initOutTurn = 0;
......

After this ^^^ nothing has changed. Then I tweaked it other way round to see if FAlse will be recognised as false without define.

........
						gunnerGetOutAction	= GetOutLow;
						gunnerOpticsModel	= "\A3\weapons_f\reticle\Optics_Commander_02_F";
						gunnerOpticsEffect[]= {};

						isPersonTurret 		= FAlse; /* <-- over here, was true originally */
						personTurretAction 	= "vehicle_turnout_2";

						minOutElev = -10;	maxOutElev = +25;	initOutElev = 0;
						minOutTurn = -90;	maxOutTurn = +40;	initOutTurn = 0;
......

Rest assured FFV got removed in this configuration. I think this shows it pretty well that #define true/false is not nescessary, however when used there could be other reasons for it. Killzone_Kid (talk) 21:04, 16 July 2016 (CEST) ---


that's good research. would you be good enough to test that variable against 0 and 1 please?

bis have moved goalposts here. true/false did not work at some time in the past, perhaps still doesn't for some vars and was the reason for them being defined in #include "commondefs.h" in arma2. Hmmmmmm............


I'll have to search around for how i tested this. small memory jog was canFloat for the bmp/m113 vehicles.

The other thing you have to be aware of is that the above true false declarations are actually invalid. In a properly written config, they will be converted by the compiler (or the engine) into 1 and zero because of the almost-always-included commondefs.h (or equivalent). Bis can't have it both ways. They either want true and false to be 1 and zero, or not. They can't be half-pregnant. since the very same config MIGHT also have other true false variables that expect, or at least, formerly expected 1 and zero. This holds true *even* if they now account for this internally because commondefs will still be there in legacy addons (and missions).