#arma3_scripting

1 messages ยท Page 349 of 1

waxen tide
#

well obviously i can't show you any code

#

i just got it barely working!

#

i haven't prettified jack

still forum
#

Who is Jack?

little eagle
#

Short for "Jack Shit", slang for "anything".

indigo snow
#

alternatively the character in hollywood blockbuster "the titanic"

#

The image surely shows clockwise rotation

cold pebble
#

Yeaaaah

#

That's awkward lol

waxen tide
little eagle
#

The guy that wrote that page is from Australia.

waxen tide
#

I've seen things like linting plugins for visual studio

#

i guess there is a better way to write stuff than using a simple editor

#

preferably something that interacts with github?

still forum
#

Atom/Sublime/Arma.Studio/VisualStudioCode

waxen tide
#

sublime is what i'm using right now

little eagle
#
private ["_object"];
_object = _this    select 0;

Why do people still do this in 2017? Especially when params is used two lines below.

waxen tide
#

because people are too stupid for params.

#

i tried every variant of params i could think of in that spot

little eagle
#
params ["_object"];

lol

waxen tide
#

quite possibly the issue was with the handed arguments tho

#

rude

still forum
#

I think I got everything

still forum
#

params is not the right solution here @little eagle

#

That function takes one argument only. There is no reason why that should be in an array

waxen tide
#

thanks Dedmen

#

I need a stiff drink now.

still forum
#

could omit all the overhead and just use _this as I wrote in my comment

#

@waxen tide Please do a perf test again after the changes. I'm curious how much that will do

waxen tide
#

will do

still forum
#

you could use params to make sure no one passes a nil

little eagle
#

But I like my functions to be called as either

arg1 call func;

or

[arg1] call func;
still forum
#

It's a style decision then. But params will atleast be faster than ugly private ARRAY and a select

little eagle
#
private _arg1 = param [0];

I can accept this as alternative if it's always just one argument. But it looks uglier than the slick params.

still forum
#

and might actually be slower

rotund cypress
#

But params does all that for you ๐Ÿค”

waxen tide
#

I find it interesting how both of you ignored what the functions actually do and focussed entirely on coding style

still forum
#

considering that's a lot of instructions. Compared to a params call

rotund cypress
#

And ye slower

still forum
#

I focused on performance'

waxen tide
#

also i'm surprised nobody yelled at me for my if () exitWith madness

rotund cypress
#

params["_arg1"];

#

Does it get any better? ^^

still forum
#

I don't see madness in there. Exiting soon is a good thing

waxen tide
#

so, i'm not entirely hopeless.

still forum
#

Maybe I didn't look close enough ^^

little eagle
#

A)

params [["_num1", -1, [0]]];

B)

private _num1 = param [0, -1, [0]];

A or B, dedmen?

rotund cypress
#

A!!!

#

pls not b

#

cmon

little eagle
#

I can see the appeal of B, as long as the function only has one argument.

#

I'd still use A for consistency though.

#

But A B might be faster. It has one less array and one more number instead.

still forum
#

A ofcause

#

array's don't matter. They are composed at compileTime.. I think

#

Not sure if it directly combines all constants into an array at compileTime... I'd guess so..

little eagle
#

C/C-whatever should implement params.

rotund cypress
#

Why? @little eagle

runic surge
#

I'm trying to use a script function to create objects in eden
I have managed it with this in the debug menu: positioncheck = screenToWorld [0.5,0.5]; "C_Quadbike_01_F" createVehicle positioncheck;

#

but it isn't actually editable with the editor

peak plover
#

Isn't param faster if you got 1 var?

runic surge
#

is there a way to actually add it to the editor?

#

I found create3DENEntity

#

that might work

#

that works nvm I solved my own problem within a matter of seconds after asking lol

#

positioncheck = screenToWorld [0.5,0.5]; create3DENEntity ["Object","C_Quadbike_01_F",positioncheck];

still forum
#

@runic surge Why can't you just place them in Eden?

runic surge
#

I'm in the process of creating a script to duplicate terrain objects and add them to Eden

#

you know, like a thief

still forum
#

๐Ÿ˜„

#

You can't do that in Eden preview

runic surge
#

I am simply trying to make some prefabs based on altis villages and forests from my terrain

still forum
#

you have to do it in Eden and execute scripts with debug console or anything else

runic surge
#

that is what I am doing

runic surge
#

_SearchPosition = screenToWorld [0.5,0.5];
_SearchRadius = _this select 0;
_ObjectType = _this select 1;

_TerrainObjects = nearestTerrainObjects [_SearchPosition, _ObjectType, _SearchRadius];

