#arma3_scripting

1 messages ยท Page 372 of 1

austere granite
#

i thought they were just models and then animate

jade abyss
#

Nope, drawLine

#

with the BoundingBox Coords

little eagle
#

maybe

still forum
#

well.. you could take them.. and calculate what the corner points would be ^^

austere granite
#

but they show differently in NV and TI now

jade abyss
#

But that would be ReCreating them @still forum

#

@Adanteh#0761 drawLine(3d) or so

austere granite
#

... but why

rancid ruin
#

can you make a drawPenis command for drawing penises on the map please dedmen

still forum
#

.-.

austere granite
#

yes i know drawLine3D, but figured at least BIS would use a animated model

jade abyss
#

drawDickbutt

#

lol adanteh

#

We can't take out single Items from a Vehicle and you expect that? ๐Ÿ˜‚

austere granite
#

sec

#

... if my upload works

jade abyss
#

Without a "workaround"

austere granite
#

... which it doesnt

zenith totem
#

altF4

austere granite
#

WHAT IS THIS

little eagle
austere granite
#

Good bot

jade abyss
#

Bug ugly name for a bot

#

You rly think that works? Doubt it

austere granite
#

thats how some other mods do it

jade abyss
#

โค you too Commy

astral tendon
#

```[[_unit,"PRONE_INJURED", "ASIS"],BIS_fnc_ambientAnim ] remoteExec ["call"]````

jade abyss
#

Then ... why do you ask?

austere granite
#

BECAUSE I WANNA USE THESE ONES

#

๐Ÿ˜ฆ

astral tendon
#

the unit still loses the backpack with this

austere granite
#

Wanna know a protip

#

You dont need to pass THE ENTIRE function as an argument for "call"

#

instead you can do [_unit,"PRONE_INJURED", "ASIS"] remoteExecCall ["BIS_fnc_ambientAnim"]

zenith totem
#

^

#

Also, that BIS function is garbage anyway

rancid ruin
#

what about ambientPenises

#

can we at least get that

astral tendon
#

nop, still loses the back pack

zenith totem
#

What would that do, make enviromental gachi sounds?

rancid ruin
#

i don't know but i know we need it

little eagle
#

Agreed Dr Freud.

rancid ruin
#

i'm trying to help here

still forum
#

is bored and thinks of going to bed

little eagle
#

๐Ÿ›

rancid ruin
#

๐Ÿน ๐Ÿ’Š ๐Ÿ’Š ๐Ÿšฌ ๐Ÿฅ

jade abyss
#

@still forum mimimimimimimimimi

still forum
#

You guys now have 10 hours time to get new Ideas for SQF commands. Good night o7

jade abyss
still forum
#

I know that was coming before I clicked the link

jade abyss
#

also some โค

subtle ore
#

wtf

still forum
#

Why does your link get expanded but Dscha's not?

little eagle
#

httpS

still forum
#

Wow...

little eagle
#

Because I am based.

subtle ore
#

๐Ÿค”

#

based

little eagle
#

the best

subtle ore
#

Still is of question.

little eagle
#

But I just proofed it AGAIN? How much proof do you need?

subtle ore
#

proofed ๐Ÿค” Much more than proofed is needed.

little eagle
#

^^

jade abyss
#

No, i just added a < and > before the Link, so it doesn't spam the Channel with the previewPic ๐Ÿ˜‰

little eagle
#

lies

jade abyss
#

๐Ÿ˜‰

#

So, time to delete the spam

little eagle
#

You didn't have to tell them.

jade abyss
#

I am fwiendlรผ

subtle ore
#

Damn it Dscha

#

party crasher

little eagle
#

^^

jade abyss
#

dumdidum

#

@subtle ore

subtle ore
#

Classy

tough abyss
#

That is morally inappropriate...

jade abyss
#

Anyway, @still forum ClientSide Extension for Intercopter?

subtle ore
#

Morally...?

tough abyss
#

Dschas post

subtle ore
#

Yeah. But, Morally? Why?

astral tendon
#

Do players get a diferent variable when they are JIP?

#

sems like enableFatigue does not like JIP

#

even on a event handle

subtle ore
#

I wouldn't expect it to

#

because once you disconnect, it gets rid of any object variables set on the player

#

hence the point of DB's and data saving scripts

jade abyss
#

hm... if the Unit (that the player owned before) won't get deleted, after he disconnected it should still be there.

subtle ore
#

iirc it gets deleted anyways

jade abyss
#

Not sure, it's a while since i did anything in A3

astral tendon
#

so, how do i apply that to the new unit?

jade abyss
#

When they Spawn for example?

#

onPlayerConnect.sqf

#

init.sqf

#

many ways

subtle ore
#

EEEEK

#

initPlayerServer.sqf

#

local

#

server connect

jade abyss
#

initPlayerLocal.sqf

subtle ore
#

but.

#

but.

jade abyss
#

OnPlayerConnect EH (or what it was called)

subtle ore
#

EH would be removed on disconnect?

jade abyss
#

As i said: Many ways possible

astral tendon
#

what one works for jip?

jade abyss
#

Yeah, but doesn't matter if he hads that command to it

#

All of them

#

init = When an Object gets created/spawned

#

init = Initilization

#

Search the Terms above in Google e.g. "Arma 3 initPlayerServer"

astral tendon
#

this is my init.sqf

  player enableFatigue false; 
  player addEventhandler ["Respawn", {player enableFatigue false}]; 
};

if(!isMultiplayer) then 
{

{
if(! (isPlayer _x) ) then
{
 deleteVehicle _x;
};
} foreach switchableUnits;
0 fadeRadio 0;
enableRadio false;
enableSentences false;
};
if (isMultiplayer) then {deleteVehicle Team_1};
if (isMultiplayer) then {deleteVehicle Team_2};
if (isMultiplayer) then {deleteVehicle Team_3};
wp1 = compile preprocessFile "techbridge_1path.sqf";
wp2 = compile preprocessFile "techbridge_2path.sqf";
wp3 = compile preprocessFile "tech1path.sqf";
wp4 = compile preprocessFile "tech2path.sqf";
wp5 = compile preprocessFile "tech3path.sqf";
{_x enableFatigue false;} forEach playableUnits;````
#

still have it

jade abyss
#

Who wrote that?

astral tendon
#

the jip player still have that stamina bar

#

a guy with a stroke

subtle ore
#

ewwww...

jade abyss
#

Delete everything and learn scripting for yourself... that code above is a mess

#
if (isMultiplayer) then {deleteVehicle Team_1};
if (isMultiplayer) then {deleteVehicle Team_2};
if (isMultiplayer) then {deleteVehicle Team_3};```
wtf?
subtle ore
#

God, I think I've got a heart murmor going on here.

astral tendon
#

what is wrong?

jade abyss
#

Why 3x isMultiplayer ?

#

All in one If statement, done.

astral tendon
#

does not accept arrays

jade abyss
#

Hey, whats your name -> You answer -> Do A
Hey, whats your name -> You answer -> Do B
Hey, whats your name -> You answer -> Do C

#

Instead of:
Hey, whats your name -> You answer -> Do A,B,C

astral tendon
#

its atually is:
Hey is it MP? -> then delet A

#

what i tried
Hey is it MP? -> then delet A, B, C

#

what Arma says:
Hey man, i cant do that, i only accept one.

jade abyss
#

Friendly Tip: Learn the Basics first ( if()then{} is the basic of the basic )

subtle ore
#

๐Ÿคฆ

jade abyss
#

have you thought about: Putting the Code you execute in the 3 if's into on "if"?

#

Like:

if(blablub)then{DoThisTo Group1; DoThisTo Group2; DoThisTo Group3;};

?

#

(i am especially not starting with forEach atm)

subtle ore
#

Just tested that variable on player disconnect, looks like everything is saved specifically for each individual player slot (objects)

#

That's with the AI enabled to replace player upon disconnect

#

and it's set to persistant on server

astral tendon
#

no, never saw this example in Wiki

jade abyss
#

No clue, too long ago.

#

Then do it @astral tendon

subtle ore
#

So it could be just the AI inheriting the variables, since it technically doesn't belong to the player until they take over the unit correct?

jade abyss
#

Banana.

#

Yep, Banana.

