Jump to content

Search the Community

Showing results for tags 'whitespace'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • BOHEMIA INTERACTIVE
    • BOHEMIA INTERACTIVE - NEWS
    • BOHEMIA INTERACTIVE - JOBS
    • BOHEMIA INTERACTIVE - GENERAL
  • FEATURED GAMES
    • Arma Reforger
    • Vigor
    • DAYZ
    • ARMA 3
    • ARMA 2
    • YLANDS
  • MOBILE GAMES
    • ARMA MOBILE OPS
    • MINIDAYZ
    • ARMA TACTICS
    • ARMA 2 FIRING RANGE
  • BI MILITARY GAMES FORUMS
  • BOHEMIA INCUBATOR
    • PROJECT LUCIE
  • OTHER BOHEMIA GAMES
    • ARGO
    • TAKE ON MARS
    • TAKE ON HELICOPTERS
    • CARRIER COMMAND: GAEA MISSION
    • ARMA: ARMED ASSAULT / COMBAT OPERATIONS
    • ARMA: COLD WAR ASSAULT / OPERATION FLASHPOINT
    • IRON FRONT: LIBERATION 1944
    • BACK CATALOGUE
  • OFFTOPIC
    • OFFTOPIC
  • Die Hard OFP Lovers' Club's Topics
  • ArmA Toolmakers's Releases
  • ArmA Toolmakers's General
  • Japan in Arma's Topics
  • Arma 3 Photography Club's Discussions
  • The Order Of the Wolfs- Unit's Topics
  • 4th Infantry Brigade's Recruitment
  • 11th Marine Expeditionary Unit OFFICIAL | 11th MEU(SOC)'s 11th MEU(SOC) Recruitment Status - OPEN
  • Legion latina semper fi's New Server Legion latina next wick
  • Legion latina semper fi's https://www.facebook.com/groups/legionlatinasemperfidelis/
  • Legion latina semper fi's Server VPN LEGION LATINA SEMPER FI
  • Team Nederland's Welkom bij ons club
  • Team Nederland's Facebook
  • [H.S.O.] Hellenic Special Operations's Infos
  • BI Forum Ravage Club's Forum Topics
  • Exilemod (Unofficial)'s General Discussion
  • Exilemod (Unofficial)'s Scripts
  • Exilemod (Unofficial)'s Addons
  • Exilemod (Unofficial)'s Problems & Bugs
  • Exilemod (Unofficial)'s Exilemod Tweaks
  • Exilemod (Unofficial)'s Promotion
  • Exilemod (Unofficial)'s Maps - Mission Files
  • TKO's Weferlingen
  • TKO's Green Sea
  • TKO's Rules
  • TKO's Changelog
  • TKO's Help
  • TKO's What we Need
  • TKO's Cam Lao Nam
  • MSOF A3 Wasteland's Server Game Play Features
  • MSOF A3 Wasteland's Problems & Bugs
  • MSOF A3 Wasteland's Maps in Rotation
  • SOS GAMING's Server
  • SOS GAMING's News on Server
  • SOS GAMING's Regeln / Rules
  • SOS GAMING's Ghost-Town-Team
  • SOS GAMING's Steuerung / Keys
  • SOS GAMING's Div. Infos
  • SOS GAMING's Small Talk
  • NAMC's Topics
  • NTC's New Members
  • NTC's Enlisted Members
  • The STATE's Topics
  • CREATEANDGENERATION's Intoduction
  • CREATEANDGENERATION's HAVEN EMPIRE (NEW CREATORS COMMUNITY)
  • HavenEmpire Gaming community's HavenEmpire Gaming community
  • Polska_Rodzina's Polska_Rodzina-ARGO
  • Carrier command tips and tricks's Tips and tricks
  • Carrier command tips and tricks's Talk about carrier command
  • ItzChaos's Community's Socials
  • Photography club of Arma 3's Epic photos
  • Photography club of Arma 3's Team pics
  • Photography club of Arma 3's Vehicle pics
  • Photography club of Arma 3's Other
  • Spartan Gamers DayZ's Baneados del Servidor
  • Warriors Waging War's Vigor
  • Tales of the Republic's Republic News
  • Operazioni Arma Italia's CHI SIAMO
  • [GER] HUSKY-GAMING.CC / Roleplay at its best!'s Starte deine Reise noch heute!
  • empire brotherhood occult +2349082603448's empire money +2349082603448
  • NET88's Twitter
  • Mercurious Brotherhood +2347063372861's +2347063372861>> I WANT TO JOIN OCCULT FOR MONEY RITUAL
  • 123betcasino01's Topics

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Yahoo


Jabber (xmpp)


Skype


Biography


Twitter


Google+


Youtube


Vimeo


Xfire


Steam url id


Raptr


MySpace


Linkedin


Tumblr


Flickr


XBOX Live


PlayStation PSN


Origin


PlayFire


SoundCloud