{
    _type = typeOf _x;
    _pos = getPos _x;
    _dir = getDir _x;
    _obj = create3DENEntity ["Object",_type,_SearchPosition];
    sleep 0.1;
    _obj setPos _pos;
    _obj setDir _dir;
} forEach _TerrainObjects; ```
Any idea why this doesn't work?  It tells me that _obj is undefined
waxen tide
#

I doubt an object named "Object" exists

#

you maybe forgot to fill that in?

runic surge
#

that is for the type of entity to create

#

alternatives are "Trigger" "Logic" things like that

waxen tide
#

ah, right. sorry.

runic surge
#

I can get it to create the objects just fine

#

just not the rotation or exact position right now

runic surge
#

it seems there is no way to define a variable name for an eden entity so this might not actually be possible

still forum
#

setVehicleVarName

peak plover
#

        _dropList2 ctrlSetBackgroundColor [1,0.0,0.0,1];
        _dropList2 ctrlSetForegroundColor  [1,0.0,0.0,1];
        _dropList2 ctrlSetActiveColor [1,0.0,0.0,1];
#

Why does my button not change color?

#

This should mean 100% red, right?

#

        _dropList2 ctrlSetTooltip "Priority of the task";
#

This command works alright

#

Is there some secret to setting button colors?

waxen tide
#

Anyone experienced with installing sqflint for atom? i have no clue how to install stuff with python on the cmd

tame portal
peak plover
#

Can't be null, tool tip works...

tame portal
#

Try commiting

peak plover
#

nuttin'

#

I think button might not accept commands from mare mortals ๐Ÿ˜ฆ

still forum
#

I think there was a problem with button indeed

peak plover
#

Yes thanks @still forum found it on the wiki. And thanks to X39 for submitting it

runic surge
#

@still forum setvehiclevarname that wouldn't work either

#

I can't change the var name of something that can't be selected to begin with

still forum
#

Ouuhh.. create3denentity doesn't return anything?

#

You know the position of the object. Maybe nearestObjects?

runic surge
#

maybe

#

that won't work since the object doesn't spawn in the exact location of its original

#

likely will mix things up that aren't more than a couple meters away

#

I can get it to place the object in the exact right position but it doesn't actually change the rotation and position values in the objects attributes

#

if I click and drag or copy and paste they both reset

#

_obj = create3DENEntity ["Object",_type,_pos,true];
_obj should refer to the eden entity, right? It doesn't seem to actually, and changing the position or rotation of the object seems to only affect the actual 3D model, without actually changing any attributes. At the same time, it returns an error saying that _obj isn't a defined variable. get3DENentityID doesn't work either

#

it seems I can't actually do what it is I want to here

little eagle
#

Yes, you have to save the attributes manually.

runic surge
#

well that's lame

#

seems like a simple oversight

little eagle
#

Nah, setting the position is a write to temp file operation.

#

So it's not necessarily what you want every frame.

slender halo
#

@waxen tide not tested but there is a sqf lint on VScode and installing extensions is painless

runic surge
#

So it isn't possible to duplicate terrain objects to eden objects

#

I was so close

little eagle
#

"Position"

runic surge
#

I can't select the eden entity

#

I have tried that

little eagle
#

Are you sure?

waxen tide
#

@slender halo thanks

runic surge
#

set3DENAttributes [[_obj ,"Position",_pos]]

#

that's the only way I could think to try it, and that doesn't work

little eagle
#
player set3DENAttribute ["Position", [0,0,0]];
#

This should set the player to the corner of the map.

runic surge
#

right

#

because player is a defined variable

little eagle
#

It's a command that reports the player entity.

peak plover
#

Did they ever finish

showSquadRadar = 1;

?

little eagle
#
set3DENAttributes [[[player],"Position",[0,0,0]]];

this is the other syntax. I think you forgot an array.

#

Arg, I did too

runic surge
#

that does something

#

the rotation is definitely wrong though

little eagle
#

rotation is a different attribute

#

"Rotation"

#

[X is pitch, Y is roll and Z is yaw]

runic surge
#

Ah I think I know what to do here

indigo snow
#

the 3den rotation is pretty arcane

#

it seems to actually be quaternion / euler angles

little eagle
#

Good

waxen tide
indigo snow
#

i looked into it a while ago and its not really possible to set them yourself becuase it might end up upside down

slender halo
#

shouldn't the party be longer ?

runic surge
#

the rotation works but the position is still slightly off

still forum
#

That's more like it ๐Ÿ˜„

little eagle
#

set first the rotation and then the position maybe?

waxen tide
#

when i call it again it drops to 7-9

runic surge
#

I did rotation first

#

that worked with setDir and getDir before setPos and getPos

little eagle
#

Don't use getPos

#

getPos reports AGLS. You need AGL

#

ASLToAGL getPosASL _obj

runic surge
#

_pos = ASLToAGL getPosASL _x;

#

like that?

little eagle
#

yes

north vortex
#

How would you repeat a command, for set time

#

Settime*

runic surge
#

@little eagle holy shit it works

#

still spams errors though

little eagle
#

Yes, getPos is bad. Never use it.

#

never*

runic surge
#

is getDir okay?

little eagle
#

Yes.

north vortex
#

How would you repeat a command so i can keep it nighttime it keeps reseting

runic surge
#

for some reason it isn't working for all of the objects but that is a separate issue

north vortex
#

Halp me plz

little eagle
#

I don't think your problem is that you have to repeat the command. I think your problem is, that the server switches back the time, because you only changed it locally.

north vortex
#

No its argo they did not support night time but you can activate it so if i can repeat the command after i activated it it will stay night time

little eagle
#

What are you doing?

north vortex
#

?

little eagle
#

You sound totally confused. What you're telling me makes no sense.

north vortex
#

The devs of argo did not support night time so it resets every 60 sec

little eagle
#

That sounds wrong.

north vortex
#

Its argo not arma they did not support everything from arma but there is night time

#

I was thinking that i could add an action to an object and set the time to midnight then have it repeat but idk the script for repeating a command

little eagle
#

You don't have to repeat the command. You have to fix your script.

north vortex
#

Whats wrong with it?

little eagle
#

How would I know if you refuse to post it?

#

I asked you "what are you doing".

#

But no reply.

north vortex
#

I dont see anything of what i am doing

#

This will be wrong

little eagle
#

You said the time changes back after a few seconds.

#

So you must be doing something already.

ivory vector
#

is it possible to link onMouseButtonDown to a RscEdit ?

#

So when i click in the box , it clears the box ?

little eagle
#

I think so, yes.

slender halo
#

@ivory vector are you doing it by script or config ?

ivory vector
#

either ๐Ÿ˜„

slender halo
#

in script you have to remove the on prefix

ivory vector
#

im doing a messaging system, and its just as an ease thing really, not neccesary.

little eagle
#

FocusSet should do it

#

Not MouseButtonDown

north vortex
#

Commy i am doing nothing wrong the game is argo not arma 3 the devs did not support nightime and when you set the time to a desired time every 60 sec it repeats

little eagle
#

Dude. Just post your code and I fix it.

#

You're not very cooperative.

ivory vector
#

should have !showcode command xD

north vortex
#

This addaction "settime,055" this is very wrong it just and example idk the code i have to be able to test it with my pc but this is my phone

little eagle
#

See? You did use setTime wrong

north vortex
#

Ok i just wana know how to repeat the command

little eagle
#

You don't have to repeat the command.

#

You have to fix your code.

#

It's broken.

#

ffs

#

Get on your PC and post it. And then I can tell you what's wrong maybe.

north vortex
#

Is there a way to repeat the command even it it was working it will reset it

little eagle
#

You're very stubborn for someone who apparently is pretty lost.

north vortex
#

Here ill go on the arma webpage and tell you it but i still need to know how to repeat the command, why because its argo the free ti play shooter then never bothered with the night time so every time you set it to night even without scripting it will reset it

little eagle
#

setDate and skipTime are commands that have to be executed on the server. You're using an action menu action. You have to incorporate remote execution into your code somehow. Otherwise the server will overwrite your changes after a short period of time. This has nothing to do with argo.

peak plover
#

This addaction "settime,055" ๐Ÿ˜„ ๐Ÿ˜‚

north vortex
#

Arma i said it was an example lol

little eagle
#

๐Ÿ™„

peak plover
#

lol ivan doing fnc partymode ๐Ÿ˜„ @waxen tide

waxen tide
#

well thats the WIP name at least ๐Ÿ˜„

peak plover
#

What takes that long 'tho?

#

Immense time

north vortex
#

This addacction ["settime",{setTime 55}];

#

May be weong

#

Wrong*

peak plover
#

That command must run on server

slender halo
#
player addAction ["Action", {[1986, 2, 25, 16, 0] remoteExec "SetDate"}]
little eagle
#

setTimemuiltiplayer is not a command. So yes., this is wrong

north vortex
#

Oh well i could not find a set time on the arma webpage

little eagle
#

remove the , 2, zgmrvn and you get the change immediately on the clients.

slender halo
#

indeed

north vortex
#

This addacction ["settime",{setTime 55}];

little eagle
#

There is no "setTime" afaik

slender halo
north vortex
#

player addAction ["Action", {[1986, 2, 25, 16, 0] remoteExec ["SetDate", 2]}] this will work?

little eagle
#

remove the , 2

#

The second one ...

north vortex
#

player addAction ["Action", {[1986, 2, 25, 16, 0] remoteExec ["SetDate"]}]

little eagle
#

lgtm

jade abyss
#

@little eagle ? :D
player addAction ["Action", {[1986, 25, 16, 0] remoteExec ["SetDate", 2]}]

little eagle
#

eff off, Dscha

jade abyss
#

๐Ÿ˜—

little eagle
#

This is hard enough without you.

jade abyss
#

I know, i read it the past 5min and thought: "what?"

north vortex
#

Ya but even if i ran this script it will reset the time

little eagle
#

How did you determine this?

north vortex
#

Because argo does not support night time which is why i want to repeat this command

little eagle
#

Jesus

#

How old are you

#

?

runic surge
#

I thinks he's trying to say that Argo doesn't support night time guys

north vortex
#

That what i just said

runic surge
#

Ok bye

little eagle
#

Is this some elaborate troll by Blaubaer?

slender halo
#
while {true} do {setDate [1986, 25, 16, 0]}
#

...

north vortex
#

It will reset it back to the basic time because its ment to be a competitive shooter

little eagle
#

You used skipTime wrong and it's documented on the wiki that you have to remotely execute it.

#

I'd try with correct code first.

north vortex
#

Commy get argo and set the time to night time

little eagle
#

/o\

#

Have you tried our suggestions?

jade abyss
#

Did you even tried the Code above?

little eagle
#

^

north vortex
#

No im on my phone

jade abyss
#

....

#

blocklist

little eagle
#

Baer, this isn't funny. Sorry that I said to you that you're gay for liking traps.

north vortex
#

Who baer??

little eagle
#

Exactly what Baer would write.

peak plover
#

Yeah, baer wtf

slender halo
#

this is elaborated troll

peak plover
#

๐Ÿ˜•

north vortex
#

Im not baer

peak plover
#

๐Ÿค”

#

I feel like Exactly what Baer would write.

north vortex
#

Im noy trolling im serious

#

Not*

little eagle
#

Then get off your phone and change your code according to our suggestions.

north vortex
#

I am leading off topic but i cant be on my "moms" pc because idk password

#

I am building my own though thank god

cold pebble
#

Isn't komanda koroma one of the many us army generals trying to make me pay them to ship gold from a middle eastern country?

peak plover
#

๐Ÿ˜ณ ~embarrasing~

north vortex
#

No you shut up

#

No no

little eagle
#

๐Ÿคฆ

north vortex
#

I did not scam james

runic surge
#

lmao and I thought #arma3_terrain had enough cancer
what with the lifers and all

peak plover
#

Wait, I just realized, normies have friday right now...

#

Komanda are you drunk?

north vortex
#

No

peak plover
#

I did not scam james, Random, no context, no meaning, something somone intoxicated would say...

cold pebble
#

Yup

north vortex
#

Nigel dom know what im talking about

peak plover
#

It's ok

cold pebble
#

I don't?

#

I just recognise that name from many spam emails I receive

north vortex
#

Dom knows what i am talking about

cold pebble
#

I really really don't

runic surge
#

but maybe you do

#

you just need to believe

#

unlock a horrible repressed memory from a traumatic event in your childhood

north vortex
#

Then why do you rember this name?

#

Wad it because it was used in an act of comedy

#

Was*

#

Isn't komanda koroma one of the many us army generals trying to make me pay them to ship gold from a middle eastern country? Isnt this toooo specific??

cold pebble
#

oshit

#

I get what your referring to, but I've had the same emails lol

#

James Veitch is who your referring to

north vortex
#

No you just saw the video james veitch

cold pebble
#

Nah I actually have

north vortex
#

Same as i which is why i used this name

cold pebble
north vortex
#

I know whu did you bring it up??

#

Isn't komanda koroma one of the many us army generals trying to make me pay them to ship gold from a middle eastern country?

#

???

peak plover
cold pebble
#

Because you were basically trolling

north vortex
#

How?

cold pebble
#

You ask for help, you get help, you don't try it

north vortex
#

Lol im on my phone i asked for help because i did not want to spend my time working to get on my "moms" pc and then have to ask help on scripting i did it before hand

#

Im going to try it

grand berry
#

Can we have this channel back for scripting please?

north vortex
#

Yes
Ask for something they will help

peak plover
#

Yes

grand berry
#

Is there any way to write text/ variables to a live texture? Rather than making all the posibilites as textures then changing the texture when the condition changes.

peak plover
#

Procedually generated textures?

north vortex
#

Is it possable to add attachments that are not supported on weapons? Like a sos scope on a pistol although it will be stupid

grand berry
#

Essentially yes - ie laptop screen showing number of enemies left in an area.

little eagle
#

Is it possable to add attachments that are not supported on weapons? Like a sos scope on a pistol although it will be stupid
Not with scripts, no.

peak plover
#

Draw3d, but you would jump some hoops ... I think that is possible

#

Easier version would be to have to click on laptop and get UI

indigo snow
#

just include small textures for the numbers 1 - 200

little eagle
#

digits

indigo snow
#

possibly even just 0-9 and a custom object

peak plover
#

That sounds like effort

indigo snow
#

youd need a custom selection then

peak plover
#

How about lineintersects, getDir and draw3d?

indigo snow
#

itll never look as if it was actually on screen

north vortex
#

Thanks commy2

peak plover
#

Yeah... true

#

I guess the digits version might work

#

But can you combine textures somehow to the screen?

indigo snow
#

if you have many smaller selections you can sprite stuff i guess

young current
grand berry
#

Hmm, i'm thinking multiple textures will be the quickest way. Can just auomate the texture creation in PS.

peak plover
#

Awesome

indigo snow
#

if its small numbers you can do like 8x8 textures anyway

north vortex
#

Lol

tardy yacht
#

Ok I'm very bad with SQL related stuff so if anyone knows anything about it here, here's a question.
I want to check if a specific string exists in the database. I need to check 3 specific columns (it could exist in any of those three). If it does, return TRUE if it doesn't return FALSE.
I've searched Google but everything it comes up with doesn't seem to work.

peak plover
#

soo. In mp. if I don't call BIS_fnc_endMission on the server, does that mean the mission never stops running?

indigo snow
#

yes

#

its ends the mission, locally

peak plover
#

I'll just do endMission on server too, after players

indigo snow
#

BIS_fnc_endMissionServer for a one in all solution

peak plover
#

I might want different endings for certain players/sides, so I want to avoid that one

#

Great

waxen tide
#

\o/ linter works \o/

peak plover
#

// Get winners
private _winSide = missionNamespace getVariable ["mission_tasks_winSide",TASKS_SETTINGS_ENDING_SIDE_AUTO];

private _winPlayers = missionNamespace getVariable ["mission_tasks_winPlayers",(allPlayers select {side _x isEqualTo _winSide})];

missionNamespace setVariable ["mission_tasks_winners",_winPlayers];

hmm, is this a good way to do winners for my mission?

#

Essentially, a side would be set as winner, but this could be overwritten by a list of players who win instead...

#

So when I want to make a pvp or gimmick mission with 1 winner, I can do that, but it will also work with COOPs

#

Just wondering if an array of winners would be too much to send to clients, or should I just send win/lose functions from server?

north vortex
#

JUST GOT RAM

peak plover
#

Fixed my prob, justwent for two diff. remoteExecs

north vortex
#

Cool

tame portal
#

So

#

Very nice to see that the weaponholder has a collision box

#

and when you walk over it it makes you jump up a bit -_-

peak plover
#

Using enhanced movement?

tame portal
#

Yea

peak plover
#

It's good to sometimes feel a bump when running over dead bodies 'tho

tame portal
#

So it's enhanced movement thats the issue? ^^

peak plover
#

Yeah, vanilla doesn't have that feature/bug

tepid pollen
#

Feeling quite stupid. Why is the addition sign giving a Generic error?


for [{_i=0}, {_i<10}, {_i=_i+1}] do {
    testVariable = testVariable+1;
    publicVariable "testVariable";
    sleep 5;
};
peak plover
#
for "_i" from 0 to 10 do {```
tame portal
#