subtle ore
#

Apple

#

Apple, Caramel. Caramel Apple.

jade abyss
#

Until Owner changes (gets possesed by a player)... hmm... yeah, could be true

astral tendon
#

well thanks, i will save this exemple

jade abyss
#

Still: Stick to basic stuff first, otherwise you won't get far (if, forEach, spawn, call, declaring Variables, etc)

subtle ore
#

With the AI disabled for the mission, it doesn't save EH, Variables, etc.

#

So yeah, I guess my previous statement applies

astral tendon
#

{_x enableSimulation true} forEach (crew thislist); what is the generic error?

subtle ore
#

crew of an array ๐Ÿ™„

astral tendon
#

that does not apply to every crew inside the array?

subtle ore
#

nope

astral tendon
#

what is the right way to put that?

warm hedge
#

What do you want? I can't get it

astral tendon
#

enable simulation to all the crew inside of the vehicle

warm hedge
#
    {
        bla bla bla
    } forEach (crew _x) ;
} forEach (thislist) ;```
#

maybe not tested at all

astral tendon
#

it worked, thanks

#
    { 
     _x enableSimulation true
    } forEach (crew _x) ; 
} forEach (thislist) ;```
astral tendon
#

is there a way to i have control over unit spawn on mission and only spawn once a code is given?

rancid ruin
#

to create a unit from code? yes of course

earnest ore
#
_cost = 0;
for [{private _i = 0}, {_i < count _struct}, {_i = _i + 1}] do {
    private _curSelect = _curEquips select _i;
    private _newSelect = _newEquips select _i;
    private _equipType = _struct select _i;
    
    if(typeName _equipType == "ARRAY") then {
        _cost = _cost + ([_newSelect, _equipType, true] call ZE_fnc_calcCosts);
    } else {
        if(_curSelect != _newSelect && _newSelect != "") then {
            //_cost = _cost + ([_newSelect, _equipType, false] call ZE_fnc_calcCosts);
        };
    };
};

if(zeDebug) then { systemChat format ["zeDebug (handleEquip): Final cost for new equipment is $%1", _cost] };

Is giving me an error stating that _cost is undefined on the final line. What the fuck?

little eagle
#

ZE_fnc_calcCosts probably reports nil.

distant egret
#

Keep getting Warning Message: Script functions\fn_createZues.sqf not found
even though its there...
I can even see it in the pbo...

    class JRab_test {
        author = "JasperRab";
        units[]={};
        weapons[]={};
        requiredVersion=0.1;
        requiredAddons[]={};
    };
};