Pinterest


Reddit


Twitch.Tv


Ustream.Tv


Duxter


Instagram


Location


Interests


Interests


Occupation

Found 1 result

  1. Preamble: From the wiki, we can use splitstring and joinstring to remove white space from code. So if we have a function like this one (from the wiki): fnc_deleteTestObj = { _this addMPEventHandler ["MPKilled", { _this = _this select 0; { deleteVehicle _x; } forEach (_this getVariable ["effects", []]); if (isServer) then { deleteVehicle _this; }; }]; _this setDamage 1; }; We can do: copyToClipboard(([fnc_deleteTestObj] joinString "") splitString toString [9,13,10] joinString "") and it returns: { _this addMPEventHandler ["MPKilled", { _this = _this select 0; { deleteVehicle _x; } forEach (_this getVariable ["effects", []]); if (isServer) then { deleteVehicle _this; }; }]; _this setDamage 1; } Which is quite nice. But I wanted a way to remove as much white space as I can (for sending code/variables over the network etc), plus I just fancied playing about with recursion. So with this function, we can use our "fnc_deleteTestObj" function again and plug it in: copyToClipboard(([fnc_deleteTestObj] joinString "") call fnc_whitespace) This returns: {_this addMPEventHandler["MPKilled",{_this=_this select 0;{deleteVehicle _x;}forEach(_this getVariable["effects",[]]);if(isServer)then{deleteVehicle _this;};}];_this setDamage 1;} I'm using joinstring in these examples as opposed to format as it doesn't have the 8k limit. Apparently formatText isn't limited and I'm not sure about str. But you could do this I suppose - just be aware it might have a limit: (str fnc_deleteTestObj) call fnc_whitespace Uses As mentioned, you could shorten variables prior to sending them over the network (then compileFinal at other end). I'm aware that programs like these exist already, but I wanted to do it in sqf (like within the engine). It should be ok but will have a problem if you do silly things like putting spaces into variables ex: player setVariable ["there are spaces in this",true]; which is a bit of a no-no imo and bad practice. You could probably obfuscate your code with this if you want but there are already good online obfuscators available anyway, and also good online de-obfuscators, like this one: http://unminify.com/ I think Dwarden said he used to do this to his mission files to make them smaller so they wouldn't suck up as much bandwidth, so theres a use for it there I suppose. Obv, I haven't tested this much but it seems ok so far - ymmv. Be aware if you use it on very large functions, then it is recursive so it might freeze your game for a few seconds. If you rename it, make sure you rename the call to it in the code as well or you will break it. Function: Here it is for any interested: fnc_whitespace = { private _noWhitespace = toArray(_this); private _anyWS = false; { if (0 isEqualType _x) then { if ([9,13,10] find _x > -1) then { _noWhitespace set [_forEachIndex,objNull]; _anyWS = true; } else { if ([34,39,94,42,40,41,123,125,91,93,59,58,62,47,43,45,61,46] find _x > -1) then { if (_forEachIndex - 1 > -1) then { if ([32,9,13,10] find (_noWhitespace select (_forEachIndex - 1)) > -1) then { _noWhitespace set [_forEachIndex - 1,objNull]; _anyWS = true; } }; if (_forEachIndex + 1 < count _noWhitespace) then { if ([32,9,13,10] find (_noWhitespace select (_forEachIndex + 1)) > -1) then { _noWhitespace set [_forEachIndex + 1,objNull]; _anyWS = true; } }; } } }; } forEach _noWhitespace; _noWhitespace = _noWhitespace - [objNull]; if (_anyWS) then { _noWhitespace = (toString _noWhitespace) call fnc_whitespace; _noWhitespace = toArray _noWhitespace; }; toString(_noWhitespace) }; And here it is compacted (ho ho ho): fnc_whitespace={private _noWhitespace=toArray(_this);private _anyWS=false;{if(0 isEqualType _x)then{if([9,13,10]find _x>-1)then{_noWhitespace set[_forEachIndex,objNull];_anyWS=true;}else{if([34,39,94,42,40,41,123,125,91,93,59,58,62,47,43,45,61,46]find _x>-1)then{if(_forEachIndex-1>-1)then{if([32,9,13,10]find(_noWhitespace select(_forEachIndex-1))>-1)then{_noWhitespace set[_forEachIndex-1,objNull];_anyWS=true;}};if(_forEachIndex+1 < count _noWhitespace)then{if([32,9,13,10]find(_noWhitespace select(_forEachIndex+1))>-1)then{_noWhitespace set[_forEachIndex+1,objNull];_anyWS=true;}};}}};}forEach _noWhitespace;_noWhitespace=_noWhitespace-[objNull];if(_anyWS)then{_noWhitespace=(toString _noWhitespace)call fnc_whitespace;_noWhitespace=toArray _noWhitespace;};toString(_noWhitespace)} Credit to @dreadedentity for his initial code HERE Enjoy!
×