@peak plover I supposed noone has a fix ready?

peak plover
#

Jsut ask bad benson in his thread for the mod. I'm sure if there's a way, he'll fix it ๐Ÿ˜‰

tepid pollen
#

what's wrong with mine? besides, it's not the issue

peak plover
#

Slower ๐Ÿ˜‰

waxen tide
#

๐Ÿค

peak plover
#

are you running your code in the scheduler ? @tepid pollen

tepid pollen
#

thanks for that tip, but the plus sign is still being marked as a Generic error? this is running as an SQF script

peak plover
#
[] spawn {
    // my scheduled code here ;)
};
tepid pollen
#

ill try that

peak plover
#

you can't suspend (sleep) in un-scheduled non-scheduled

#

non-scheduled run all the code instantly and suspend ALL scheduled scripts until the non-scheduled script is done

#

scheduled scripts are given total (all scripts) 3ms per frame. The higher your framerate, the more code you get through in a second

tepid pollen
#

made no difference. it's the plus sign being marked as an error. it's as stupid as it sounds

[] spawn {
    for "_i" from 0 to 10 do {
        testVariable = testVariable+1;
        publicVariable "testVariable";
        sleep 5;
    };
};
tame portal
#

is testVariable defined

tepid pollen
#

yeah. left that part out this time, it was in the last code block I sent

#
testVariable = 0;

[] spawn {
    for "_i" from 0 to 10 do {
        testVariable = testVariable+1;
        publicVariable "testVariable";
        sleep 5;
    };
};

peak plover
#
[] spawn { 
    testVariable = 0;
    for "_i" from 0 to 10 do { 
        testVariable = testVariable+1; 
            publicVariable "testVariable"; 
            sleep 5;  hint 'yay';
    }; 
};
// computes
#

straight to debug console

tame portal
#
[] spawn {
    testVariable = 0;
    for "_i" from 0 to 10 do {
        testVariable = testVariable + 1;
        publicVariable "testVariable";
        sleep 5;
    };
};
waxen tide
#