class CfgFunctions {
    class JRab_test {
        class functions {
            file = "functions";
            class initZues {};
        };
    };
};```

any idea as to why it isn't working? Am I looking over something stupid?
little eagle
#

@distant egret is this a mod?

distant egret
#

Yea

little eagle
#

You need the full path for the file entry.

#

e.g. /JRab_est/functions

#

Dunno if it has PBOPREFIX or not,

distant egret
#

aw shit....

#

nope

jade abyss
#

\

little eagle
#

Backslash? Idk.

jade abyss
#

Yeah

little eagle
#

OK

jade abyss
#

I wasn't sure either, just checked my files ๐Ÿ˜„

little eagle
#

"test" is a brilliant component name btw.

distant egret
#

I was just testing xD

little eagle
#

๐Ÿ‘Œ

jade abyss
#

At least, it's a "unique" Tag!

little eagle
#

test
testing /o\ woaa

jade abyss
#

Not like: test_fnc_bla

#

*testinger <-!

still forum
#

@jade abyss what what what? You mean BE whitelist? Or what do you mean with "clientside extension"?

jade abyss
#

Yes

still forum
#

I just didn't try talking to BE guys.. Noone else did..
Someone needs to ask them I guess ยฏ_(ใƒ„)_/ยฏ

#

You would still need to get all plugins whitelisted too because they are seperate dll's

jade abyss
#

gl hf gg no re

still forum
#

huh?

#

I'm only rude to idiots

queen cargo
night void
#

IF {selection "weapon" OR "Launcher" OR "pistol" intersect _x Object} then {player playActionNow "LowWeaponDown"};

#

its Pseudocode who can make good sqf code for low or rise weapon when u staying close to objects likes walls or vehicles?!

little eagle
#

That is not pseudo code.

#
// loop
if weapon_raised && weapon_peeks_into_wall
    lower_weapon player

This is pseudo code and much more helpful.

lone glade
#

just for info, OR and AND are ugly alternatives to || and && but they work

night void
#

maybe im not coder ๐Ÿ˜ƒ

#

@little eagle can u write something likes this? i will make anims for it ๐Ÿ˜‰

lone glade
#

no need to, there's lowering weapon anims already

little eagle
#

Anyone can write this if they can figure out:

  • how to loop
  • how to check weapon_raised
  • how to check weapon_peeks_into_wall
  • how to lower_weapon player
#

There solutions for all of these steps and they're not hard.

night void
#

how rised izi, read state of current action and anim

night void
#

if peeks into wall, izi too, arma have funcs for it

#

type in Search -> Intersect

#

how to lower weapon - call animation action

little eagle
#

Don't get confused by the name. Names are lies.

night void
#

wat iz it?

little eagle
#

The lower_weapon player step.

austere granite
#

Does that still make you stand up if you use it when prone? ๐Ÿ˜„

#

i remember that used to be the case. Rather than going "Hey there is no weapon lower for prone, so i'll just do nothing" it would make you stand up, then lower the weapon

little eagle
#

Well, you can't lower your weapon when prone, so probably.

#

It's the same when you hit the lower weapon key while prone. You'll kneel iirc.

hidden field
#

@little eagle oh man and i just thought i found a nice action to put a weapon away... okay i have but its "Switchweapon" and muzzle index -1 ^^"

austere granite
#

that's what you want nesias

#

'proper' way to do it

night void
#

i can make anims for PRONE stance!

little eagle
#

The WeaponOnBack name is really stupid.

hidden field
#

yeah ^^ good to now that there is that way, btw "WeaponOnBack/InHand" will not make you stand up, just checked ^^

little eagle
#

Cool.

hidden field
#

atleast for perf/prof branch

little eagle
#

I remember that it used to make you do a weird swimming animation when using it while walking or something like that.

night void
#

i can make any anims, just need a coder who can write smart sqf

hidden field
#

yeah using "switchweapon" and moving is a bit odd

timber ridge
#

is it possible to programatically force AI to shoot a GL grenade through a selected window of a house?

#

or maybe it'd be easier to simulate the firing, just spawning a GL grenade explosion inside the house near the selected window and playing the respective sound of the shell fired before that?

#

also, simulating the breaking of the window, playSound3D most likely too.

hidden field
#

it should not be imposible

#

biggest problem should be getting him to aim at that window

timber ridge
#

I know Command & Conquer mod has done it, you can order AIs to nade a house, not sure if they can shoot through a window accurately

earnest ore
#

Can the virtual arsenal GUI be modified?

lone glade
#

yes and no, I preferred rewriting it

earnest ore
#

I'm guessing it was an arcane mess to deal with

lone glade
#

nope, took me 2 weeks but it's nearly done, thanks to dedmen optimization it's also a shitload faster

simple solstice
#

@lone glade are you going to release it?

#

or is it just for ACE

lone glade
#

ACE

austere granite
#

@meager granite if i remember correctly at one time you were looking at a setPosLocal type function, any luck with that?

#

Or anyone else for that matter

meager granite
#

It can only be done through hacky approaches

#

Create local entity, attach remote entity to it and by moving local vehicle you will move remote entity without sending any updates over the network

austere granite
#

i'm fine with that

meager granite
#

attach would not be sent over network too as one of the vehicles is not global

austere granite
#

If you then detach it would the position update, or would i have to detach, then call a normal setPos?

meager granite
#

it would revert to whatever is received from the server

austere granite
#

so getpos, detach, update pos to the getpos var and it would work okay?

#

basically i wanna have local moving, then "commit" it

meager granite
#

you wil need to do setPos right after detach so it would update it everywhere

austere granite
#

yep got it. Nice, thanks ๐Ÿ˜ƒ

#

on that, what is the most reliable way to attach an object, but keeping it in the same location? I remermber in the past i had some problems there with the height coordinate being different (middle of bounding? waves.. whatever it was)

meager granite
#

Try setPosWorld getPosWorld and then attach?

#

Probably depends on object you're attaching to

#

Just do a test, it should be easy to figure out

astral tendon
#

how many AIs are recomended to rum a good FPS coop mission

austere granite
#

9001

astral tendon
#

can i run it at 60 fps?

nocturne basalt
#

Hi guys. what method should I use for measuring the distance from object to the ground?

#

altitude

still forum
#

getPosATL select 2

nocturne basalt
#

thanks

austere granite
#

you can use getPos if you wanna include buildings and so too

astral tendon
#

That show/ hide module looks great

#

is there any down sight o warning to use that?

hollow lantern
#

someone using Sublime Text 3 here? How can I reformat my code for SQF?

lone glade
#

there's 3 you absolutely need, armabuild, sqf language, openLastRPT

#

use package control, those are the exact names

hollow lantern
#

check thanks

still forum
#

Anyone have some other containerType I could implement in Intercept?
hashMap is already done

hollow lantern
#

@lone glade I got them all now. Any advice? Not sure if there is something like a code reformatting available

lone glade
#

don't think so, but sublime is quite powerful

#

should be fairly easy if you've mastered some shortcuts and multiline selections

little eagle
#

Yesterday you complained about discord and now you're here.

lone glade
#

was a bit curious after all this time, it's a lot less worse now

little eagle
#

"less worse" ๐Ÿค” like... "better"?

lone glade
#

doesn't have blob emojis, still worse than slack

#

? never left

#

i've been clinging to the ace slack tho ๐Ÿ˜„

#

that's because i've been on the ACE3 slack all this time

little eagle
#

Google emoji > Apple emoji

#

therefore:
Slack > discord

#

q.e.d.

lone glade
#

blob emojis best emojis

little eagle
#

The turtle โค

tame portal
#

๐Ÿ

tough abyss
#

@little eagle - what are you talking about!? The Discord emojis are great.

little eagle
#

But have you seen the google emoji and especially the google turtle?

tough abyss
#

If you want to see bad emojis look at Samsung's.

little eagle
subtle ore
#

๐Ÿค”

little eagle
#

๐Ÿข The Apple emoji is not anywhere as cute.

lone glade
#

even the big smile google emoji is cute as fuck

little eagle
#

When do we get Arma emoji support?

tough abyss
#

@lavish ocean - please ๐Ÿ™

little eagle
#

emoji variable names
o_O

tough abyss
#

In Czech.

little eagle
#

usti hlavne

digital hollow
#

It'll be flashlight in mouth and shadow puppets with hands animation.

tough abyss
#

A3_ลฝelva_F

still forum
#

Arma has Emoji support already

#

scripts are UTF-8

#

as long as your script editor has emoji support you can use emoji variable names

lone glade
#

use IME chars for your vars for maximum troll

tough abyss
#

GVAR(๐Ÿคข)

lone glade
#

GVAR ain't vanilla :p

#

if only....

little eagle
#

A3_ ๐Ÿ– ๐Ÿ’จ _F

still forum
#

My debugger can inject macros into the preprocessor

#

basically global macros that are available everywhere without #include

peak plover
#

utf-8
I can use รตรผรครถ

tough abyss
#

Pretty sure GVAR() is a result of a bunch of #defines.

peak plover
#

I'll make all my scripts with รตรผรถรค from now on!

#

That way no one can steal them

little eagle
#

รฎ

#

รข

#

รช

peak plover
#

รค
รถ

little eagle
#

ยต

peak plover
#

scripting in arabic when

tough abyss
#

ืื—ื™ = vehicle player

lone glade
#

yes GVAR and EGVAR are results of defines, but god fucking damn it if they aren't incredibly useful

little eagle
#

There are enough Chinese characters to convert every variable in ACE into a one character variable name.

tough abyss
#

Haha.

#

That's amazing.

still forum
#

Wasn't there that guy that claimed shorter variable names make scripts faster?

#

one character variable names everywhere

peak plover
#

call xxx_fnc_gasAttack

still forum
#

no

#

That's too opec style

tough abyss
#

@still forum -X?

peak plover
#

Lmao, he works fast 'tho

still forum
#

and you are supposed to use ofpec tags not opec tags

peak plover
#

๐Ÿ˜‚

#

I'm pretty sure I've met him in arma 2 about 5 years ago

little eagle
#

Took me a few minutes to get this.

peak plover
#

The world sure is small...

little eagle
#

๐Ÿคฆ

tough abyss
#

More like ๐Ÿ‡ธ๐Ÿ‡พ_fnc_gasAttack.

peak plover
#

can we use : in variable names?

#

Or does : have any special functionality?

lone glade
#

separator for switch cases

little eagle
#

a-z, 0-9, _
can't start with number

still forum
#

yes.. : is a script command

little eagle
#

Classnames are the same, but can start with a number :/

still forum
#

so no you can't use that

peak plover
#

๐Ÿ˜ฆ

rotund cypress
#

Hey guys, is there any easy way to get the middle of a object?

#

I was looking at the command modelToWorld

still forum
#

0 is generally middle

#

either that or feet

peak plover
#

btw ofpec. I've seen ofpec around and been on the site like twice, but does it have any value to scripting ?

rotund cypress
#

I would assume it's the feet

still forum
#

bonding box. half hight

rotund cypress
#

_obj modelToWorld [0, 0, 0] would give me the feet I assume

lone glade
#

yep, get the center of boundingBoxReal

little eagle
#

Add the bottom left front edge of the bounding box to the top right back edge and divide by 2?

rotund cypress
#

Could do

tough abyss
#

Trigonometry!

rotund cypress
#

Always fun ๐Ÿค• ๐Ÿ”ซ

lone glade
#

actually I think there's already some code I use from arsenal

#
private _centerBox = boundingboxreal GVAR(center);
    private _centerSizeBottom = _centerBox select 0 select 2;
    private _centerSizeUp = _centerBox select 1 select 2;
    private _centerSize = sqrt ([_centerBox select 0 select 0,_centerBox select 0 select 1] distance [_centerBox select 1 select 0,_centerBox select 1 select 1]);
indigo snow
#

ah, but what then if the object is aligned with a slope?

little eagle
#

No one complains about trigonometry here if you haven't suffered through 3 years of crystallography.

indigo snow
#

crystallography is the fun part

tough abyss
#

Trigonometry was the best subject in HS ๐Ÿ˜›

rotund cypress
#

@lone glade GVAR(center)? ๐Ÿค”

#

I guess I could just do this though objNull modelToWorld (boundingCenter objNull)

little eagle
#

What.

rotund cypress
#

What?

still forum
#

What

little eagle
#

objNull ?!

rotund cypress
#

Would replace of course

#

With my obj

#

Was just to show ๐Ÿ˜‰

lone glade
#

GVAR(center) is the var I use for the center of the camera

#

cough arsenal actually

rotund cypress
#

I knew GVAR was some CBA3 macro, but don't know what it does

still forum
#

GVAR(x) -> ace_arsenal_x

#

tag+varname

rotund cypress
#

Hmm

#

Fair nuff

little eagle
#

Why do you use distance and not vectorDiff? distance uses AGL and will report slightly off distances if the terrain around [0,0,0] is rough.

lone glade
#

eeeeh, lifted straight from arsenal

still forum
#

BI ยฏ_(ใƒ„)_/ยฏ

lone glade
#

it's the only thing I straight up took from it, didn't want to figure how to move smoothly the camera and BIS seems to have found a good way ๐Ÿ˜„

little eagle
#

Oh, it's 2D actually. You need distance2D I think? Never tested if that ignores Z or if it converts to AGL z=0 too.

#

But you can just add z=0 I guess.

rotund cypress
#

THis does not seem to work private _position = _object modelToWorld (boundingCenter _object); drawIcon3D [ "", [1, 1, 1, 1], _position, 1, 1, 0, "Test", 1, 0.2, "PuristaMedium", "center", false ];

#

Any ideas?

#

No errors, but it does not show up any text

little eagle
#
boundingCenter

Is a command?!

#

Apparently it is.

rotund cypress
#

It is

#

Actually got it to work now

#

Weird... ๐Ÿ˜‰

little eagle
#

Yep, red highlighting.

rotund cypress
#

What? ๐Ÿคฃ

little eagle
#

I used the command in the discord sqf syntax code box and it was drawn red. Therefore it is a command.

#

Too lazy to open the wiki.

rotund cypress
#

Ah

#

Wait, so Discord staff goes through the commands and adds them to Discord? ๐Ÿ˜‚

little eagle
#
setPosASL
setPosASL2
setPosASL3
#

oops.

rotund cypress
#

Is that a bot doing that or Discord itself?

little eagle
#

Dunno where discord gets the command list from. But it's a discord thing to support code highlighting. The only thing mission from Slack...

#

Might've also been from Linguist and therefore what Flummi and I PR'd 3 years ago. Maybe it's different. No idea.

rotund cypress
#

๐Ÿค”

little eagle
rotund cypress
#

Ah alright

#

So you think that Discord might be running of this?

#

For their commands list

little eagle
#

I don't know why else they would support a niche language like SQF.

rotund cypress
#

^

slender halo
#

discord uses highlight.js

#

but i doubt it's compiled with all languages

indigo snow
#

haha the highlight.js sqf snippet...

/***
    Arma Scripting File
    Edition: 1.66
***/

// Enable eating to improve health.
_unit addAction ["Eat Energy Bar", {
    if (_this getVariable ["EB_NumActivation", 0] > 0) then {
        _this setDamage (0 max (damage _this - 0.25));
    } else {
        hint "You have eaten it all";
    };
    // 4 - means something...
    Z_obj_vip = nil;
    [_boat, ["Black", 1], true] call BIS_fnc_initVehicle;
}];
slender halo
#

yep, i contributed to this ^^

still forum
#

4 means something!

indigo snow
#

poor _boat never gets defined

slender halo
#

i wrote the regex for functions so i just added random code with function in the middle of already existing code

still forum
#

neat... the example is a piece of broken code

little eagle
#

_boat is undefined. This is bugged.

still forum
#

_this is not object right?

indigo snow
#

functions regex looks for _fnc_ or the BIS_ prefix?

little eagle
#

Pretty sure that _this is an array in the statement of addAction.

#

So this code will just error out when you use the action.

slender halo
#

its just here to show highlight

indigo snow
#

as is customary

#

look at the channel description after all ๐Ÿ˜„

little eagle
#

But this is the channel where we complain about code posted.

indigo snow
#

cool!

little eagle
#
CBA_fnc_addClassEventHandler

It works with any tag and with misspelled functions...

peak plover
#

?

#

Elaborate?

indigo snow
#

I always choose my function names to be misspelled BIS variants so this suits me

little eagle
#

nigel, anything with x_fnc_y will be highlighted blue.

lone glade
#

x_fnc_y

#

ah!

peak plover
#

oooh, didn't know, that's cool

little eagle
#
x_fnc_y
#

hmm

lone glade
#

huehuehue ๐Ÿ˜„

little eagle
#
1x2_fnc_y
#

It needs a two char tag at least for whatever reason.

indigo snow
#

but it does check the first char isnt a number

little eagle
#

Nah. But it would error in the game.

astral tendon
#

deleteGroupWhenEmpty does something to perfomacy or noting at all?

peak plover
#

That's a negatory, sir

#

I've yet to see performance loss from high amounts of groups

#

That being said, having every unit in a separate group is still bad

#

Aparently it means they have 2 brains

little eagle
#

deleteGroupWhenEmpty does something to perfomacy or noting at all?
Nothing noticable.

indigo snow
#

ah but commy look that first char is a different colour

#

so that a different bug, its considering the function name to start with x

#

and the green 1 means it thinks its a value iirc

little eagle
#

You're right. I had to zoom a lot to make out the difference between these two. Am I color blind?

indigo snow
#

you might be slightly, dark greens and dark blues is a common one

#

i have it with dark blues and black

#

guess its more of a teal than a green, too

lone glade
#

1 is teal, the other is normal blue

#

it could also be a badly calibrated monitor ๐Ÿ˜„

tough abyss
#

@astral tendon deleteGroupWhenEmpty is very handy command for having the engine delete groups.
Instead of having sqf code delete groups, were you got to
worry about deleting a group that you might not have added units to yet etc

But nothing really todo with performance

lone glade
#

I remember 2 years ago the engine did it by itself

#

but then someone broke it, then never fixed it....

tough abyss
#

Having a flag to say you can delete this group when empty is alot better imo. Makes it easier to reuse groups & not worry if engine deleted

slender halo
#

missing cases ?

little eagle
#

Well, _fnc_addClassEventHandler should be a local variable.

astral tendon
#

Thanks for the info

slender halo
#

yep, it'll pass variable regexp un guess

#

this one is for functions

#
_fnc_addClassEventHandler
#

yep, variable spotted ๐Ÿ˜ƒ

little eagle
#

Is _fnc_blah considered a local function? Do we have that convention? It's what I do all the time.

indigo snow
#

i tend to either use that or _fn_temp to more clearly mark it as not a "real function"

little eagle
#

How is it not a real function?

indigo snow
#

it being a local one

#

its much like pinocchio not being a real boy

slender halo
#

^^

little eagle
#

Everyone's against Hungarian notation, but somehow I ended up naming variables _ctrlButton, _dlgMenu and _fnc_something.

#

its much like pinocchio not being a real boy
But it ended with the puppet becoming a real boy iirc (never seen / read it myself).

indigo snow
#

some of my temp local functions end as proper ones when im done scripting

#

its all very symbolical

#

hungarian notation makes sense for certain edge types to be honest

#

_buildingsArray might as well be _buildings

#

but then you might want the number of buildings too and everything gets confused

lone glade
#

are you going through my PRs by any chances nick? ๐Ÿ˜„

still forum
#

German.

slender halo
#

is there a command to get childrens of a RscControlsGroup ?

still forum
#

configClasses

slender halo
#

to get dynamically created childrens ?

lone glade
#

no idc, no manipulation

astral tendon
#

disableAI "AUTOCOMBAT"; seens good to force AI squad mates to keep following you and obey orders, is there any warning i should get?

still forum
#

why would you get a warning?

astral tendon
#

like, that may broke something latter?

still forum
#

well.. you disable autocombat

#

so.. autocombat will be disabled

#

If you expect autocombat to be enabled. Then it will be "broken"

astral tendon
#

Well, works for me.

little eagle
#

AGLToASL not ATLToASL

still forum
#

why u no fix?

little eagle
#

Don't have the login for the next few days and will likely just forget.

still forum
#

fixed

little eagle
#

thx

#

โค

#

Actually it's fine on roofs, but not the carrier and generally over water.

still forum
#

I hope your hair grows

little eagle
#

It does too much. Too lazy to shave.

astral tendon
#

the CfgRadio does take the VON volume settings or music?

#

In my next mission i want player be able to remove the custon music but be able to hear the dub

astral tendon
#

the one i am using right now is taking the effect slot

{
    sounds[] = {};
    class missionstart
    {
        // how the sound is referred to in the editor (e.g. trigger effects)
        name = "#MissionStart";
        // filename, volume, pitch, distance
        sound[] = {"dub\starting.ogg", 1, 1, 100};
        titles[] = {0,""};
    };
};```
#

