Jump to content
Heeeere's johnny!

[Nerdgasm] Longest possible string of scripting commands

Recommended Posts

What is the longest syntactically correct string of scripting commands you can create?

 

To setup the rules:

- only scripting commands, spaces, brackets: ( ) [ ] { } and logical operators: = ! & | , ; ? : < > + - * / ^ %

- no functions

- no global, local or special variables (like _x, _forEachIndex etc.)

- no strings (meaning anything wrapped in quotes)

- no numbers

- no dull repetitions like infinitely long switch-case blocks or if (true or true or true or ... ;)

 

 

Let's make two categories:

1) number of words

  • only the number of words is important, not their length

 

2) number of characters

  • only the number of characters (excluding logical operators and spaces) is important, not how many words they come from

 

Here's a starter:

diag_log str ((getPosATL (allPlayers select floor random count allPlayers)) select floor random count getPosATL player)

1        2     3          4          5      6     7      8     9            10     11    12     13    14        15 words and 99 characters

 

The above code grabs the position of a random player and prints a random value of that position into the RPT log.

 

Have a nice Play!

Johnny

 

PS: If you find any loop holes in the rules to create infinitely long strings, please let me know. ;)

  • Like 1

Share this post


Link to post
Share on other sites

 

 

PS: If you find any loop holes in the rules to create infinitely long strings, please let me know. 

 