@tepid pollen if you add sqf behind the three ` you get highlight in discord

peak plover
#

```sqf
//code
```

waxen tide
#

is impressed

peak plover
#

backward slash before the char to disable it's function

tame portal
#

*ok*

arctic veldt
#

ok

tepid pollen
#

that did it. have to define the variable inside the spawn

peak plover
#
gag = 0;
[] spawn {  
    for "_i" from 0 to 10 do {  
        gag = gag+1;  
            publicVariable "testVariable";  
            uisleep 0.5;  hint 'yay'; 
    };  
};
#

works

tame portal
#

@tepid pollen Where is your code being executed from

tepid pollen
#

no clue then. that setup gives me the error

#

it's an SQF script. not sure if that is what you are asking

peak plover
#

Just do something like

private _testVar = missionNamespace getVariable ["testVariable",-1];
missionNamespace setVariable ["testVariable",(_testVar + 1),true];
tepid pollen
#

server-side

#

anyways... don't know and frankly don't really care. it works so I am going with it. thanks guys

waxen tide
#

I found out where the doors are stored in the cfg on houses. but are entrances without doors noted somewhere aswell? any way to detect them by mission script?

north vortex
#

Im trying out the code

subtle ore
waxen tide
#

Yes exactly! Thanks

#

Does anyone know how to get autocomplete for BIS functions to work in atom with the acemod syntax highlight?

subtle ore
#

Not sure atom has sqf syntax hightlighting, but Arma Studio has something similar afaik.

waxen tide
#

there is a package for atom for sqf highlightning from the ace mod team

#

is there a linter for ArmA Studio?

blissful wind
#

heya guys, is there a % (modulo) in sqf or a bis_fn to get the remainder of a division ?

#

canยดt find it

waxen tide
#

i am pretty sure i saw a function for that but i don't recall the name

blissful wind
#

yea iยดd rather just have the operator

#

but i ยดll have another look in the fn library

#

well thought of asking before getting into it

#

but just tried and the operator does work, hm... sqf

#

well itยดs right there and i passed right through it .. had to check again kek

subtle ore
#

@waxen tide yeah Arma Studio is a linter

waxen tide
#

k thanks i'll try it

#

scratches his head

#

If someone is bored to death, i wouldn't mind some info about how the cfg is actually structured and how the class inheritance? works for stuff like a house for example

tame portal
blissful wind
#

@tame portal ty

runic surge
#

is it possible to remove parts of a string?

#

I am trying to simply remove the ".p3d" at the end of a string

barren magnet
#

SplitString with find

runic surge
#

thanks

runic surge
#

I can't seem to figure this out

#

I do it in the morning

peak plover
#

would this work

while {isNil "_something"} do {
    _something = true;
};
little eagle
#
_string = "folder\pathfile.sqf";

_string splitString "." select 0 // "folder\pathfile"
_string select [0, toLower _string find ".sqf"] // "folder\pathfile"
#

nigel, not always.

peak plover
#

f-f-fuck me

little eagle
#
private "_something";

while {isNil "_something"} do {
    _something = true;
};

This would always work.

peak plover
#

ohh right, awesome, thanks ๐Ÿ˜‰

spice kayak
#

What would be the best way to create a smoke grenade-like effect over a larger area? Obviously one could use multiple smoke grenades, but performance tanks rather heavily. Another could be somehow setting up the smoke module in such a way that it visually looks like a smoke grenade, which I've failed to do so far.

#

Any ideas in that regard?

little eagle
#

You'd need a large amount of particles to cover a large area, so no matter what you do, it will either tank performance or be too thin and ineffective.

spice kayak
#

Damn, I was thinking maybe using the fog, but there's no way to limit it's radius or anything.

#

Oh, apparently BIS_fnc_sandstorm is a thing.

#

I'll have to see what that looks like.

little eagle
#

It uses pp effects and not particles iirc

spice kayak
#

Some sort if location based ppeffect?

peak plover
#

There are scripts for this

#

I used this tutorial like years ago

#

Fps impact was big, so I ended up using fog and pp effects.
I just wanted a cute sandstorm

#

For smokescreen this can be used as a decent how to

spice kayak
#

'cute sandstorm'

#

Well, now it needs googly eyes.

peak plover
#

Sure ๐Ÿ˜ƒ

spice kayak
#

Aw man, I could have swore there was a googly eyes mod on the workshop :(

#

Can someone please mod that as a face wear?

#

Like, I really want googly eyes as a thing.

#

Maybe even NVG googly eyes.

peak plover
#

hahaha

spice kayak
#

How did your experimentation with fog and ppeffects go anyway? Get anything useful out of it?

peak plover
#

It was hella CUTE!

#

I keep backups of a lot of stuff, if you're interested, I can look up the exact values

spice kayak
#

Ah, sorry, that wouldn't load for me earlier, but it looks actually quite nice.

#

But I'd love it more blended, moreso than just complete original color removal,

peak plover
#
_hndl = ppEffectCreate ["colorCorrections", 1501]; 
_hndl ppEffectEnable true;
_hndl ppEffectAdjust [ 0.7  , 0.7, 0, [1.01, -2.46, -1.23, 0],[2.11, 1.6, 0.71, 0.8],[1.43, 0.56, 3.69, 0.31]];
_hndl ppEffectCommit 0;
#

I like saturation too much

spice kayak
#

But it still drains out all original color though :C

peak plover
#

Ooh, that looks nice.

#

Looks sandy

slender halo
#
private _varName = format ["SP_var_%1_controls", toLower _mode];
missionNamespace setVariable [_varName, []];

{                
    private _idc = _x select 0;
    private _value = _x select 1;

    private _childControl = _option controlsGroupCtrl _idc;

    (missionNamespace getVariable _varName) pushBack [_idc, _childControl];

    _childControl ctrlSetText _value; // works
} forEach _values;

 // SP_var_brush_controls = [[1, No control], [1, No control], [2, No control], ...]
#

any idea why SP_var_brush_controls ends with No control ?

little eagle
#
call compile (_varname + " = []");

???

#

This looks very backwards.

slender halo
#

i need to dynamically declare variables based on classnames

#

_mode

little eagle
#
private _varName = format ["SP_var_%1_controls", _mode];
private _value = [];
missionNamespace setVariable [_varName, _value];

...

_value pushBack _x;
#

This is the sane way of doing it.

#

My guess is that _option is not a controls group or the idc's are wrong.

indigo snow
#

What is _values, since thats being iterated?

little eagle
#

Pair of idc's and strings.

#

[[idc1, "string1"], [idc2, "string2"]]

peak plover
indigo snow
#

Since its returning "No control" the error is somewhere in these values not working for you, because im not seeing any obvious errors codewise

little eagle
#

findDisplay only reports dialogs, not displays, nigel.

peak plover
#

LMAO ๐Ÿ˜ฆ

little eagle
#

Addon or mission?

peak plover
#

mission

little eagle
#

hmm

indigo snow
#

Doesnt cba offer UI handles now?

slender halo
#

@indigo snow yeah but the ctrlSetText right after works :/

peak plover
#

I already run a custom version of ace, so might as well add uiNamespace setVariable or sth to the spectator display...

#

Don't think there's any other way...

little eagle
#

Yeah, do that.

peak plover
#

I would like another way so this mission would work with normal ace, but yeah....

indigo snow
#

@slender halo wierd guess but try and save str _childControl to the array? They might not exist when you check them or something, but idk much about UI stuff

little eagle
#

Doesnt cba offer UI handles now?
This one isn't using BIS_fnc_initDisplay and therefore doesn't support the XEH displayLoad event handler.

indigo snow
#

I see

#

Maybe PR an event to it, nigel

#

One that reports the display

#

Then you can hook into the event

peak plover
#

uiNamespace setvariable, like unconsciousness

slender halo
#

SP_var_brush_controls // [[1,"Control #1"],[1,"Control #1"],[2,"Control #2",...]

indigo snow
#

Yea they probably just didnt exist when you check the array or where you checked the array

#

Since those look like existing controls to me

little eagle
#

What is _option ?

slender halo
#

i'm retard, i'm watching the console so the dialog is closed and indeed the controls don't exists...

indigo snow
#

Its ok, ui is black magic anyway

little eagle
#

It's fun.

#

AI is hell.

indigo snow
#

I concede

little eagle
#

I accept your concession.

peak plover
#

I feel UI and AI are both hell, but they are so fun

indigo snow
#

Its the rush when you manage to get it working

#

Its like escaping the asylum

peak plover
#

Ugh..

#

...yeah?

still forum
#

@waxen tide private keyword vs private ARRAY is not a style decision. It's a performance decision.
private ARRAY is a command that you call. private keyword is evaluated at compileTime and has 0 runtime overhead

indigo snow
#

And maybe its just me but now i never forget adding new locals to the array anymore...

little eagle
#

private command is old and ugly. private keyword is new and shiny.

waxen tide
#

@still forum i see, thanks

little eagle
#

Also what nick said.

waxen tide
#

well believe it or not i constantly think about "how much performance will that cost"

#

compelling arguments

#

i actually forget that all the time.

little eagle
#

It really helps when reading the code too. Every time you see an assignment without private, you know the variable already had a value.

still forum
#

I cluddered a lot of comments on one of your newer commits ^^ Check your github. But 90% of these are just copy pasted messages

waxen tide
#

is scar ed

#

how can i find the comments on github?

#

i randomly clicked every button 5 times and nothing happened

little eagle
#

Go to the list of commit and click on the one with the comments

slender halo
#

@indigo snow @little eagle thanks, it works fine, @little eagle i need to get used to namespaces ๐Ÿ˜‰

peak plover
#

_key = 'abc'; is faster than private _key = 'abc'
Only use private if required...

indigo snow
#

SetVariable is too good for generated variable names

waxen tide
#

thanks commy2

indigo snow
#

Nigel always use private or the pixies will come and get you one day

peak plover
#

I do, but I intend on removing all unnessary ones once I'm done

#

I will NOT pre-optimize

#

post-optimize instead, once it all works

still forum
#

private is not a performance optimization.

#

You do it so you don't modify external variables

indigo snow
#

Im of the opinion the hunt for optimization can cross stupid-lines

#

But i wont tell you how to code

peak plover
#

Yes, but I use it pretty much everywhere, meaning in some places there are no external variables to modify. These times it needs to be removed

still forum
#

Yeah.. @waxen tide also has that in an eventhandler. There is no scope higher up. So no variables that could be modified. So private in there doesn't make sense

waxen tide
#

well i use private when it is clear to me the variable will only see use in such a way that private will work out?

#

thats what i get for using other peoples scripts...

peak plover
#
[] spawn {
    private _myvar = blabla;
};

wasted performance, wasted CPU power, wasted power, wasted earth

#

Save earth, remove uesless privates

still forum
#

The script is probably fine. It was written to be used anywhere. And in most cases you need private

peak plover
#

fair point, there can be functions which don't conflict currently, but if somone uses it, it might...

still forum
#

If you have a completly closed system. Then you'll know if a variable in a script might overwrite one of yours. So you don't need private at all if you choose variable names wisely

#

But open Frameworks should always use private everywhere that might be potentially a problem if someone else calls it

peak plover
#
for '_i' from 0 to 10000 do {
private _a = 'a';

private _b = 'b';

private _c = 'c';

private _d = 'd';

private _e = 'e';

private _f = 'f';
};
//28.4444 ms


for '_i' from 0 to 10000 do {
private ['_a','_b','_c','_d','_e','_f'];
_a = 'a';

_b = 'b';

_c = 'c';

_d = 'd';

_e = 'e';

_f = 'f';
};
//40.32 ms
#
for '_i' from 0 to 10000 do {
_a = 'a';

_b = 'b';

_c = 'c';

_d = 'd';

_e = 'e';

_f = 'f';
};
//28.8571 ms
#

I guess private is not as bad as I thought

#
normalx100 000
//284.5 ms
privatex100 000
//271.5 ms
#

private is faster than normal

still forum
#

Theoretically private has no overhead besides setting one bool to true.. Which is otherwise set to false

#

so you are setting one bool eitehr way

#

You are probably in the measuring tolerance

peak plover
#

True, I thought it might have bigger impact, but it seems like it has a positive impact instead...

#

private confirmed good boy

still forum
#

positive impact... Okey yeah.. it makes sense

#

Because if you don't private. Arma will search from current scope through all upper scopes to check if the variable already exists

#

if you private you create the variable in the current scope. So it only has to go up by 0 levels before it finds it

peak plover
#

1mil private = 2776 ms 1mil nonprivate = 2808 ms

#

This has been eyeopening

#

I had the completly wrong idea about this

still forum
#

The difference should be higher if you go to a lower scope.
instead of <perfcode> call {call {call {<perfcode>}}}

peak plover
#

And yeah, that makes complete sense

waxen tide
#

On an entirely unrelated side note, anyone of you using Atom? The language-arma-atom package autocomplete is driving me crazy. It doesn't work for most BIS functions but their project site says otherwise?

still forum
#

I'm using it. And afaik it's fine

#

I don't use BIS functions though

waxen tide
#

okay. can you elaborate on that?

peak plover
still forum
#

Don't know what I could elaborate there

waxen tide
#

thats what i used before atom. but i wanted linting.

#

well why don't you use BIS functions?

peak plover
#

HAHA

#
if (typename _destTarget == typename objnull) then
{
    _dest =
    [
        _destTarget,
        _dest param [1,false,[false]]
    ]
}
else
{
    if (typeName _destTarget == typeName objNull) then
    {
        _dest =
        [
            _destTarget,
            _dest param [1,false,[false]]
        ]
    }
    else
    {
        _dest =
        [
            _destTarget,
            _dest param [1,0,[0]],
            _dest param [2,0,[0]]
        ]
    };
};
#

This is why

still forum
#

I don't need BIS functions. Dunno why.. I just don't

little eagle
#

With frameworks, you also have to protect your variables from the user.

// third party function
user_fnc_customFnc = {
    _array = [];
// your framework
private _array = [user_fnc_customFnc];

{
    //private "_array";
    call _x;
} forEach _array;

Without the commented out line, your frameworks _array becomes overwritten.

#

Because the user forgot private.

waxen tide
#

so private doesn't have a negative performance impact, potentially prevents errors by overwriting unintentionally, and should be considered good practice?

peak plover
#

Yes

waxen tide
#

and they told me i'm stupid when i was a kid.

little eagle
#

I'd always use it, unless it's like a completely isolated loop that will never call any function.

still forum
#

It IS considered good practice. And it actually has a positive performance impact as @peak plover Just found out.
I theoretically knew that. But my Mind is weird

little eagle
#

Then I'd still use it, because autism.

waxen tide
#

^

peak plover
#

๐Ÿ‘

waxen tide
#

likely i would out of habit

little eagle
#

It makes the code easier to read. For me at least.

still forum
#

Plus in Atom private is blue. And I like blue

waxen tide
#

i don't like blue

#

i've gotten used to poseidon autocomplete which deliveres the options in the proper order

#

also i'm disturbed that Atom pretends "BIS_fnc_CodePerformance" doesn't exist until i type it out in full.

still forum
#

Is there even a reason to use BIS_fnc_codePerformance now that it is in engine?

waxen tide
#

who knows. but i noticed that diag_codePerformance is autocompleted just fine and i SUSPECTED there is reasons for that.

little eagle
#
call {
    call {
        call {
            // _var = nil;
            // private _var = nil;
            isNil "_var";
        };
    };
};

Dedmen, can you think of an example were private helps with performance?

simple solstice
#

Can you delete an object created by createSimpleObject? I've read that it cannot be destroyed, but deleted? Via deleteVehicle for example

still forum
#

everytime your scope has more than 0 scopes above

little eagle
#

Yes.

peak plover
#

@little eagle scroll up to Today at 2:38 PM (20 min ago)

still forum
#

Because otherwise Arma checks all scopes above if they have a variable with that name

#

If you scope is 5 deep and the variable doesn't exist. It's 5 lookups

little eagle
#

That would only apply to undefined variables though, no?

#

Then it know when to stop when it reaches the variables home scope.

still forum
#

yes

little eagle
#

Otherwise it would have to walk all scopes.

#

Not very common imo.

still forum
#

if the variable is defined 1 scope higher up. It would check current scope. Then 1 higher up. Find it and overwrite it

#

which is another reason to use private

little eagle
#

Oh, so even assignment would walk up all scopes?

still forum
#

yes

little eagle
#

That happens very often.

still forum
#

Because it has to look if the variable exist anywhere

#

It goes up till it finds it

little eagle
#

True.

still forum
#

If it is privatized it will find it in the current scope without going up. So that's quite fast

little eagle
#

That explains why nigels example with the for scope had private being faster than classic assignment.

#

It had to walk the home scope for all a-f variables.

still forum
#

yep. Although that was only one scope deep. So it only checked 2 scopes. and in the private example it checked only 1.
Even that seems to make a noticable impact

little eagle
#

With frameworks, scopes can go very deep.

#

Like all the ACE shit

#

A)

call {call { call {
    _var1 = 1;
}}};
  • check scope 3, undefined
  • check scope 2, undefined
  • check scope 1, undefined
  • check scope 0, undefined, but the main scope -> write variable

B)

call {call { call {
    private _var1 = 1;
}}};
  • check scope 3, undefined, but this is set as home scope -> write variable
#

This should be the most convincing argument for using private for people that care about code performance.

still forum
little eagle
#

But is this actually how it works?

#

This would mean that the variable is accessible in parent scopes.

#

Which it isn't.

still forum
#

which one?

little eagle
#

_var1

still forum
#

if it doesn't exist in the upper scopes then it creates in current scope

little eagle
#

Or does it simply write it to scope 3 in A, even though it walked through them all?

still forum
#

It only checks if it already exists. If it doesn't then it creates it.
And as you know local variables only go current scope and lower

#

not higher

little eagle
#

By higher I meant higher up in the file.

#

3->0 upwards

#

Just like how the top 10 is above the top 100.

still forum
#

Yeah. I mean the same

#

it check if variable exists in any of the higher scopes. If it doesn't. It creates in current scope

#

same happens too if you access a local var that is Nil

little eagle
#

Yup

#

And if the variable actually belongs to a parent scope, then it's not written to the current one, but that parent scope.

still forum
#

If it already exists. Yeah

#

then it just writes/reads to/from the existing one

little eagle
#

This makes a lot of sense, but I think it's counter-intuitive how adding an instruction (private) speeds up the code.

peak plover
#

It's quite odd, but in reality like Dedmen said, it flips a switch from true to false. So it actually disables functionality, rather than adds some elaborate quirk

#

Which is quite fascinating

little eagle
#

Yeah. It essentially disables the scope walking to overwrite the variable with the same identifier in parent scopes.

#

Which could be rather costly if you have a lot of scopes, like how ACE is designed.

peak plover
#

private ["_var"]; however is slow!

still forum
#

That's not really what it does... But.. If you understand it that way it's fine ^^

#

well. it's kinda how it works

little eagle
#

private array has to iterate through an array of strings in SQF.

peak plover
#

It's a command, yeh

little eagle
#

well. it's kinda how it works
Is there a meaningful difference?

still forum
#

it doesn't disable any functionallity though. It still does the same scope walking. Just it find it in the first scope

#

It just creates the variable in the lowest scope first. Before it does the scope walk

little eagle
#

I see.

still forum
#

Meaning the scope walk turns into a scope stand

little eagle
#

That's how I would've implemented it too.

#

The walk ends at the door.

waxen tide
#
// works just fine
fnc_unnecessary = {
["teleport_id", "onMapSingleClick", "Ivan_fnc_teleport_player"] call BIS_fnc_addStackedEventHandler;
};

DEBUG_SWITCH = true;
if (DEBUG_SWITCH) then {systemChat "DEBUG MODE ON";
  player addAction ["Enable Teleport (click map)",
  "call fnc_unnecessary",
  nil,
  1.5,
  false,
  false,
  "DEBUG_SWITCH = true"
  ];
};
// Error missing ]
DEBUG_SWITCH = true;
if (DEBUG_SWITCH) then {systemChat "DEBUG MODE ON";
  player addAction ["Enable Teleport (click map)",
  "["|#|teleport_id", "onMapSingleClick", "Ivan_fnc_teleport_player"] call BIS_fnc_addStackedEventHandler",
  nil,
  1.5,
  false,
  false,
  "DEBUG_SWITCH = true"
  ];
};
#

I don't understand this at all.

little eagle
#

Escaping strings.

waxen tide
#

duh. thanks ๐Ÿ˜Š

still forum
#

you can see that immediatly if you have syntax highlighting in Atom

little eagle
#

Or the superior Sublime Text 3

cold pebble
#

Sublime is the best ๐Ÿ˜‰

little eagle
#

^ this

waxen tide
#

i do have highlight in atom but it is INFERIOR to atoms because i missed that. obviously.

cold pebble
#

I started in notepad++ and it was horrible, someone told me sublime and the world was saved

waxen tide
#

sublime is hard to beat

cold pebble
#

Indeed it does all you want and more for free

waxen tide
#

i miss a linter for sublime.

peak plover
#

not free 'tho

little eagle
#

A)

call {call { call {
    _var1 = 1;
}}};
  • check scope 3, undefined
  • check scope 2, undefined
  • check scope 1, undefined
  • check scope 0, undefined, but no parent scope left
  • set home to scope 3
  • write variable
B)
call {call { call {
    private _var1 = 1;
}}};
  • set home to scope 3
  • check scope 3, is set as home scope
  • write variable

Acceptable description of the games doings, dedmen?

peak plover
#

1444 ms / 1458 ms

cold pebble
#

As in A/B

peak plover
#

yeah

cold pebble
#

So A was quicker now :/

peak plover
#

1461 ms / 1411 ms

cold pebble
#

Lol

little eagle
#

They're really close. Within measuring error.

peak plover
#

Maybe add more zeroes

little eagle
#

C++ land steps are very fast compared to SQF steps, so a bunch of additional instructions aren't that bad.

peak plover
#

14376 ms / 14060 ms
14585 ms / 14244 ms
10 million times

cold pebble
#

Yay B won twice

#

Well done private!

peak plover
#

I don't wanna do 100 mil, because I don't wanna wait 2 minutes every time ๐Ÿ˜„

cold pebble
#

Haha

#

I think you've done enough lol

peak plover
#

I should just do it with like 100 billion when I go to sleep

cold pebble
#

finds computer on fire

peak plover
#

rent server, install arma dedicated, check code performance, whole serverfarm burns down ๐Ÿ˜‰

little eagle
#

Next petty topic:

255

vs

0xFF
peak plover
#

141 ms / 140.625 ms

#

๐Ÿ˜‚

little eagle
#

๐Ÿ˜‚

queen cargo
#

Difference in Hexa vs nonhexa is meaningless as both are stored in the same way internationally

little eagle
#

agreed

$11111111

is the only true way.

#

This SQF plugin for discord doesn't handle binary and hex.

peak plover
#

$100 142.375 ms / 256 145.429 ms

queen cargo
little eagle
#

$100 is only 4, not 256

peak plover
#

whaaa

little eagle
#

Wasn't $ for bin?

peak plover
#

$100 isEqualTo 256 //true

ivory vector
#

anyone know anything about extb3, with the altis like async function ?

SELECT senderUID,recieverUID,messagecontent,date FROM messages WHERE (senderUID='76561198132926159' AND recieverUID='76561198132926159') OR (recieverUID='76561198132926159' AND senderUID='76561198132926159') ORDER BY date DESC LIMIT 100
``` Query im running works fine in db query but 