its a radio chat, i tink it would be right if was on the radio or VON category

tough abyss
#

@still forum Is it worth me moving this to cfgFunctions.hpp ?

still forum
#

if you call more than once then yes

tough abyss
#

They're all functions

still forum
#

which you do

#

as you save into variable

#

so yes. definetly

#

Do you PR these changes to kp_liberation?

#

Else I will have to do it someday

tough abyss
#

Check this fuckery

#

No...

#

I don't.

still forum
#

Why?

tough abyss
#

Should I?

still forum
#

yes

#

Fix it for everyone instead of for yourself

#

Already talked to Wyqer he would like these changes

tough abyss
#

He would?

#

I can get started.

#

Wonder if he has a discord

still forum
#

he has

tough abyss
#

Yep found it.

still forum
#

With change to CfgFunctions the names of the function variables will probably change tho

#

so every usage has to be updated then

tough abyss
#

should I localize them to a single cfgFunctions.hpp?

#

I've experimented with more than 1 cfgFunctions.hpp

#

It made a bit of a mess...

still forum
#

yes

#

you can only have one per config

tough abyss
#

No what I did was this.

still forum
#

and missions only have one config

#

you can and should have multiple categories inside CfgFunctions

tough abyss
#
class  cfgFunctions = { #include "other funcs" 
                                #include "more funcs" };
still forum
#

not sure

tough abyss
#

I've done it.

#

It works.

still forum
#

don't think it's worth splitting up

tough abyss
#

But made a mess.

#

a single cfgFunctions.hpp would be seperated into proceedures

#

and functions anything called via spawn is a proceedure

#

anything that is "called"

#

is a function.

#

Thats how I seperate my code.

#

anything.
execVM'd
spawn'd
etc is a 'proceedure"
call
is a "function"

still forum
#

async vs sync

#

if you are in scheduled you can also call "procedure's"

tough abyss
#

Sure.

#

It will be higher though.

#

Don't even have to run it

#

paste it into the watch field

#

with count and format

#

This is modded version I am using so, it will probably have additional scripts

#

and running a listen server

#

so it will include both

#

"Active SQF Scripts: 154"

#

@tough abyss

hollow lantern
#

is there a smart way to check if a trigger is present on a mod map or visualize the trigger to see if its "there" ?

robust hollow
#

isNull trigger

rancid ruin
#

you can use markers. loop through all triggers, create marker for each, set size, set colour according to if the trigger is active, etc

tough abyss
#

@still forum sorry if im randomly tagging you, but i heard Intercept was faster than SQF is that correct (just the raw engine itself). Is there any overhead?

hollow lantern
#

okay well the thing is that I'm certainly sure that the terrain is the cause why my trigger isn't firing. I'm a blufor soldier in a car but it doesn't work... https://i.imgur.com/OJmpfwD.png

#

isNull gatetrigger returns false

#

hmmm

robust hollow
#

i thought thisList was a list of units who met the conditions, so thisList in the condition itself would be an empty array?

still forum
#

@tough abyss Intercept is raw C++ basically instead of SQF that is compiled into a intermediary binary

#

Intercept has overhead.. But it's far lower than SQF's overhead

#

performance improvement depends on what you are doing.. But one of my examples had a theoretically 4300x speedup

hollow lantern
#

if I just use {side (driver _x) == west} count thisList > 0 as condition the gate opens instantly hmmm

still forum
#

Are you sure "Aebian" variable is defined?

hollow lantern
#

its my player name so it should be

still forum
#

So it's the variable of the unit you are in?

hollow lantern
#

but even if not the gate should just open when there is a blufor driver in the trigger

still forum
#

no

#

because undefined variable is script error

hollow lantern
#

there is no undefined variable

still forum
#

"but even if not" is what you just said

#

if it is not defined. then it is undefined

hollow lantern
#

the condition has a or statement so even if the driver != Aebian the other condition which is side (driver _x) == west should apply

still forum
#

No

#

script error will abort the script and make it fail

hollow lantern
#

there is no script error

#

...

tough abyss
#

@still forum tyvm

still forum
#

Yes.. But you said "but even if not" if Aebian is not defined then it would be script error

#

and I can't explain why else it would fail

hollow lantern
#

I never said that its not defined

still forum
#

you said "if not it should still work"

#

that's wong. If not then it won't work

hollow lantern
#

I meant that the driver is not Aebian

still forum
#

Did you check in debug console if Aebian variable is defined?

hollow lantern
#

I did isNull Aebian says false

still forum
#

Also that script would fail if no one joined your slot and it doesn't exist.

#

isNull != isNil

#

but isNull should error if the var is nil

#

try || {(driver _x) == Aebian}}