1. Unless I misunderstood something, without breaking above rules is doable virtually endless chain of conditions (repeating is allowed, isn't?). Like:

 

if (true or true or true or... etc. 

 

2. Similar way, via repeating, you can have "endless" switch - do lists, any number of empty loops/scopes in the loops/scopes levels,  etc.

 

There's likely more such cases.  

  • Like 1

Share this post


Link to post
Share on other sites

Being allowed to use square brackets means could could easily create an infinitely long line by creating a huge array full of unused code:

[player, player, player, player,  ...  player, player] select 965775

Share this post


Link to post
Share on other sites

 

Being allowed to use square brackets means could could easily create an infinitely long line by creating a huge array full of unused code:

[player, player, player, player,  ...  player, player] select 965775

 

You may create infinitely long arrays, that's true ... and dull. :P But you can't select using a number, because numbers are forbidden by the rules. ;)

Share this post


Link to post
Share on other sites

1. Unless I misunderstood something, without breaking above rules is doable virtually endless chain of conditions (repeating is allowed, isn't?). Like:

 

if (true or true or true or... etc. 

 

2. Similar way, via repeating, you can have "endless" switch - do lists, any number of empty loops/scopes in the loops/scopes levels,  etc.

 

There's likely more such cases.  

 

Thanks! :) ... and yeah, rules updated. ;)

Share this post


Link to post
Share on other sites

diag_log str ((getPosWorld (allPlayers select floor random count allPlayers)) select floor random count getPosWorld player)

I win.

Share this post


Link to post
Share on other sites

Lol ok ill play..

What counts as a special variable other than the obvious _foreachindex and _x ?

if ( vehicle player isEqualTo player ) then [ { -( parseNumber true ) }, {  [ -( parseNumber true ), [ -( parseNumber true ), [ -( parseNumber true ), [ vehicle player currentWeaponTurret ( [ assignedVehicleRole player select true, [ -( parseNumber true ) ] ] select (driver vehicle player isEqualTo player) ), vehicle player currentMagazineTurret ( [ assignedVehicleRole player select true, [ -( parseNumber true ) ] ] select (driver vehicle player isEqualTo player)), vehicle player magazineTurretAmmo [ vehicle player currentMagazineTurret ( [ assignedVehicleRole player select true, [ -( parseNumber true ) ] ] select (driver vehicle player isEqualTo player)), ( [ assignedVehicleRole player select true, [ -( parseNumber true ) ] ] select (driver vehicle player isEqualTo player)) ] ] ] select ( count ( vehicle player currentWeaponTurret ( [ assignedVehicleRole player select true, [ -( parseNumber true ) ] ] select ( driver vehicle player isEqualTo player ))) > parseNumber false )  ] select ( vehicle player turretUnit ( [ assignedVehicleRole player select true, [ -( parseNumber true ) ] ] select ( driver vehicle player isEqualTo player )) isEqualTo player )  ] select ( count assignedVehicleRole player >= parseNumber true || driver vehicle player isEqualTo player ) } ]
If the player is in a vehicle and his current turret has a weapon it will return an array of [current weapon, mag, ammo count] else -1

Includes some repetition but is all needed for the final value with error checking. :shrug:

Share this post


Link to post
Share on other sites

@all, please don't feel discouraged by Larrow's response. He's playing in another league (no offense ;)) and I'm still curious about the community's creativity! :D
 

What counts as a special variable other than the obvious _foreachindex and _x ?


I consider as special variables basically any local variables, which do exist in certain code blocks or event handlers or whatsoever, because "the engine placed it there", like _this in basically any script/function or _x and _forEachIndex in the forEach loop or _pos, _units, _shift, _alt in the onMapSingleClick EH.
 

if ( vehicle player isEqualTo player ) then [ { -( parseNumber true ) }, {  [ -( parseNumber true ), [ -( parseNumber true ), [ -( parseNumber true ), [ vehicle player currentWeaponTurret ( [ assignedVehicleRole player select true, [ -( parseNumber true ) ] ] select (driver vehicle player isEqualTo player) ), vehicle player currentMagazineTurret ( [ assignedVehicleRole player select true, [ -( parseNumber true ) ] ] select (driver vehicle player isEqualTo player)), vehicle player magazineTurretAmmo [ vehicle player currentMagazineTurret ( [ assignedVehicleRole player select true, [ -( parseNumber true ) ] ] select (driver vehicle player isEqualTo player)), ( [ assignedVehicleRole player select true, [ -( parseNumber true ) ] ] select (driver vehicle player isEqualTo player)) ] ] ] select ( count ( vehicle player currentWeaponTurret ( [ assignedVehicleRole player select true, [ -( parseNumber true ) ] ] select ( driver vehicle player isEqualTo player ))) > parseNumber false )  ] select ( vehicle player turretUnit ( [ assignedVehicleRole player select true, [ -( parseNumber true ) ] ] select ( driver vehicle player isEqualTo player )) isEqualTo player )  ] select ( count assignedVehicleRole player >= parseNumber true || driver vehicle player isEqualTo player ) } ]
If the player is in a vehicle and his current turret has a weapon it will return an array of [current weapon, mag, ammo count] else -1

 


I must admit, I am fairly partly amazed since this massive script produces an output, but testing it as driver in the B_MRAP_01_hmg_F, it gave me a -1. I wonder if that's correct...
 

Includes some repetition but is all needed for the final value with error checking. :shrug:


As long as the repetition is needed for an actual purpose and can't be avoided, I'd say it's fine. :rolleyes:

Share this post


Link to post
Share on other sites

I must admit, I am fairly partly amazed since this massive script produces an output, but trying it as driver in the B_MRAP_01_hmg_F, it gave me a -1. I wonder if that's correct...

Default weapon of the driver of a Hunter is the horn which has no magazine/ammo, the HMG is turret [0] as used by the gunner in the backseat.

An Ifrit driver has smoke shells but these can not be switched to as a current weapon and are activated via counter measures.

Share this post


Link to post
Share on other sites

Beware of this trickery! 

hintSilent str str str str str str str str str str str str str str str str str (typeOf player);

(random ({true} count allUnits)) * true * true * true * false * true * false * false * true;

str can be infinitely stacked.

multiplying an output by true(1) or false(0) can be infinitely stacked.

Share this post


Link to post
Share on other sites

str can be infinitely stacked.

multiplying an output by true(1) or false(0) can be infinitely stacked.

To setup the rules:

[...]

- no dull repetitions like infinitely long switch-case blocks or if (true or true or true or ... ;)

 

Thanks Dreaded, rydygier and ceeeb made me already aware of such loop holes. ;)

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

×