Error in expression <!_loop) exitWith {};
};
};
_queryResult = call compile _queryResult;
if ((_query>
Error position: <= call compile _queryResult;
if ((_query>
Error Generic error in expression
File \life_server\Functions\MySQL\fn_asyncCall.sqf [DB_fnc_asyncCall], line 105

peak plover
#

Seems like you have a Generic Error

little eagle
#

Apparently $ is alias for 0x in SQF

ivory vector
#

tried with * instead of selecting coloums, then apparently i was missing an ] on the output

little eagle
#

What is _queryResult ?

ivory vector
#
"SELECT * FROM messages WHERE (senderUID='76561198132926159' AND recieverUID='76561198132926159') OR (recieverUID='76561198132926159' AND senderUID='76561198132926159') ORDER BY date DESC LIMIT 100"
Error in expression <8132926159','76561198132926159',Message Sent,2017-09-01 23:45:58],[56,'765611981>
  Error position: <Sent,2017-09-01 23:45:58],[56,'765611981>
  Error Missing ]
Error in expression <8132926159','76561198132926159',Message Sent,2017-09-01 23:45:58],[56,'765611981>
  Error position: <Sent,2017-09-01 23:45:58],[56,'765611981>
  Error Missing ]
#

_queryResult is the return from the async function

little eagle
#

And what does it look like?

little eagle
#

Because if it's an assignment as last operation, then this is the same error as we had yesterday.

#

Before line 47

#

Add

#
diag_log text _queryResult;
#

And copy paste what it writes to RPT.

ivory vector
#

sec

little eagle
#

It has to be a compile'able string that ends up in a function that doesn't report the assignment operator.

ivory vector
#

hm

little eagle
#

"_a = 1"
would error for example

ivory vector
#

that pulls the right info.

#

with a 1 in the front on the array o.O

still forum
#

@little eagle home is confusing. But yeah.
255 vs 0xFF no difference. Because evaluated at compiletime.

little eagle
#

But what was the keyword for a binary number in SQF, dedmen?

#

$ is just alias for 0x

still forum
#

@little eagle His error says Error missing ]