#

encase your second condition in {}

hollow lantern
#

hmm now its open all the time even if I'm not in the trigger. I guess I need to refine the condition to just return true when there is truly a land vehicle on the trigger. maybe do something with count (thisList unitsBelowHeight 2) > 0; and so one

still forum
#

can't you set the trigger height?

hollow lantern
#

my goal is that the trigger only fires up when there is something from side WEST in it and drives a vehicle

nocturne basalt
#

@jade abyss this is the right place ^^

still forum
#

Then set Activation to West ?

#

and in condition check if driver _x != _x

jade abyss
#

@nocturne basalt Currently searching the files, not sure if i still have em

nocturne basalt
#

ok ty

subtle ore
#

any reason why selectionPosition wouldn't return a correct AGL position post to modelToWorld conversion?

#
[] spawn 
{
    waitUntil{!isNull (findDisplay 46)};
    onEachFrame
    {
        { 
            drawIcon3D["\a3\ui_f\data\gui\rsc\rscdisplaymain\menu_options_ca.paa",[1,1,1,1],(_x modelToWorldVisual(_x selectionPosition "spine")),1,1,0];
        }  forEach entities "";
    };
};
#

obviously not final product

still forum
#

You expect modelToWorldVisual to return AGL?

subtle ore
#

๐Ÿคฆ

still forum
#

Wiki actually says it returns AGL

subtle ore
#

Well it does

still forum
#

I'm confusing it with modelToWorldWorld

subtle ore
#

which is ASL

#

Anyways

still forum
#

how much is it off?

hollow lantern
subtle ore
#

It just floats underneath the player

jade abyss
still forum
#

@hollow lantern keep the count loop.

subtle ore
#

so this is torso? I'd say it's off by a shit ton. Not sure if I can check the distance or not

still forum
#

_x is undefined outside of count/forEach

subtle ore
#

Oh

nocturne basalt
#

@jade abyss thanks so much ^^ appreciate it

subtle ore
#

that makes sense

#

DUH

#

fucking hell, my brain tonight

jade abyss
#

hf with it

subtle ore
#

Oh wait a second

#

No that wouldn't make sense

#

because it's still following the unit

#

Wtf.

young current
#

@jade abyss May come in handy! Thanks man!

jade abyss
#

o7

nocturne basalt
#

@jade abyss btw, will it hover over water?

jade abyss
#

It checks for the Ground, so no

#

Or it will swim. No clue tbh

nocturne basalt
#

k

jade abyss
#

It's just a "Proof of concept"-Thingy

astral tendon
#

what is the right way to put custom voice acting in the game? like, i am using triggers to execute those sounds

jade abyss
#

So technicaly, it's possible to do SciFi HoverTanks with it ๐Ÿ˜„

nocturne basalt
#

^^ thats my aim

jade abyss
#

Just needs adjustments to Slopes etc, but... yeah, gl hf with ๐Ÿ˜„ I am done with Arma. No further scripting for me

nocturne basalt
#

so why are you in this channel if your done with it xD?

hollow lantern
#

@still forum oh wow thanks, that actually worked o7

jade abyss
#

Helping out other newbs ๐Ÿ˜„

#

Or ranting about Commys Macros, depends on my mood

nocturne basalt
#

๐Ÿ˜ƒ

still forum
#

@jade abyss #Intercept solves it all

jade abyss
#

Not the engine

subtle ore
#

Looks like selectionPosition returns [0,0,0] FYI

#

If a selection does not exist [0,0,0] is returned.

jade abyss
#

e.g.: The whole Geo-Stuff is a big mess. @still forum

#

and you know... the rest^^

still forum
#

Geometry!

#

Geology? Geogoloolology

subtle ore
#

๐Ÿค”

jade abyss
#

Geogoogly

#

Same for ModelToWorld Positions (since i just read it) in moving PhysX objects... big big mess...

subtle ore
#

cries in defeat

still forum
#

@earnest ore Don't hold back :X I'm curious what you're writing

jade abyss
#

btw. you guys do know, that MTW Positions change, when a Vehicle is moving? ^^

#

@subtle ore

subtle ore
#

Yeah, but this thing won't even return a modelToWorld position even if it's not. ๐Ÿ˜›

jade abyss
#

Then your Script sucks ass ๐Ÿ˜„

subtle ore
#

Hey, screw you man! ๐Ÿ˜›

earnest ore
#

@still forum I wrote my problem, then looked back at my code again, then looked at my mug of coffee and cried.

still forum
#

๐Ÿ˜„

jade abyss
#

