Mikero – User talk

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
m (Text replacement - "Killzone Kid" to "Killzone_Kid")
 
(9 intermediate revisions by 3 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
I would sometimes prefer my Sig to be Vimes  );   --[[User:Mikero|ook?]] 02:00, 21 July 2006 (CEST)
</code>
 
here we go [[User:Mikero|ook?]]
 
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)
 
because they are far from obvious. They are syntactically incorrect not to state the return value in those instances
 
it is far easier to see them 'at a glance' [[User:Mikero|ook?]]


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


Thanks for the good updates you are doing in the BIKI Mikero! --[[User:WGL.Q|WGL.Q]] 09:13, 25 August 2007 (CEST)
if (some_boolean==1)  do_something();
 
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.
 
Incredible work here, Mikero :) Thks for all.--[[User:Whisper|Whisper]] 16:37, 27 August 2007 (CEST)
 
== Minor edits? ==
 
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)
 
== Syntax style guidelines ==


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:
There is no engine code to:


[[Policy: Scripting Command Page Syntax]]
if (!strcmp(some_boolean,"true")) do_something();


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)
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.
: 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 ==
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.


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)
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 for that, i have reverted [[ctrlSetEventHandler]] along with ctlbutton you are quite correct
isPersonTurret = TrUe; /* <-- over here, was true originally */
personTurretAction = "vehicle_turnout_2";


:: [[onMapSingleClick]] is as per the ofpec comref as is 'correct' using brace
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[]= {};


[[User:Mikero|ook?]] 02:57, 7 September 2007 (CEST)
isPersonTurret = FAlse; /* <-- over here, was true originally */
 
personTurretAction = "vehicle_turnout_2";
== my shiny new sig ==
 
[[User:Mikero|Mikero]] 05:46, 8 September 2007 (CEST)
 
:Mein Gott! IT verKS!


minOutElev = -10; maxOutElev = +25; initOutElev = 0;
minOutTurn = -90; maxOutTurn = +40; initOutTurn = 0;
......
</syntaxhighlight>
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?


hey Mikero :)
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............
 
good to see you back in action!
We have a project going that should be of interest for you as well.
Unfortunately I lost your Skype ID. Can you please send it to me
again via the [http://www.flashpoint1985.com/cgi-bin/ikonboard311/ikonboard.cgi?act=Profile;CODE=03;MID=81-1010151515 BI forum PM]. cheers!
 
--[[User:WGL.Q|PROPER Q]] 09:29, 5 December 2008 (CET)
 
:Sorry. I switch skype accounts. So not possible to receive your message there.
:Either BI forum PM or [http://www.ofpec.com/forum/index.php?action=profile;u=16272 OFPEC PM]. Ceers!
 
--[[User:WGL.Q|PROPER Q]] 14:08, 5 December 2008 (CET)
 
=Preview=
Thanks for all the contributions - they're really appreciated. But it would be ''really'' nice if you could use the Preview button a bit more often. It would make things easier for those of us scanning the general edit history, to keep track of what's going on... Thanks! --[[User:Kronzky|Kronzky]] 01:59, 11 January 2009 (CET)


: I understand the problem, and am annoyed by it myself. The trouble is I am on a quite unstable sattelite connection in the middle of the South Pacific (Norfolk Island) that quite often drops packets. If I edit a large body of text, i run the risk of losing it all. Regardless, I'll do my best to limit the noise. [[User:Mikero|Mikero (nee Ook?)]]


: Well you can group recent changes of the same type. Maybe a fair default setting?
I'll have to search around for how i tested this. small memory jog was canFloat  for the bmp/m113 vehicles.
: [[Special:Preferences#prefsection-7]]
: '''Enhanced recent changes (JavaScript)''' --[[User:WGL.Q|PROPER Q]] 09:06, 11 January 2009 (CET)


=Deleting redirects=
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).
Is this the way you "delete" pages? If so, please use the request deletion template instead ;) --[[User:T D|T_D]] 09:07, 17 May 2010 (CEST)

Latest revision as of 13: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).