#

So it's not assignment error

little eagle
#

I don't even know what my string is.

still forum
#

I didn't know you could even do binary

little eagle
#

There is a bunch of strings.

ivory vector
#
['76561198132926159','76561198132926159',Message Sent,2017-09-01 23:45:58]
``` Could it be the way the messagecontent and date are being pulled out ?
little eagle
#

Could be and that would definitely error with missing ]

#

Because Message Sent,2017-09-01 23:45:58 is not SQF

ivory vector
#

why are they being pull out without " "

little eagle
#

Dunno. Don't even know where they come from.

#

How did this string came to be? SQF or C++ extension?

ivory vector
#

sqf

little eagle
#

Can you post that part.

#

Is it using format?

ivory vector
#
params ["_data"];

_returnText = "";

if(isNull (_data Select 2))then{
  _returnText = "Message Failed to Send, the target is not accepting messages at this time.";
};

//Query the receiving guid to make sure the player exists.
_query = format ["SELECT pid, name FROM players WHERE pid='%1'",(_data select 3)];

//Send the Query
_queryResult = [_query,2] call DB_fnc_asyncCall;

//if the query is empty send an error back.
if((count _queryResult) <= 0)then{
  _returnText = "Message Failed to send, the targeted player does not exist!";
};


//If there is no return text already, send the query to insert the message, and send it to the unit :D
if(_returnText == "")then{
  _queryInsert = format ["INSERT INTO messages (senderUID,recieverUID,messagecontent) VALUES ('%1', '%2', '%3')",(_data select 1),(_data select 3),(_data select 4)];
  diag_log format ["%1",_queryInsert];
  [_queryInsert,1] call DB_fnc_asyncCall;
  _returnText = "Message Sent";
};

[_returnText] RemoteExecCall ["ADT_ReturnFromMessage",(_data select 0)];
little eagle
#

Which line. I don't see it

ivory vector
#

its a string passed from a control.

#

then passed straight to this.

little eagle
#

I don't see ctrlText here.

ivory vector
#
//lets make this check early :D
if((lbCurSel 3002) isEqualTo -1)exitWith{hint "Please select someone to send a message to!"};
//Main Display
_display = uiNamespace getVariable ["Lega_CustomTablet_Messaging",displayNull];
//PlayerList
_plist = _display displayCtrl 3002;
//Message Box
_MBox = _display displayCtrl 3005;

//Getting Data from Controls.
_Data = _plist lbData (lbCurSel 3002);
_unit = call (compile _Data);
_Text = ctrlText _Mbox;

//if they are trying to send an empy message. exit here.
if(_text isEqualTo "")exitWith{hint "You cant send an empty message."};
if(isNil "_unit")exitWith{};//Whoops. BadJuJu

//Getting all the data in a neat little array :)
_data = [player,(getPlayerUID player),_unit,(getPlayerUID _unit),_text];

[_data] remoteExecCall ["adt_fnc_serverSort",2];
little eagle
#

_data ?

ivory vector
#

yeah

#

_data select 4 is the message

little eagle
#

I don't see exactly where the issue is, but here is the likely problem:

ivory vector
#

""%3"" should i change to that in the insert ?

little eagle
#
format ["%1", 0];       // "0"
format ["%1", "0"];     // "0"
format ["%1", str "0"]; // ""0""
#

If you use format and you want to preserve a string, then you have to add a str before it in the format array.

ivory vector
#

ill test now ๐Ÿ˜ƒ

little eagle
#

Otherwise the strings quote marks become discarded.

ivory vector
#

as for the timestamp, how would i get around that ?

tough abyss
#

If you updated to extdb3 it will auto convert date timestamps to Arma date array

little eagle
#

So the date comes from the extension?

ivory vector
#

its extdb3

tough abyss
#

Submit repo it should convert the date to an array

slender halo
#

this chan should be renamed reverse_engineering

little eagle
#
"['76561198132926159','76561198132926159',Message Sent,2017-09-01 23:45:58]"

This string can't be compiled.

['76561198132926159','76561198132926159','Message Sent,2017-09-01 23:45:58']

This one can.

ivory vector
#
        version="1.027";
```version of extdb3
tough abyss
#