Ain't tell the postman that he sucks, when he gave you the Warning about the false Tax-Payments, when you haven't done it properly ๐Ÿ˜„

subtle ore
#

Fair enoguh, but those tax payments don't show much even if I didn't do them correctly ๐Ÿ˜›

jade abyss
#

you sure it's correct?

#

Cause i was working with it before and... yeah, no prob at all ๐Ÿ˜„

#

(except for the moving positions)

subtle ore
#

Mind showing me a snippet?

jade abyss
#

What do you want?

subtle ore
#

Just anything, but I can't seem to get it working in any case. a correct modelToWorld position

#

keeps returning [0,0,0] in every case

jade abyss
#

Yeah... what are you doing?

#

What do you try to achieve?

subtle ore
#

do I need to filter for a certain LODName?

[] spawn 
{
    waitUntil{!isNull (findDisplay 46)};
    onEachFrame
    {
        { 
            drawIcon3D["\a3\ui_f\data\gui\rsc\rscdisplaymain\menu_options_ca.paa",[1,1,1,1],(_x modelToWorldVisual(_x selectionPosition "spine")),1,1,0];
        }     forEach entities "";
    };
};

icon on the spine

jade abyss
#

Does spine exist?

#

Is there a MemoryPoint for it?

subtle ore
#

Yep.

jade abyss
#
  • "_xmodelToWorldVisual" doesn't seem correct
subtle ore
#

๐Ÿคฆ

#

discord is a bitch

#

there you go.

jade abyss
#

yeaaaahhhh, Discord ๐Ÿ˜‰

subtle ore
#

๐Ÿคฃ

jade abyss
#

+Why MTWVisual?

subtle ore
#

Terrible lag behind when drawing the icon, but even then it still didn't work lol

#

Because it was following the player

#

just not at the spine

#

which is, terribly. Weird.

jade abyss
#

Example for a Veh

_inModelPos = (_Tgt modelToWorld (_Tgt selectionPosition [_MemPoint,"Memory"]));
player setDir (player getDir _inModelPos);```
subtle ore
#

Would t hat LODName apply for units as well?

jade abyss
#

Why shouldn't it?

subtle ore
#

Never worked with them ๐Ÿคท

jade abyss
subtle ore
#

Essentially

jade abyss
#

Get the HitPoints

astral tendon
#

JIP playes hear all the triggers sounds that played before once they spawn, is there a way to fix that?

jade abyss
#

Use the hitPoints to get the Coords

#
_Dist = _CursPos distance (ATLToASL (_Tgt modelToWorld (_Tgt selectionPosition [_SelectionName,"HitPoints"])));```
subtle ore
#

Alrighty, well. Damn. I am still unsure why that didn't work.