Also try latest one before you make a bug report

ivory vector
#

Yup, will do , does it have to be a specific type of timestamp in database, there are a few choices ?

#
[1,[['76561198132926159','76561198132926159',"Message Sent",2017-09-02 14:10:38],['76561198132926159','76561198132926159',"Enter your message here.",2017-09-02 14:10:32]]]
Error in expression <iag_log text _queryResult;
_queryResult = call compile _queryResult;
if ((_query>
  Error position: <= call compile _queryResult;
if ((_query>
  Error Generic error in expression
File \life_server\Functions\MySQL\fn_asyncCall.sqf [DB_fnc_asyncCall], line 106
``` so after adding the string, getting that. going to update extdb now and try
#

Ok.

#

updating extdb3 worked.

peak plover
#

Ohh, dedmen are working on TFR? Sweet

#

Thanks a lot, appreciate 1.0 beta

still forum
#

TFAR*

#

is working*

peak plover
#

I always thought Dedmen were multiple people

little eagle
#

There are at least 3 nigel with the same avatar in this channel.

still forum
#

:U Good one..

peak plover
#

men is plural of man

still forum
#

dedmen is a name. Not multiple words connected

peak plover
#

Gotcha

simple solstice
#

Does anyone know a way of detecting if vehicle touched/hit an object create by createSimpleObject?

little eagle
#

There is none. Nothing practical at least

spice kayak
#

Okay, so odd issue - in the init.sqf file for the server, I have this;

if (!isNil "pOperator1") then {
    pOperator1 execVM "operator1Script.sqf";
};

However, everyone who isn't pOperator1 also see's the hint they get, even though the code should be executed locally. That, and for some reason, I get scalar NaN for one of the variable values.

simple solstice
#

That's a shame, wanted to optimise road barriers ;/

spice kayak
#

I'll share the scripts I have with everyone in a little bit, because everything should have worked fine.

peak plover
#

if (player isEqualTo pOperator1)

still forum
#

Yeah... That is correct

spice kayak
#

Oh, that helps.

little eagle
#

init.sqf runs on every machine, not just the server.

still forum
#

if you only want it to be executed on the machine that owns the operator use local to check if he is local

little eagle
#

^

peak plover
#

doesn't local only work on server?

#

nvm

#

that's owner

spice kayak
#

But the execVM "Operator1.sqf" should only execute for the pOperator1, right?

little eagle
#

In your example? No.

spice kayak
#

Damn, okay :C

peak plover
#

if (local pOperator1)

simple solstice
#

Also, BIS_fnc_createSimpleObject isn't working

peak plover
#

@still forum What would you suggest for setting up radios? TFAR functions or modules?

still forum
#

Functions in preInit is most reliable

peak plover
#

preInit? hmm okay, I used to have issues with ACE, where I tried to set variables in preInit, but some functions seemed to run in postinit in ace 3 and overwrote my values

little eagle
#

You might have to use:

if (!isNil "pOperator1" && {local pOperator1}) then {
peak plover
#

YES! ^

#

Very important

little eagle
#

Because pOperator1 looks like a vehicle var name and if AI is disabled, the unit might not exist.

spice kayak
#

What about the player isEqualto pOperator1 part? Would I use that too?

peak plover
#

nah, local is enough

spice kayak
#

And yeah, the mission doesn't use any AI, which is why I was using isNil, just incase there wasn't a player for one slot.

little eagle
#
if (!isNull (missionNamespace getVariable ["pOperator1", objNull])) then {

Alternative ^

#

pOperator1 as variable still exists on every other machine as long as someone took the slot.

still forum
#

TFAR sets default variables at preInit. But only if they are not set already.
So doesn't matter if your preInit runs before/after TFAR

spice kayak
#

Ah, thanks! I'll try out the first one in a little bit. Got to finally test out my mission tonight, which is why I saw all this issues :c

peak plover
#

Ok, that's awesome. Well done

#

Thanks

still forum
#

TFAR waits 5 seconds after respawn till it sets Radio frequencies. If your frequency setting didn't arrive on the client till that point then it will use randomized frequencies.
So if your JIP queue is too full that might cause problems. I think I'll increase that time to 10 seconds though

halcyon crypt
#

can't you "just" EH the setting arriving on the client?

peak plover
#

I can just setFreq. on player as well right?

#

I'll just setFreq for all the channels manuelly

#

I can't figure out how to search in a certain branch in gitHub?

halcyon crypt
#

you can't

#

just the master branch as far as I can tell

#

you'll have to clone it and search locally

peak plover
#

g-g-great

still forum
#

Can you just EH that a JIPed Variable arrives on the client and you have 100% guarantee that it doesn't get overwritten after a few seconds?

#

you have to wait till the player has his Radio then. Before you setfreq

halcyon crypt
#

no clue if you actually can but it seems a common use case for it

#

I guessss

peak plover
#

ohh, really? wait for radio, huh?

little eagle
#

A JIP variable arrives before postInit on the client, even if it was sent at preInit from the server at mission start.

peak plover
#

I can set up TFAR_defaultFrequencies_sr_west

#

ClientInit runs in postInit

#

So if I just set up the frequencies in preinit, when player jips, he should get correct frequencies

still forum
#

default frequencies are taken from a variable on the players group

#

if you set defaultFrequencies. The server detects that and the server set's the group variable and publicVariables it

#

You could just manually set the group variable I guess. That would be way more reliable

#

That's something I left from 0.9.x and didn't want to change. I probably should've though

spice kayak
#

Okay, I'm going to link all the important / main scripts. If anyone wanted to look over it, I'd be extremely grateful. I know it's a bit of a mess, but some of this was written when I first started A3 scripting, so it's been progressing over time, as my skills have progressed.

init.sqf: https://hastebin.com/ibusovujem.sqf
serverScript.sqf: https://hastebin.com/yuyanacuxe.sqf
operator1Script.sqf: https://hastebin.com/axewowiven.sqf
emp1Script.sqf: https://hastebin.com/kuvobagobe.sqf
hudScript.sqf: https://hastebin.com/aceretitut.sqf

simple solstice
#

How do you retrieve the damage of a vehicle now? After hitting a wall, shooting damage returns 0.

#

But if I setDamage it returns the damage just fine

still forum
#

@spice kayak For that much script a github repo would be far easier. In a commit we can just write comments on each line.
Instead of writing the comments hear and looking for the line number every time

#

@simple solstice getHitpointDamage

spice kayak
#

Ah, never used gitHUB, might try it then!

simple solstice
#

@still forum thanks!

still forum
#

or a google Doc where everyone can write comments. That could also work. But that would mean everyone has to show their google account. Which I don't quite like

spice kayak
#

Yeah, that's understandable.

#

I didn't realize how big this mission had gotten until I needed to copy and paste it :C

simple solstice
#

Is it possible to add addAction to an specific index point of a vehicle?

still forum
#

No. afaik.
If you have ACE you can use ACE Interaction menu to do that

peak plover
#

I want _ARRAYELEMTN setVariable or variable setVariable

#

Would make things so much better

still forum
#

setting variables on a variable? :U

simple solstice
#

or setting variables on items

#

THAT would be something

peak plover
#

Setting variable on everything

spice kayak
#

Okay, not going to lie, I haven't used gitHub from the perspective of actually putting stuff on there. THis might take a while haha.

peak plover
#

yeah, same. I got no clue how it works. I just post issues ๐Ÿ˜„

still forum
#

@spice kayak Learning how to use Git will probably be useful to you later on. Version Control is quite important if you write more than a couple small scripts

spice kayak
#

Yeah, maybe so. I've gone with what nigel said haha.

simple solstice
#

Is it possible to check if a certain index of an object is visible to a player?

spice kayak
#

Well, here you go, @still forum. Until I have a better understanding of GitHub, this'll have to do. Sorry!

still forum
#

Get it's position and line intersects

spice kayak
simple solstice
#

@still forum yeah know about lineIntersects but how do I get the positions?

still forum
#

That is even more useless than the hastebin ^^ Because the issue doesn't have line numbers

#

dunno that :u

spice kayak
#

Ha, sorry :c

simple solstice
#

selectionPosition found it ๐Ÿ˜„

still forum
#

I think you can just use the webinterface to add files to the repository

#

Or just "Upload files" and put all your files in there

spice kayak
#

Oh, thank god.

#

Though, now the website won't load for me :(

peak plover
#
private _frequencies = [
    "111",
    "112",
    "110",
    "121",
    "122",
    "120",
    "131",
    "132",
    "130"
];

private _data = [
    0,
    7,
    _frequencies,
    0,
    nil,
    -1,
    0,
    getPlayerUID player,
    false,
    true
];

(group player) setVariable ['tf_sw_frequency',_data];```
#

I'll just run this in preInit for all clients, ensuring they get the same radio freq

still forum
#

yes... looks good I guess

peak plover
#

very interesting stuff

#

I can use vehicleVarName to set up the architecture...

#

And auto-assign channels as well

little eagle
#

There will be no player at preInit.

#

preInit is before any objects are created.

peak plover
#

ohh, right..

indigo snow
#

Stuff like this is best suited to postInit anyway

#

Then gear scripts and all that jazz have had time to run, too

#

Also youre setting a variable on a group, thats dangerous at mission start

#

Groups are wierd then

spice kayak
#

Would preinit be great for stuff like weather sync and what not, or just init?

indigo snow
#

At any moment, really, but the later you do it the less chance something overwrites it after

#

Weather is its own bag of wierd behaviour anyway

still forum
#

You would really need a init. that is between preInit and postInit. But I don't think that exists sadly

indigo snow
#

Init.sqf in SP

still forum
#

will postInit only execute after that is done?

#

or is that scheduled and could run even after postInit?

#

MP init.sqf is completly useless because it is scheduled and there is no guarantee that it is done before postInit

indigo snow
#

Since in MP it runs after ill go and assume theyre not linked in SP either, i guess

#

Is there a CBA init?

still forum
#

@little eagle ?

#

There is a Init XEH. But that is executed when Vehicles are spawned

little eagle
#

What are you trying to do?

indigo snow
#

So when the sqm init fields are parsed

still forum
#

a script like init.sqf but with guarantee that it is done before postInit runs

indigo snow
#

And after preInit

still forum
#

preferably around the same time as init.sqf runs.. Or just before postInit..

little eagle
#

init.sqf is a scheduled script. It might run hours after the mission started.

still forum
#

yeah that is the problem

indigo snow
#

Well yes thats why were asking

little eagle
#

As soon as a script is scheduled, you have no idea when it's done and which of two finishes first.

indigo snow
#

How are pre and postinit called? Engineland or obscure UI script like cfgFunctions?

still forum
#

If there is something like prePostInit.

so
preInit
<init.sqf somewhere in between>
prePostInit (This is what I'm searching for)
postInit

indigo snow
#

PreInitPost

#

._.

little eagle
#

preInit is called by initFunctions.sqf at frame 0.

still forum
#

PreInitPost would be before init.sqf and before objects are initialized

#

I want something before postInit and after init

indigo snow
#

Ah, right

little eagle
#

postInit is called by initFunctions.sqf after a waitUntil {!isNull player} essentially.

#

except for the server and hc

indigo snow
#

So modify it and call an extra script before then is possible

still forum
#

What do you think of adding a prePostInit to CBA?
That calls all prePostInit's first and then the normal postInit. Just to get more granularity

little eagle
#

can't you just manipulate the order of which the postInit things are executed by changing requiredAddons

#

?

still forum
#

you can't in a mission

indigo snow
#

PostPostInit4 level granularity :P

still forum
#

and you can only force others to run before you. Not after you

peak plover
#

prePostInit

#

postPostInit

#

postINit

little eagle
#

postinit and initpost was difficult enough for me.

ivory vector
still forum
#

Right now we have

1
2 preInit
3
<Mission spawns objects>
4
5 postInit
6

I just want EH's for the numbers that don't have anything yet

ivory vector
#

that was what i was working on @little eagle just gotta mess with the colours.

indigo snow
#

Actually what i think would be mostly useful is the one where <Mission spawns objects>

#

There rest is just adding more featurewise

still forum
little eagle
#

Use the init box of a game logic ๐Ÿ˜

indigo snow
#

What if its for an addon?

still forum
#

TFAR is doing that with a Module. But these seem very flaky with JIP.
And that would only work for Missions

indigo snow
#

Modules and JIP is shit either way

#

Its why acre moved to cba settings iirc

still forum
#

I just need a reliably way where people can execute code between pre and postInit.
Because at preInit my Addon initializes it's core stuff. and at postInit it runs.
If mission maker set's stuff at preInit it might be before the addon is initialized. And if he set's stuff at postInit. It might run after the Addons postInit

little eagle
#

init box of any object

still forum
#

and outside of mission ?

#

init boxes are unscheduled?

little eagle
#
// preInit
0 spawn {
    isNil {
        ...
    };
};
#

init boxes are unscheduled?
Yes.

still forum
#

ah yeah. That will work.

#

but I'd really prefer a CBA solution :x

indigo snow
#

PR ;)

little eagle
#

It's bloated already. Stop

still forum
#

@peak plover doing it in postInit should work. Because TFAR will only hand out radios 5 seconds after that.

peak plover
#

Aigh, sounds good

simple solstice
#
lineIntersects [aimPos player, jerry modelToWorldVisualWorld (jerry selectionPosition "head"), player, jerry];
#

jerry is an spawned NPC

#

If i look at him, nothing changes. it always returns false

#

and Im lost. because modelToWorldVisualWorld returns an ASL position, same as aimPos or eyePos

ivory vector
#
onSetFocus = "_this ctrlSetText ''";
``` I should be able to do something like that on a RscEdit ? right ?
little eagle
#

_this select 0

ivory vector
#

Ill try it ๐Ÿ˜ƒ thanks ๐Ÿ˜„

indigo snow
#

@simple solstice youre telling the function to ignore jerry?

#

so ofc it would return false

digital pulsar
#

i have a string that i would like to be interpreted as a variable name, as in alive "_unit"; how do i do that?

indigo snow
#

missionNamespace getVariable ["STRING",objNull]

digital pulsar
#

missionNamespace? even if its private and local

indigo snow
#

what is your string

#

is it really "_myVar"

#

or does it hold the varName of the object

digital pulsar
#

"_unit" lets say

indigo snow
#

then you have to use call compile "_unit" with the sidenote that you can do things in a far better way

#

how do you even end up with a string of a local var

ivory vector
#

Anyone know about issues where ctrlCreate controls, actually end up below, the layer your making them on ?

digital pulsar
#

well ok it's not _unit at all

#

i have three local functions _fnc_a _fnc_b etc

#

each takes one argument

#

i want to apply one of them randomly to that argument

indigo snow
#

arg call selectRandom [_fnc_a,_fnc_b,_fnc_c]