jade abyss
#
Dscha - Today at 3:40 AM
Helping out other newbs :smile:```
Thats why i am still here ๐Ÿ˜‚
subtle ore
#

Hahahah ๐Ÿ˜‚

jade abyss
#
_inModelPos = (_CTarget modelToWorld (_CTarget selectionPosition [_SelectionName, "HitPoints"]));

drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\simpleTasks\types\heal_ca.paa", _Color, _inModelPos, 1, 1, 45, _Text , 2, 0.0325, "RobotoCondensed", "center", false];

For example

subtle ore
#

Gotcha, that makes sense.

jade abyss
#

Of course it does, i wrote it
๐Ÿ˜‚

#

(sry, had to)

subtle ore
#

Wow, show off ๐Ÿ˜‚

jade abyss
#

Yeah, a bit

#

^^

rancid ruin
#

why is that guy's Face hit point on his knee

jade abyss
#

HitPoint doesn't exist, so Coord [0,0,0]

earnest ore
#

Can someone with wiki access please modify the Array page so that it has in BIG BOLD FUCKING LETTERS that it is passed by reference?

meager granite
#

Implying anyone who doesn't know that, reads that page specifically and not just copies code involving arrays from examples of other commands

#

Is it me or lnbSetTextRight doesn't do anything?

#

lbSetTextRight is fine, lnb isn't, no matter what I try. Not fully implemented probably?

torn juniper
#

isn't it supposed to be invisible? ๐Ÿ˜›

meager granite
#

No it supposed to show text in the cell aligned to right

#

Like it does with normal ListBox

little eagle
#

spine1, spine2 and spine3 only afaik

queen cargo
#

@earnest ore better question is why you expected it to be value based

little eagle
#

The wiki should have a page about how SQF arrays work.

meager granite
#

Why does str adds double quotes inside strings? ๐Ÿค”

barren magnet
#

it was reworked some time ago to fix some issue with that afaik

#

Or maybe it was Torndeco / extdb who fixed it for databse writing, and this is still a bug in str

meager granite
#

Looks like format ["%1", is a way to avoid it

simple solstice
#

Since Arma 3 v1.63.137891 this command will correctly escape all " inside a string

little eagle
#

It doesn't add double quotes. It just escapes the quote marks now correctly.

peak plover
#

entitykilled stackable?

little eagle
#

It's addMissionEH, so yes.

peak plover
#

thanks

still forum
#

@earnest ore Everything in Arma is passed by reference

torn juniper
#

@meager granite lbsettextright does work and sets text to the right, InbSetTextRight if it were to work only sets invisible text on the right so you can still pull for data/scripts.. Basically a free variable on the object

tough abyss
#

SA mantra it was done so you could call compile the result. It also makes possible for extensions to parse the result properly when the quotations are escaped

meager granite
#

@torn juniper Yeah I was asking why lnb version didn't work while lb did

#

I guess displaying is not implemented yet or something

torn juniper
#

@meager granite It doesn't work as it doesn't display? Because all the lnb commands should all be invisible and only store data, if I read it all correctly. They shouldn't be visible at all. The only way you should be able to use them is pulling data not showing it

#

Thats why there is a visible and invisible version of each

#

Your statement confuses me is all, not sure if you are saying the command actually doesn't work or you just cant see it, if the second part then that is intended I am pretty sure ๐Ÿ˜„

meager granite
#

Well not displaying set text means that it doesn't work

#

As ListBox version does.

meager granite
#

@tough abyss Wish they made a separate command then, all my stuff ending up with extra quotes is annoying as hell

tough abyss
#

Was done a good while ago

meager granite
#

So how do you get a string of array with string inside array without double quotes then?

#

copyToClipboard format ["%1", [format ["%1", ["test"]]]];

#

=> ["[""test""]"]

lone glade
#

use single quotes

meager granite
#

_string = "test"; copyToClipboard format ["%1", [format ["%1", [_string]]]];

lone glade
#

also format stringify whatever you pass to it

meager granite
#

Try using single quotes there

queen cargo
#

Str is to get the string Variant of a value
Those double quotes are because the string needs to be escaped that way...
If you want an unescaped Variant, use regex or simply to array, remove duplicates, to string

#

Fun though of the day: implementing regex in sqf

lone glade
#

cough intercept

still forum
#

Don't steal my thoughts!

meager granite
#

Custom-written arma engine, no less

#

Just because somebody wanted to copy-paste their arrays for code compile

lone glade
#

but... why

queen cargo
#

No
Because str is not to wrap " around strings @meager granite

#

And a " in a string has to be displayed as "" in ALL representations to the user

meager granite
#

_string = "test"; copyToClipboard format ["%1", [format ["%1", [_string]]]];

#

Where is str there?

queen cargo
#

Told you how you can remove them with O(n) speed

#

Format is stringifying values

lone glade
#

format

queen cargo
#

Unless they are string

#

Do not get annoyed when the to string functions are stringifying strings

#

That is what they are supposed to do

meager granite
#

No, format isn't str, they changed whatever function was turning scripting types into string representation which is used when walking through array when turning it into string, instead of just changing str command itself.

still forum
#

Done!
"myString" regexReplace ["S|i","h"]
"Myhtrhng"

#

wasn't that hard..

queen cargo
#

@meager granite no...
Format is stringifying values unless they are string

meager granite
#

Gonna repharse, messed up when editing

tough abyss
#

Really not hard just escape the quotations

#

Before you hard worry about santiize user input, if it got saved to DB & retreived from DB later on.
With the change no longer need to worry about user input, unless its from a dialog text for some reason that doesn't escape quotations

Mainly the change allows for extensions to parse a stringified array correctly.

meager granite
#

I get why it was done, but the command itself should've been changed instead

#

Or new one introduced

queen cargo
#

๐Ÿคฆ ๐Ÿคฆ ๐Ÿคฆ

#

No

#

Stringification was broken

#

They fixed it after years of being broken

meager granite
#

If you ask me string to string should'nt have done anything in the first place instead of just adding quotes left and right

still forum
#

Right now fromString(toString something) returns exactly the same as input. Before the quote escape that wasn't the case.

queen cargo
#

Luckily nobody asked you @meager granite

meager granite
#

Yeah keep on defending bullshit

still forum
queen cargo
#

You are defending Bullshit... You are like those guys who join this discord to get their stuff fixed but pretend to not show anything and all solutions presented are wrong
Just that you are in the vet group... Which is even worse

#

No problem @still forum
But you lack the other essential regex methods (match for example)

meager granite
#

You're missing the whole point of strings, they are textual data, not "text-to-be-compiled"

still forum
#

yeah.. replace was easiest to implement

queen cargo
#

Tbh a special intercept addon only providing new commands would be funny

tough abyss
#

@meager granite You are missing that extensions deal with strings. So they need to able to compiled etc

still forum
#

@queen cargo That is what I am doing

queen cargo
#

@meager granite you miss everything about everything here and just want that stuff your way and are annoyed

still forum
#

Already accumulated a good bunch

queen cargo
#

Stfu and take a walk...

#

Are the names the same Ingame? @still forum

still forum
#

the first string argument in the function call is the ingame name

lone glade
#

how fast is the hashmap compared to one in sqf ded?

still forum
#

lookup in a hashmap with 10k elements is 0.002ms

lone glade
#

noice ๐Ÿ˜„

queen cargo
#

?? Not Rly seeing where you mean ๐Ÿ˜…

still forum
#

If you mean real hashmaps as in Namespaces should be roughly the same.. besides that Namespaces can only have string keys and my Hashmap takes ANY.
If you mean CBA hash... That will be much slower because every lookup is a linear search over the unsorted keys array

meager granite
#

@queen cargo Nice arguments you got there. Just sod off already.

queen cargo
#

Ahh found it

still forum
#

@queen cargo first argument to registerFunction call

queen cargo
#

@meager granite still waiting for your arguments

#

Did not saw that part of the code page @still forum๐Ÿ™ˆ ๐Ÿ˜…
Still cannot sit straight so I am on mobile

meager granite
#

@tough abyss That's why it should've been a separate command ot change to str only, not entire string to string conversion anywhere else.

still forum
#

I should probably add a using registerFunction = intercept::client::host::registerFunction to make it a little more compact

queen cargo
#

@meager granite no
You do not understand anything about the whole concept of it...
Stringification
Google it

meager granite
#

Whatever you say

queen cargo
#

Not to mention that I have no idea what use one could have about not correctly escaping strings in their sqf representation...

meager granite
#

Strings are text data, not "text-to-be-compiled-later" data. If you want to escape strings to be compilable, have a separate command for it.

queen cargo
#

So you are an idiot... Good to know

meager granite
#

Likewise

queen cargo
#

Strings still are Text data

#

And stringifying a string is now correct

#

There is no "because ppl wanted to be able to compile it again"

#

There is only a bug carried over for ages

lone glade
#

it's just how it works..

queen cargo
#

And you demand that the bug fix is a hoaks

still forum
#

how would you unstringify
["test","te"st","te","st"] and get out test, te"st, te","st ? @meager granite

#

["test","te""st","te"",""st"] is easy and the engine already knows how to do that

tough abyss
#

Baseically that simple fix, allowed extensions to be alot more useable and more secure (before parseSimpleArray).
Also just checked the change was done over a year ago. v1.64
So no point arguing over it

meager granite
#

str command was always a way to turn any data type into a string, it was never meant to escape quotes before. Right now not only it changed its behavior but also entire string to string conversion changed resulting in this escaping happening in other string related commands.

tough abyss
#

Also all commands you should be able to reverse it.

meager granite
#

I understand how it benefits extensions and parsing of arrays, but the change should have only affected str command only, or was made into separate command.

queen cargo
#

@meager granite that is simply incorrect

meager granite
#

Did you see command description? "Converts any variable to a string."

queen cargo
#

They fixed exactly that
Turning any datatype into a string

meager granite
#

That's it. Not "escapes string" or "makes string compilable".

queen cargo
#

Guess what? If you want to stringify a string, you have to escape what needs escaping

meager granite
#

The change affects all string to string conversions, not just str command

#

In case you still didn't get it

tough abyss
#

It doesn't effect all commands ๐Ÿ˜› Just most of them

queen cargo
#

In case you didn't got it

#

It was a bug

tough abyss
#

Regardless its correct behaviour now

queen cargo
#

Here
Take this
Has nice example of stringification

meager granite
#

It wasn't, string to string conversion simply added additional quotes, that's it. It never meant to escape quotes for it to be a bug.

#

It never meant to make string compilable either

queen cargo
#

No you idiot...

#

It is supposed to stringify whatever it is given

tough abyss
#

Honestly its not gonna change now. Everyone has tweaked any code they need to.
Anyway i got stuff todo, than debate about a year old change in arma ๐Ÿ˜‰

queen cargo
#

String version of a string is the string but escaped

meager granite
#

Can you read? What does command description say?

tough abyss
#

Converts any value into a string by placing " and " around the argument. Since Arma 3 v1.63.137891 this command will correctly escape all " inside a string:

meager granite
#

"Converts any variable to a string."

#

This is its original purpose, there is no "bug" in it not escaping string, it simply turns any data type into string.

queen cargo
#

You remind me of that duck guy that did not wanted to alter his code and told all answers presented to him have been wrong

tough abyss
#

Its still a string, just the quotations are escaped now.
Its still a string

Honestly arma modelers / terrain people have more to complain about updates breaking stuff.

queen cargo
#

Converting string to string is not by just putting " around it... You also need to escape the string

#

Accept that this is the common way in the whole it world

meager granite
#

Additional quotes shouldn't have been there in a first place

#

But you call lack of escaped quotes a bug

queen cargo
#

It Rly is like talking to a wall...

sour saffron
#

its so good to finally watch others debate

meager granite
#

Yeah, likewise, you would deny anything no matter what you're told

still forum
#

@lone glade

MyHashMap = createHashMap;
for "_i" from 1 to 10000 do {MyHashMap set [_i, _i];};


MyCBAHash = [] call CBA_fnc_hashCreate;
for "_i" from 1 to 10000 do {[MyCBAHash,_i,_i] call CBA_fnc_hashSet;};



MyCBANS = createLocation ["CBA_NamespaceDummy", [0,0,0], 0, 0];
for "_i" from 1 to 10000 do {MyCBANS setVariable [str _i,_i];};

[MyCBAHash,125] call CBA_fnc_hashGet 0.0298 ms
MyHashMap find 125 0.002ms
MyCBANS getVariable (str 125) 0.0049ms
I included the string for Namespace to give it the same properties as the other maps. As in keytype can be ANY
MyCBANS getVariable "125" 0.0023ms

queen cargo
#

I explained to you in thousands of different ways already why it is this way
Other people did too
You just repeat what you already said and do not want to understand

lone glade
#

damn, you're still at it?

meager granite
#

He just refuses to read what command is supposed to do

queen cargo
#

You refuse to correctly understand what the command is doing... And interpreting it wrong

#

I told you what it is doing

#

And you just say no to it

meager granite
#

You refuse to correctly understand what the command is doing... And interpreting it wrong
I told you what it is doing
And you just say no to it

#

Notice how it works both ways

queen cargo
#

I provide you evidence of how it works, told you to Google the term and you still insist on the current way being wrong

meager granite
#

"Converts any variable to a string."

#

That's all that you need to read to understand what it supposed to do

queen cargo
#

Correct
If you pass a string it is converted too

#

Guess what you have to do to convert a string to a string? Escaping it
You do not cast the string but converting it

austere granite
#

@still forum do that example with find 9999 instead

lone glade
#

why?

still forum
#

Youll see shortly alganthe

lone glade
#

oh, I do ๐Ÿ˜„

austere granite
#

the second one should a lot lot slower then, whereas the 'proper' shouldnt have any speedloss

still forum
#

[MyCBAHash,9999] call CBA_fnc_hashGet 0.349528 ms
MyHashMap find 9999 0.0019 ms
MyCBANS getVariable (str 9999) 0.0049 ms
MyCBANS getVariable "9999" 0.0021 ms

austere granite
#

๐Ÿ‘Œ๐Ÿป

#

aka... pseudo namespaces are good enough ๐Ÿ˜‰

meager granite
#

The point is about type conversion, converting string to string should not do anything, not even add quotes like it did before. The whole type converison was changed, not just str even if you want it to escape strings.

still forum
#

Depends on what the keytype is. you need to stringify it for Namespaces

meager granite
#

Get that now?

queen cargo
#

@meager granite conversion is not dynamic casting
Get that now?

austere granite
#

โค

meager granite
#

Looks like you don't get it

#

Well, no point in talking to idiot then. Have a good day.

queen cargo
#

Yes... Obviously I do not get it...

#

hint sarcasm

still forum
#

MyHashMap find 9999 0.0019ms
MyHashMap findF 9999 0.0018ms
Microoptimization ๐Ÿ˜„ Apparently not worth it at all at that level.

tough abyss
#

question, why for some reason when

(findDisplay 46) displayAddEventHandler ["KeyDown","_this call detach_player"];

the function named "detach_player" with contents

hint format ["Detached %1", _theplayer];

will return "Any"? This doesn't happen when call happens outside displayAddEventHandler

still forum
#

yes?

lone glade
#

because _this contains the event name too

still forum
#

I don't see why it wouldn't return "Any" .. _theplayer is undefined

lone glade
#

it's 2 arrays, EH name + args

astral tendon
#

im using the creat task module but the variable name i give seens to not work when i use like
````task1test setTaskState "Succeeded";``` what it could be?

#

it also give a generic error

tough abyss
#

@still forum well, _theplayer is globally defined actually

still forum
#

No it's not

#

a local variable is by definition not global

tough abyss
#

I meant it relatively actually, but if they re outside of my functions right on the top this means both of these functions should be able to access em

still forum
#

A eventhandler has nothing on top though.

#

It's a completly new scripts without any scopes above it

#

with completly empty local variables besides _this and _thisEventHandler

#

MyHashMap find 9999 0.0019ms
MyHashMap findF 9999 0.0018ms
MyHashMap findNop 99990.0016ms

findNop literally does nothing. It's a instant return Nil.
so just grabbing arguments and calling the function takes 0.0016ms which is 90% of the commands runtime.. GG Arma..
And that's why SQF is so crap ^^
a getVariable call is literally 90% of SQF crap.. and 10% of the actual getVariable function.

tough abyss
#

how do I pass the local var for the event handler to swallow? any chance?

sour saffron
#

(findDisplay 46) displayAddEventHandler ["KeyDown","_this call detach_player"]; dont you need a bit more at the start ? like _mycall =

still forum
#

@sour saffron no

lone glade
#

it's an add EH so no

still forum
#

@tough abyss BIS_fnc_StackedEventhandler can pass arguments trough. don't think that works for display tho

sour saffron
#

i am old thats why i have it ๐Ÿ˜ƒ

still forum
#

Really... again Discord?

lone glade
#

you can pass anything as _this for displayEHs

#

compared to missionEHs where args are pre-defined

sour saffron
#

dbo_KeyPressedCode = compile preprocessFile "key.sqf";
_dbo_KeyPressed = (findDisplay 46) displayAddEventHandler ["KeyDown", "_this call dbo_KeyPressedCode"];

#

thats my old ways ๐Ÿ˜ƒ i need to rethink maybe i get more speed

lone glade
#

you can use format (BIS uses it) or use a GVAR

still forum
#

No you won't get more speed

lone glade
#

example of BIS using format for displayEHs:

_ctrlDLC ctrlseteventhandler ["mouseexit",format ["(_this select 0) ctrlsettext '%1';",_logo]];
tough abyss
#

here is what I did though

_truck = _this select 0;
_theplayer = _this select 1;

attach_player = {
_theplayer attachTo [_truck, [0, 2, -1.6], "Pelvis" ];
_theplayer setVectorDirAndUp [[0,0,1],[0,-1,0]];
_theplayer playMove "LadderCivilStatic";
_theplayer switchCamera "External";
waituntil {!isNull (findDisplay 46)};
(findDisplay 46) displayAddEventHandler ["KeyDown","_this call detach_player"];
hint format ["Attached %1", _theplayer];
};

detach_player = {
(findDisplay 46) displayRemoveAllEventHandlers "KeyDown";
detach _theplayer;
_theplayer switchMove "";
_theplayer switchCamera "Internal";
_theplayer playAction "PlayerProne";
_theplayer playAction "EvasiveLeft";
hint format ["Detached %1", _theplayer];

};

call attach_player;

people who into spy stuff might understand me

sour saffron
still forum
#

@tough abyss How does that change anything?

lone glade
#

first of all, use params pls

#

it's 2017, not 2013

#

and yes, your arg isn't passed, so it's any

sour saffron
#

sounds intruiging attaching to a truck ๐Ÿ˜ƒ

lone glade
#

_this passes ["keyDown", [<control>, <keypressed>, <shiftState>, <ctrlState>, <altState>]]

#

forgot alt ๐Ÿ˜„

wispy locust
#

<.< i got pinged <.<

lone glade
#

use format to insert your arg

still forum
#

@wispy locust Yes. The usual ^^

wispy locust
#

<.<

#

fix your shit

#

<.<

#

@still forum

astral tendon
#

i find out about the task thing, its

tough abyss
#

format the function? Question is how do you fuse it with displayAddEventHandler? ๐Ÿค”

lone glade
#

no, addDisplayEH takes a string as code

#

just use format to insert whatever arg you want in it that isn't the default ones

little eagle
#

@tough abyss Do you use any mods?

lone glade
#

cba events glory

#

but i'm sure he doesn't

tough abyss
#

@little eagle nope

little eagle
#
_args = [blah];
_display setVariable ["MyTag_args", _args];
_display displayAddEventHandler ["keyDown", {
    params ["_display"];
    private _args = _display getVariable "MyTag_args";
    ...
}];
#

Read this, try to understand it, and then use it for your code.

tough abyss
#

too bad this server doesn't have blobthinkbutfast , so ๐Ÿค”

little eagle
#

You don't understand how it passes arguments inside the event code?

tough abyss
#

oh yes, I see now

little eagle
#

It's cumbersome, but that's how it's done without filling the global namespace.

#

The code block from event handlers is executed in a different script instance. Therefore no local variables carry over. It's difficult to understand for beginners. One of the worst things about sqf honestly.

lone glade
#

also
(findDisplay 46) displayRemoveAllEventHandlers "KeyDown";
is a terrible idea

#

ah, right, can't quote on discord

little eagle
#

Yeah, that will break about every mod. Guess it doesn't matter if it's just for your vanilla mission.

tough abyss
#

b b b but how will it break every mod?

little eagle
#

By removing their key handlers?

tough abyss
#

รถhรถรถรถ ๐Ÿค”

little eagle
#

You should look into how the addEventHandler function passes an ID that can be used with removeEventHandler (not All).

#

Or just don't ever remove the eventhandlers. Imo you about never need to actually remove them if you instead add some exitWith in their line 1. Which is much cleaner even though some noob here will disagree.

tough abyss
#

Some noob? ๐Ÿ˜„ Thanks I'll look into it ๐Ÿ™‡

little eagle
#

There's always someone that disagrees with you. Haven't seen the light yet. ยฏ_(ใƒ„)_/ยฏ

hollow lantern
#

If the config viewer does not show certain commands to retract a ladder of RHS truck. Is there a faster solution besides opening the PBO?

lone glade
#

use getText, getArray

polar osprey
#

need help with make this come true Buy Virtual Arsenal", "_this call fn_buyArsenal;

lone glade
#

what do you mean by that?

polar osprey
#

its for virtuail aersenal, i need some help making a fn that opens on respawn after you buy it

little eagle
#

addEventHandler ["Respawn" ???

#

Make a PR.

lone glade
#

takes out his bat