#arma3_scripting

1 messages ยท Page 262 of 1

tough abyss
#

So you could create your own encoding scheme?

#

See where I am going with this?

dusk sage
#

Erm

#

That would depend entirely on what is or will be added

tough abyss
#

Store it as a variable on objects etc.

#

key_value pair

#

Binary number == variable.

dusk sage
#

huh

warped thicket
#

that wouldn't work like that

#

you'd need a string

#

so it's the same thing as sending an ordinary string

tough abyss
#

What would be the use of binary operations anyway?

dusk sage
#

^ it'd be similar to the new binary literals coming to C#

warped thicket
#

because you can't go over 7 numbers, as you will exceed floating point precision

#

uh

#

just google "bitwise operations"

tough abyss
#

I know bitwise functions.

warped thicket
#

it's a very very very common thing in programming

tough abyss
#

Are used A LOT in encryption

dusk sage
#

they are used in pretty much anything

#

(within reason)

warped thicket
#

pure bitwise encryption is not a good encryption though, but yes

#

good read

dusk sage
#

I'm just waiting for a XOR command ๐Ÿ˜‰

median iris
tough abyss
#

I won't accept wikipedia

#

Universities don't I won't.

warped thicket
#

that's stupid

#

try changing something on wikipedia

#

come back in few minutes, you'll see your change reverted

#

majority still wins

tough abyss
#

If universities smack you over the knuckles for using it.

warped thicket
#

uni's don't like it because they want you to do more research

tough abyss
#

I won't accept it.

#

In AU

#

Use wikipedia == fail

dusk sage
#

Or learn to use it properly for University

warped thicket
#

^

dusk sage
tough abyss
#

It is not a credible source.

warped thicket
#

it is

tough abyss
#

No it is not.

warped thicket
#

not as actual sources

#

but credible enough

#

there are a ton of people editing it

#

as I said

#

try editing a big page

tough abyss
#

For that reason it is not credible.

warped thicket
#

you do realize wikipedia is written from other sources?

dusk sage
#

So something written by Alex Allain is more credible than something written by multiple experts, referencing many expert papers/books?

warped thicket
#

^ just wanted to say

dusk sage
#

Wikipedia is past the days of allowing anyone to edit it

#

And serves me amazingly almost every week for my University course

warped thicket
#

and even if you do, they will quickly blacklist you for false edits

warped thicket
#

of course you have to be cautious

#

you also have to be cautious for reading that post you just linked ๐Ÿ˜›

#

the expertise of the posters is not taken into consideration.
it actually is, as I said try changing something

#

and then come back tomorrow

tough abyss
#

A link from Harvard has more credibility than wikipedia ever will.

dusk sage
#

Fact is, Wikipedia posts information from credible (in your world) sources referenced. If you plan to use any information you see on it - read stuff that is being referenced, and reference it (from the references list)

tough abyss
#

The universal constant is wikipedia is banned

#

As I said AU, you will get failed if you use wikipedia ever.

#

Might be why we have some of the best universities in the world.

warped thicket
#

so what do you reference if you have diploma work and you are proving something on a case of some game (eg. machine learning), what do you use as a source?

dusk sage
#

If you were to reference Wikipedia in your work, that'd be stupid

#

Hence why, again, there is references

tough abyss
#

jonpas go through the appropriate channels

#

Scholary databases

#

etc.

warped thicket
#

how will that help me learn a game ๐Ÿ˜„

tough abyss
#

There is plenty of machinery learning papers in those databases

warped thicket
#

...

#

now read what I wrote again

#

you are proving something on a case of some game

tough abyss
#

I was looking for information on nanoparticles as antibotic carriers against multi-straint anitboitic resistant bacteria

warped thicket
#

let's say your diploma is machine learning, AlphaGo

buoyant heath
#

#random

dusk sage
warped thicket
#

you need to understand how Go (the game) works

dusk sage
#

enjoy

tough abyss
#

I was curious if it worked, considerable research in googles scholary database says it is very effective. The game go? Is purely down to game-theory math. Although they successfully taught a machine to beat go using deep neural network learning

dusk sage
#

You seem to be missing the point still

#

Sure you can trawl through countless papers, but as I already said, you can pick up important information, taken out of these papers, and referenced on Wikipedia

#

I wouldn't recommend writing your PhD thesis off of Wikipedia, though

buoyant heath
#

Teachers didn't want us using wikipedia because they didn't want us being lazy and useless when it comes to reseach. We were more than welcome to use the sources the wiki pages referenced though.

tough abyss
#

^

#

I use no wikipedia

buoyant heath
#

Good

tough abyss
#

Learn to filter information.

warped thicket
#

exactly @buoyant heath

buoyant heath
#

then subject is done

tough abyss
#

Scan papers.

buoyant heath
#

and get back to scripting chat

dusk sage
#

You just proved the point we were making

buoyant heath
#

or move to general or something

tough abyss
#

Agreed.

#

One thing to note

#

Why are people trying to encrypt arma 3 code?

warped thicket
#

because reasons

dusk sage
#

Why does anyone try to encrypt anything?

warped thicket
#

I don't understand it either

dusk sage
#

๐Ÿ˜‰

tough abyss
#

A guy wrote an SQF encryption RC4

#

it could do 6KBps

buoyant heath
#

Because people are going to steal their very unique sqf code

tough abyss
#

woohoo! not.

warped thicket
#

all encryption done for PBOs so far can be broken in notepad, sooo

tough abyss
#

SQF code?

#

Unique.

#

Pfft I am yet to see "unique" ideas

#

Truly unique...

buoyant heath
#

It's mostly the life/wasteland/exile servers trying to "protect" their "unique" "features" from "hackers"

tough abyss
#

Everything is either a GTA ripoff Call of Duty or Wasteland variant.

dusk sage
#

There is lots of unique things out there

buoyant heath
#

phwew, wearing out my " key

tough abyss
#

Want to stop your code being ripped

#

Recursively wire everything together so each depends on the next / taking it apart extremely hard.

dusk sage
#

I understand entirely why people do it. Whether it's 'right' or not, that's up for debate

#

The most simple way to 'encrypt' all your client side code, would be to run it through an algorithm, then decrypt it serverside

#

Unless people are going to hack, not much they can do

#

Then you can just take it to the editor ๐Ÿ˜‰

tough abyss
#

Samatras script is encrypted

#

server-side but I was told he stopped working on KoTH long ago @dusk sage

#

And the "life servers"

#

with "unique" features aren't unique.

#

Crafting?

#

Not unique.

#

XP?

#

Not unique.

#

Jobs?

#

Not Unique.

#

So remind me which is unique?

#

One of the more unique missions I played but no one plays it.

#

Was GetWrecked

dusk sage
#

There is going to be servers out there with unique stuff

#

You could argue

#

Anything on ARMA 3? - not unique

#

But we aren't that pedantic

tough abyss
#

I am.

#

Been trying to find away to revamp I&A

dusk sage
#

Then this game isn't unique, nothing on it is

tough abyss
#

Or completely start from scratch.

#

The game is unique.

#

A lot of the "missions"

#

are not.

dusk sage
#

How is the game unique

paper rain
tough abyss
#

Terrain size for 1

#

Yes move to Offtopic

open vigil
#

I enjoyed Get Wrecked

noble juniper
#

well i actually didn't had the chance to play it sadly

#

but in terms of uniqueness, if you use the same framework as everyone, then you are close to not being unique.

#

And keeping people from ripping your code, you can make a mod and implement some decryption capabiletys

#

Or have decrypt scripts serverside, or keep everything serverside, or

#

siomply, write code that is very backend reliant, that doesn't work witout the backend. And maybe even encrypt the small clientside. or what ever, there are easier ways of making it hard to rip

dim owl
#

how can i hide the dlc menu when im pressing shift+p ?

tough abyss
#

You can't....

#

Or well.

#

Come to think of it you probably could..

broken mural
#

With an object spawned and the name of that object declared as "someguy_1", why is missionNameSpace getVariable "someguy_1" returning <NULL -object> and not the object?

tough abyss
#

But I am not going to tell you how to do it @dim owl

#

Especially if you haven't paid for the DLC's

dim owl
#

i have paid but some persons who play on my dont own it

dusk sage
#

You could block it in onKeyDown?

#

Not sure, maybe

tough abyss
#

Nah I was thinking of intercepting the IDD

#

value BoGuu

dim owl
#

but i want to call a script when i press shift+p xD

tough abyss
#

You'd need the IDD value of the DLC window

broken mural
#

block it and redirect to a script then

dusk sage
#

^ with onKeyDown

dim owl
#

okay. like closedialog 0; []execvm myscript.sqf

dusk sage
#

no

#

If onKeyDown returns true, you'll block it

#

(if it still applies for the DLC window, I dunno)

paper rain
#

Just the same that you can't control the Esc menu, really

tough abyss
#

I am betting not @dusk sage because I think that data is squirreled away inside an EBO

dim owl
#

how could i block it ? i dont have a idea.

dusk sage
#

It doesn't matter if it's in the EBO

#

Look up the keyDown EVH

dim owl
#

okay

dusk sage
#

If it doesn't work, it's not down to the EBO

paper rain
dusk sage
#

^ all the info you need

paper rain
tough abyss
#

I think 46 is the primary window IDD

dusk sage
#

You'll want the display

tough abyss
#

(findDisplay 46) addDisplayEventHandler ["KeyDown", ""] @dim owl

dim owl
#

okay. try it tommorow

broken mural
#

bleh, I'm clearly doing something wrong with this.
d = vehicleVarName cursorObject; _object = missionNamespace getVariable d; c = vehicleVarName _object;

in debug results in this:

d = "someguy_1"; c = "";

What am I doing wrong here?

tough abyss
#

setVariable first?

paper rain
#

_object = missionNamespace getVariable "d";

broken mural
#

@paper rain d is already a string as vehiclevarname returns a string

#

@tough abyss set what value?

paper rain
#

but d is named "d" in the missionNamespace

tough abyss
#

Oh?

paper rain
#

IIRC

broken mural
#

@paper rain testing.

tough abyss
#

@broken mural Exactly what @paper rain said

#

Not defined?

broken mural
#

d = vehicleVarName cursorObject; _object = missionNamespace getVariable "d"; c = vehicleVarName _object;
results in Error VehicleVarName: Type String, expected object.

#

at position c = |#|vehicelvarName _object;

tough abyss
#

vehicleVarName returns a string

#

try this

broken mural
#

@tough abyss correct. error is occuring on setting c.

tough abyss
#

c = typeOf(_object)

paper rain
#

or d = cursorObject;

tough abyss
#

That should return the vehicle object

#

Returns a string

#

Typical type coercion problem -_-

paper rain
#

No, typeOf returns the vehicle class string

broken mural
#

@tough abyss c = vehicleVarName typeOf(_object);> 19:12:21 Error position: <typeOf(_object);> 19:12:21 Error typeof: Type String, expected Object

tough abyss
#

One of them returns object

#

I can't remember the command

paper rain
#
_object = missionNamespace getVariable "d";
c = vehicleVarName _object;```
broken mural
#

@paper rain the problem is Im working with just the variable name. Im using cursorObject for debugging purposes.

tough abyss
#

One thing to note about CursorObject

#

it has to be "revealed to you"

#

My own testing showed once that you have to "spot / reveal" whatever you are pointing at

#

To give you some better understanding of this

broken mural
#

so for arguments sake lets say I spawn a box, and that box is named "thisDamnBox" in the editor. I want to reference that box by varname only (lets say it's hidden and I want to unhide it, for example). How can I reference that object via the variable name alone?

tough abyss
#

Are you using the debug console?

paper rain
#

objNull is the default return

#

for cursorTarget atleast

tough abyss
#

@broken mural Is this via debug console?

broken mural
#

@tough abyss yes, currently Im standing in front of the object and setting d = vehiclevarname cursorObject

tough abyss
#

do this

#

See the 4 watch fields in the debug console?

#

type into of them

#

cursorTarget

#

Then look at him.

broken mural
#

<NULL -object>

tough abyss
#

Thats why.

broken mural
#

What does that suggest, though?

tough abyss
#

Press T

#

to reveal him

paper rain
#

No, it's still a typeconflict, because the default return is stuill an object

#

and typeOf returns a tring, not object

tough abyss
#

I said only use cursorTarget it's still returning null

#

Watch fields are very useful

#

for working out small things

#

They run in unscheduled environment too

broken mural
#

hitting T revealed the object, but I wont have access to any of that from in game. All of this will be happening server side.

tough abyss
#

Okay

#

So you can use this

dusk sage
#

cursorTarget shouldn't be affected

paper rain
#

Can you... run cursorTarget on the server?

dusk sage
#

it has none

tough abyss
#

^

paper rain
#

objNull all day, every day

tough abyss
#

What is your actual goal @broken mural

#

?

#

Got the code chunk?

dusk sage
#
_d = vehicleVarName cursorObject;
_object = missionNamespace getVariable _d;
#

you went from having the object, to having a string, to having the object again

tough abyss
#

vehicleVarName only returns missionNameSpace anyway?

dusk sage
#

It returns a string

tough abyss
#

the value of vehicleVarName returned will be local to the PC on which command is executed

broken mural
#

Okay so lets back up because I think I might be going down the wrong path with this.

I have 2 AI dudes. One spawns hidden. When the first dies, I want the other to unhide.

I have their names set in an array, and when one dies, their name is removed, and the next one is grabbed and is suppose to have _object hideObjectGlobal false ran against it. The problem I have is Im trying to reference the remaining, invisible AI based on it's varname.

["dude1", "dude2"] _myObjectInstance = missionNamespace getVariable "dude2"; _myObjectInstance hideObjectGlobal false;

tough abyss
#

So it effectively is missionnamespace only anyway

broken mural
#

@dusk sage I was doing that to see where the breakdown occurs.

tough abyss
#

"Local to the machine" it is executed on"

dusk sage
#

okay

#

so you named both your AI?

#

dude1 & dude2?

broken mural
#

correct.

dusk sage
#
dudeX hideObjectGlobal false
#

dudeX is your missionNamespace object variable

#

dude1, dude2, etc

#

For proof of concept, type dude2 setDamage 1

broken mural
#

Its a bit more complicated then that. When they spawn their names are added to an array and are referenced later. This causes the problem where I need to set an object variable to utilize hideObjectGlobal

dusk sage
#

Then store their objects

#

[dude1, dude2]

broken mural
#

I'll look into that.

#

@dusk sage I have no idea what warped concept i had running inmy head when I thought it was a good idea to add the variable name to the array and not the actual object -_- thanks for the help all

dusk sage
#

๐Ÿ˜‰

#

Was a little confusing

broken mural
#

YAY it worked!

#

any idea how to checkif an object has an eventhandler?

dusk sage
#

Hmm

#

I could have sworn there was a command, but it doesn't seem so

#

Do you need info on them, or just to know if one exists?

broken mural
#

I'd prefer checking if the eventhandler exists, tbh

dusk sage
#

What eventHandler?

broken mural
#

the array contains a bunch of different objects, not just AI, and some of the AI have damagehandlers, Killed handlers.. if they are invis I'm switching them to be immune to damage, but when I show them I need them to go back to the original status. A box isn't going to have that handler though lol

#

Currently, just need the HandleDamage

dusk sage
#

Check if they are isKindOf 'Man'?

broken mural
#

Might work but just noticed I have different types of damage handlers. All good I found a workaround.

dusk sage
#

hmmm?

broken mural
#

@dusk sage eh thought I found the problem to my question but totally didnt ._. I'm trying to consolidate code Im reusing by creating a function in the same .sqf file

#

`universalDetails = {
_var1 = _this select 0;
_var2 = _this select 1;
_var3 = _this select 2;

//some code that uses these variables
};`

and calling said code;
["one", "two", "three"] call universalDetails;

but i get a weird, generic error. Error undefined variable in expression: universalDetails. Ideas?

dusk sage
#

can you use:

#

```
//code
```

broken mural
#

Yes. I'm actually doing that code about 50 times lol

#

just with different values

dusk sage
#

I mean in discord

#

Can you post the code with ```code```

tough abyss
#

"Since you play for 1 hour, and not 0.001 seconds, use [] spawn {}!" Magus

#

People trying to avoid spawn, create tons of problems and archieve worse situation, that inclusively affect gameplay and "soul".

#

So i start to think what really is inteligence. Good night.

#

"In the future, code execution lag will be 0. You can play 10 hours of your favorite game in 0 seconds" Magus

dusk sage
#

What is going on ๐Ÿ˜ฎ

halcyon crypt
#

๐Ÿค”

icy raft
#

Any C++ guys here???

tribal crane
#

tool_makers definitely has some

halcyon crypt
icy raft
#

(L)

#

thanks

#

just trying

#

I'm just too new to C++ and trying to do threaded network stuff

#

-.-'

#

Will work it out

#

Some year

tribal crane
#

Are you using boost::asio?

icy raft
#

Not so low-level now

#

libjson-rpc-cpp

#

But will look at it

tribal crane
#

For a callExtension .dll?

icy raft
#

I come from Java, so C++ is weird for me

#

yep

tribal crane
#

KK had some stuff about keeping from blocking the A3 thread.

#

(Or he was playing with it at least)

icy raft
#

Testing stuff, wanna make a RPC system that is hosted in NodeJS+MongoDB in a remote server for data

#

Nah, the theory it's what I got right, making thread and a ticket system for polling data

#

It's similiar to what extdb2 does

#

But maybe is better to go thought sockets... I could build my own protocol on top of TCP

#

And yeah, KK has great stuff about ANYTHING

Love that guy

tribal crane
#

Yeah, I wouldn't bother with json-rpc, a web socket library sitting on boost:asio would probably be cleaner

#

boost::asio has built in support for calling from the A3 thread into the websocket thread like you need to.

little eagle
#

Thank you @tough abyss . That got to be the most retarded thing I've ever read.

icy raft
#

The idea is to make an extra thread that gives futures and promises (if return value is expected) so it just posts the request and give a request ID back to SQF space, then keeps a new thread waiting for the response and it's responsability of the SQF to check from time to time if the C++ thread got a response, if not, keep waiting

#

lol @little eagle

#

Arma 3 used ASCII or UTF-8?

#

I believe it was ASCII but not sure now

little eagle
#

SQF variable names do not support ASCII characters.

#

you can have them in strings, but most string commands bug out with them

#

stringtables on the other hand even have Japanese and stuff

icy raft
#

Hmm... Yeah, but they must use some enconding standar right?

little eagle
#

Variable names?

icy raft
#

Or are they just being lazy and using a custom one?

#

Nope, string encoding

#

Char tables

tribal crane
#

Which string commands fail with characters 128-255?

little eagle
#

I think unicode, considering you can use:

#

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

icy raft
#

Hahahahaha

little eagle
#

splitString , select, find

#

they all bug out on ASCII chars

icy raft
#

Nah, it's just I'm trying to figure out which char use as delimiter that won't be used by idiot players

little eagle
#

Everything that is used as HTML command if you plan to use structured text with player names

#

< > etc

icy raft
#

I'm trying to do a protocol between C++ and SQF, and as they connect though strings, I want to find a char that I can use as a separator that even the most completely uselesss and idiotic user won't use

#

Like in "get:steam_id:money:position:health:name", but I'm sure some player is capable of calling himself ":::::::::::::"

#

And that would be very painful to a few people...

tribal crane
#

You can use str on an array

tough abyss
#

@icy raft You don't need a delimiter anymore, since arma3 escapes quotations now i.e possible to parse a str _array correctly now

#

Also pretty sure its utf8

icy raft
#

@tough abyss What you mean? And if it really is UTF-8 that rocks, can play the bit lover card

#

ah you edited, i'll check it

#

Oh, okay

tough abyss
#

i.e a rough example.
_data = [_playerID, _pos, _inventory]
"dll" callExtension (_str [ _jobID, _data]);

You can parse the stringified array inside the extension. No need for a delimitator at all

icy raft
#

I can parse it back easily

#

@tough abyss Thanks!

#

Hah! I'm now creeping your GitHub

#

I was sure I saw your name earlier

#

Now I know why

tough abyss
#

Don't have any public code for parsing an array ;)
Still need to finish coding it & make sure its faster than using seperators.
Since you just need to parse enough data before handing if off to seperate thread

tribal crane
#

stringJoin is quicker aparently

#

or joinString

#

But the difference is probably not worth caring about

icy raft
#

Following you, you seem to have neat stuff there

#

"Overoptimization too early is the root of all evil"

halcyon crypt
#

drop the "Over" and you're good ๐Ÿ˜„

tribal crane
#

Inexperience is the root of all evil

icy raft
#

Hahahaha

#

Inexperience is fun, you feel like a child going all around and touching everything, but from time to time something drops and breaks, but still fun

tough abyss
#

"Code in the future will be manage waits and sleeps" ๐Ÿ˜›

icy raft
#

"Code is the parents" Akryllax, ruining childhood fantasies since 1994

tough abyss
#

"I like this game that happens on year 69483784578383"

tribal crane
#

@tough abyss Does the Discord not compatible with the sheep head?

meager granite
#

@icy raft Do it through ids, not names

lunar lichen
#

anyone know how to get a variable of an object from an object
for example i set an addaction
_npc addAction["test123",this getVariable "thisvar","",0,false,false,""];
it wont get the var, with this reportign as undefined

#

and i got it ยฌ.ยฌ

#

_this select 0;
as its relation to the object

#

fml

tough abyss
#

@little eagle you only say that to persons you consider cool.

#

@tribal crane sheep head?

#

cheap head?

#

Discord is compatible with everyone.

tribal crane
#

No, sheep head.

warped thicket
icy raft
#

@meager granite I was going to use steamid as key, more unique than that can't be ๐Ÿ˜„

tribal crane
#

intercept is a pretty big risk for something simple

icy raft
#

@warped thicket Interesting...

#

But I'm using this as a learning tool, so I don't want to rely too much on third parties or I won't actually learn anything haha

#

But will check it, everything adds on

broken mural
#

I have a group of AI spawning with a damage handler that makes them immune and hides them, and when a trigger is activated Im trying to get them to unhide, remove the original HandleDamage eventhandler and add in a new one. This is hit or miss. Ideas?


                _x addEventHandler["HandleDamage", 
                {
                    _unit = _this select 0;
                    _damage = _this select 2;
                    _shooter = _this select 3;
                    if (side _shooter == side _unit)then{_damage == 0;_unit setDamage 0;};
                    _damage; //return damage value.
                }];
            };```
broken mural
#

I've also tested with _x allowDamage false; instead of creating a handleDamage EH (though from what i've read they are the same thing)

twilit nymph
#

How to do multiline comments in arma scripting?

indigo snow
#
/*
like this
*/
twilit nymph
#

Thanks ๐Ÿ˜›

twilit nymph
#

To make a vehicle not move do I need to put Init code in group or the driver unit?

indigo snow
#

not move in what way?

twilit nymph
#

figured it out

#

Put this init on driver

this disableAi "Move";

He won't move even if I use zeus and tell him to move

#

I know I could just set fuel to 0. But I wan't players to be able to take the ride

#

I understand I have taken water over my head with my next obstacle. I want my players to dive to land, walk up to a cargo container, then script the container to have a "scroll option" rearm or something that changes from diving gear to spec ops gear (uniform and stuff)

#

I know (can figure out) how to remove all items and add what I want by scripting. However to make functions and call them by a player interacting with an object is my real issue

indigo snow
#

well to let players interact with them you'd use addAction

twilit nymph
#

["Change loadout", [this, true]] spawn customFunction;

#

That won't work?

#

Just guessing based on this code

["AmmoboxInit", [this, true]] spawn BIS_fnc_arsenal
#

Nvm

#

How and where to add custom functions though?

#

In init.sqf?

indigo snow
#

anywhere. functions are just a variable that contain a code block

#

my_fnc = { hint "hi" };

#

call and spawn take the value to their left and execute the codeblock to their right

twilit nymph
#

Thanks, you are really helping me out here @indigo snow

#
addAction ["Change Loadout", {call fnc_change_loadout}];

How to send unit variable name to the function and change based on what unit it is.

fnc_change_loadout = 
{
   if (_player  = "teamLeader") then{
      removeAllItems _player;
      _player addItemToUniform "ACE_morphine";
   };
   if (_player = "medic") then{
       removeAllItems _player;
       _player addItemToUniform "ACE_epinephrine";
};

This in init.sqf

#

I imagine this is far off how to do it, but you hopefully understand what I want to do

#

@indigo snow

#

_this select 1 maybe?

#

Instead of _player

buoyant heath
#

_player is a private variable you'd need to define. player is the a3 reference to the player unit. = is only for setting values. You need == or isEqualTo for comparisons depending on what you're doing. You'll also need to get the role (I think) of the player unit to be able to compare to "teamLeader" or "medic"

indigo snow
#

this is the syntax for addAction: unit addAction [title, script, arguments, priority, showWindow, hideOnUse, shortcut, condition, radius, unconscious]. You already put in a title and script, arguments would be the value after that.

twilit nymph
#

This says _this select 1 in script will refer to the unit that activated the action

#

I do not need to pass any additional arguments then yeah?

indigo snow
#

ah true indeed

#

params ["_target","_caller","_ID"]; would set up these values into local variables for you to use

twilit nymph
#

This

this addAction ["Change loadout", {removeVest _this select 1}];

Gives this
error type array, expected object

indigo snow
#

its seeing (removeVest _this) select 0

#

try removeVest (_this select 0)

#

(also the player would be the caller, and thus _this select 1)

twilit nymph
#

Finally

#

Thanml

#

Thanks

#

This is what I did:

this addAction ["Change loadout", "fnc_change_loadout.sqf"];

and this in fnc_change_loadout.sqf

_caller = _this select 1;
removeVest _caller;
#

Imagine it is going to be easy from here on

twilit nymph
#

I see you already answered this @buoyant heath

buoyant heath
#
  1. _caller is a unit. It's not going to be == "teamLeader"
  2. you use this instead of _caller
twilit nymph
#

How to get role thought?

#

Doesnt work

#

Remember the pastebin is my sqf file

#

And I'm using addAction to access it

#

_caller = _this select 1;

#

Thats my first line of code

#

Code from line 1 to 11 works fine

#

It removes my items

#

But the if statement fails

buoyant heath
#

That's because _this select 1 is the player's unit.

#

You then try to compare <unit> == <string>.

twilit nymph
#

I see

#

How to do it then?

buoyant heath
#

Then inside your if you use this as a reference, which is an unrelated problem

twilit nymph
#

Oh sry

#

I have tried with _caller instead

#

Wrong code uploaded to pastebin

#

Change all this to _caller

#

Thats how it really is

#

This is my current file

#

Lol

#

I fixed

buoyant heath
#

On a side note, if you haven't tried it, I find codeshare.io more convenient than pastebin.

twilit nymph
#

Just had to remove ""

#

from if

#

Like if (_caller = teamLeader) then

#

Thanks

buoyant heath
#

You could try if (isFormationLeader _caller) then {<code>}; That might work for what you need.

twilit nymph
#

This works

#

How to best do elseif in arma scripting`

#

?

#

Nested ifs

buoyant heath
#

That or a switch-case

#
if (a) then {
    stuff
} else { 
    if (b) then {
        stuff
    } else {
        if (c) then {
             stuff
        }
    }
}```
twilit nymph
#

Thanks

buoyant heath
#

or

switch (<condition>) do {
    case 1: { <stuff>};
    case 2: { <stuff> };
    default { hint "default" };
};```
twilit nymph
#

Why does this not work?

intel1IsAdded = false;

if (intel1IsAdded isEqualTo false) then{
    teamLeader createDiarySubject ["intelligence", "Intelligence"];
    teamLeader createDiaryRecord ["intelligence", ["Nightvision", "We have aqquired intel that suggest Daesh has been donated nightvision. Be aware!"]];
    hint "Intel has been added. Check it out!";
    intel1IsAdded = true;
}else {
    hint "No new intel availible";
};
#

Seems like it is not able to save intel1IsAdded var from time to time

#

This is a sqf file I call from a units addAction

#

Ahh

#

Next time it runs it sets it back to false

tough abyss
#

Logic flaw?

twilit nymph
#

Yea

tough abyss
#

if you want a piece of code to exit

#

the scope after a condition is met

#

use exitWith {};

#

problems with addactions they experience the same issue with eventHandlers

twilit nymph
#

Huh

#

Dumb it down for me? ๐Ÿ˜›

tough abyss
#

So where do you want the addaction to be available?

#

Have you got the addacton?

#

code as well?

#

You can think of an addaction is very much like an eventhandler

#

Actually it very similar to an event handler

#

They both handle a "type of event"

twilit nymph
#

Ill find it

tough abyss
#

E.g addaction creates a text-box type thing that you can interact with and fires when you hit spacebar on it or etc.

twilit nymph
#

this addAction ["Ask for intel", "fnc_intel1.sqf"];

tough abyss
#

Add the condition for is leader into the addaction

twilit nymph
#

Have this in a civilian init

tough abyss
#

Because there is 2 problems with your script

#
  1. Is locality.
#

addaction is local to the machine that executes it.

#

Unless it is placed onto the init of a object.

twilit nymph
#

This is what I want to do:

Have a Civilian in which you ask for intel. First time you ask every player gets the intel. If someone ask again a hint pops up with "No new intel"
```'
tough abyss
#

which the this addaction ["Ask for intel","fnc_intel1.sqf"];

twilit nymph
#

That is in the init of a unit in my mission yes

tough abyss
#

I am assuming is on the civilian?

twilit nymph
#

Yeah

tough abyss
#

Okay so that addaction is global then

twilit nymph
#

Like executed on server not clients?

#

Am I understanding you correct?

tough abyss
#

No when it's inside the init of a unit / object / vehicle

#

It is global

twilit nymph
#

Okey

tough abyss
#

the this

#

Means this "object"

twilit nymph
#

I know

tough abyss
#

this thing etc

#

So you want to check if they're a leader correct?

twilit nymph
#

I could just name him dude and use dude addAction in init.sqf instead

#

No no

#

That doesnt matter

#

Its 4 players

#

Anyone can get the intel

#

The teamLeader is just my varName for the player

tough abyss
#

Okay so lets look at your logic here. When you call this code via the "Addaction" which is effectively an eventhander.

#

You do know what EVH's are ?

twilit nymph
#

Ehm I remember some stuff from my earling codin

#

programming in school'7

#

But basically no

tough abyss
#

Okay eventhandlers are things that fire when a specific event is trigger.

twilit nymph
#

Yeah

#

I understand

tough abyss
#

Say. Real-world example would be if I sat down on a chair and added an event handler to the chair

#

That event would "fire"

twilit nymph
#

I get it

#

Like when I click space on the dude

#

A code is exectuted

tough abyss
#

Okay. Now this addaction adds an action like a loop to whatever.

twilit nymph
#

executed

tough abyss
#

It may as well be a sort of loop

twilit nymph
#

But it doesnt loop

tough abyss
#

In essence it kind of does

twilit nymph
#

For each time I click space yes

tough abyss
#

When ever you add the action it will be there for ever that a condition is true

twilit nymph
#

And that makes my variable false again

tough abyss
#

Exactly

twilit nymph
#

I get that

tough abyss
#

So think of a way you can completely jump out of the code after a check becomes true?

twilit nymph
#

Ahh

tough abyss
#

And skip straight to the else clause

twilit nymph
#

I see

tough abyss
#

See what I mean by addAction basically being a loop

twilit nymph
#

I remember this from my python programming

#

Yeah

tough abyss
#

I've experienced this same problem with eventHandlers

#

If you set a condition when ever they fire.

#

and it runs again it will just reset it back to that conditioon

#

and effectively be a never-ending loop

twilit nymph
#

What if

Next time I run it it won't change it back to false then. But should still be able to access it since I set it as a global variable?```
tough abyss
#

Global variables don't mean "public"

#

If this is an MP mission you've got to consider public vs global

#

Global is accessible to the machine that "has the code" / variable

#

even if it's run from the init.sqf

#

It doesn't necessarily mean it will be public

twilit nymph
#

You sure that won't work?

tough abyss
#

You can easily see if yoour variable is or is not public

#

In the watch fields of the debug console?

#

You know the debug console?

twilit nymph
#

You saying it would work for me as host, but not my friends playing with me?

#

Yeah

#

I'm checking

tough abyss
#

Okay 4 boxes below the main console window "Are watch fields"

#

type your "teamLeader"

#

var into the box

#

If it is undefined it will show nothing

#

if it is defined it will show the variable

#

4 watch boxes 4 outputs

twilit nymph
#

teamLeader is not the var

#

Thats my object

#

An objet

tough abyss
#

Yes he is a variable

twilit nymph
#

object

#

Ahh

tough abyss
#

Still a variable.

#

so you can check him

#

if he is a "global"

#

so in the first watch box type teamLeader

#

If it returns nothing you've got a locality issue

#

or the box flashes orange.

twilit nymph
#

intel1IsAdded is thye importent one though

#

And adding intel1IsAdded = false in init.sqf shows me false when I write it in watch

#

teamLeader also shows me

#

So that works too

tough abyss
#

Okay so no locality issues

#

So we only have a purely logical based issue

twilit nymph
#

After running my script it shows trye

#

true

#

So yeah fixed

#

But new question

#

When I use <this> createDiaryRecord does it add only for the object i write instead of this?

#

Or the group of that object?

tough abyss
#

If this is used

twilit nymph
#

cant use this

tough abyss
#

It has to be passed through the addAction

twilit nymph
#

Yeah

tough abyss
#

Not hard.

twilit nymph
#

I have already been tehre

#

there

#

In this script

#

But does createDiaryRecord add only for that unit?

tough abyss
#

Yes

twilit nymph
#

Like my group cannot se the same diary record?

tough abyss
#

createDiaryRecord is local to that unit only

twilit nymph
#

Is there an array for all playable units then?

#

And then loop through that?

tough abyss
#

Local to the unit

#

I'm not deeply familiar with locality @little eagle is much more.

little eagle
#

you don't have to iterate through all units
This:

is local to that unit only
is badly worded. A command can have local effects on a machine. It has nothing to do with single units / objects

twilit nymph
#
{_x createDiarySubject ["intelligence", "Intelligence"];} forEach [teamLeader, marksman1, rifleman1, breacher1];
little eagle
#

nope, that is wrong

#

See:

A command can have local effects on a machine. It has nothing to do with single units / objects

#

createDiarySubject creates the diary entry on the machine where the command is executed

twilit nymph
#

And in my case that is host/server?

little eagle
#

nope

twilit nymph
#

I don

#

dont understand

little eagle
#

The statement code of addAction thingies is only executed on the machine where the action was used. Where a player clicked on it

twilit nymph
#

So in reality all four players need to click?

little eagle
#

for the entry to appear. yes

dusk sage
#

If you tried to createDiarySubject on teamLeader, from marksman1's machine, nothing would happen

little eagle
#

but that is not what you want, right?

dusk sage
#

teamLeader needs to run it himself

twilit nymph
#

It is not

#

I want any of my four players to be able to click and everyone gets it

little eagle
#

Then I suggest you write a script, name the file something like "createDiaryEntry.sqf"

#

you precompile the script in init.sqf, in the same place where you use addAction

twilit nymph
#

I have a script called fnc_intel1.sqf

little eagle
#

And then you execute that precompiled function via remoteExec

twilit nymph
#

Hmm

#

I gotta wrap my head around this

little eagle
#

ask away if you have any questions

twilit nymph
#

This is my fnc_intel1.sqf

little eagle
#

remoteExec just makes it so that the function is executed on every machine

tough abyss
#

He could also use remoteExec

#

using only the commands

twilit nymph
#

my init.sqf

#

And this is the init of the unit

#
this addAction ["Ask for intel", "fnc_intel1.sqf"];
little eagle
#

yeah. currently intel1IsAdded will only be set to true on the machine where the action was clicked

#

because that whole script is only executed on one machine

twilit nymph
#

I see

little eagle
#

you could execute that via remoteExec

tough abyss
#

[teamLeader,["intelligence", "Intelligence"]] remoteExec ["createDiarySubject",0,false];

little eagle
#

But you have to precompile it first

twilit nymph
#

What if:
I use remoteExec in the units init?

little eagle
#

No, sending every command is suboptimal

tough abyss
#

Really?

#

More over-head?

#

or less?

little eagle
#

Youd have to do it for multiple commands

#

obviously it is

tough abyss
#

Okay.

twilit nymph
#

I am getting confused

little eagle
#

A good question though is, whether init.sqf or the JIP stack is executed first

#

I have no idea

twilit nymph
#
  1. Don't know how to precompile.
  2. Never used remoteExec
tough abyss
#

JIP = false

#

So no.

little eagle
#

?

tough abyss
#

init.sqf

#

Doesn't have tick for JIP

little eagle
#

yeah, in SP

#

in MP it has

twilit nymph
#

I thought what I was trying to do was an

#

easy task

little eagle
#

It is easy, Cisco

twilit nymph
#

Simply add intel for all players

#

Ahh

little eagle
#

No problemo

#

To precompile:

twilit nymph
#

Thank god

tough abyss
#

Interesting I might wrap my own function up using the create diary records

#

into 1 piece of code and use it as part of my framework

little eagle
#

My_function = compile preprocessFileLineNumbers "myFunction.sqf";

tough abyss
#

Re-usable code ftw

twilit nymph
#

And I put that in init.sqf?

little eagle
#

If you use that line, you can remotely execute "My_function" everywhere using remoteExec

#

yes, it has to be precompiled everywhere

twilit nymph
#

So not only init.sqf?

little eagle
#

init.sqf is everywhere

twilit nymph
#

Ahh

little eagle
#

although again, I'm not sure if that is safe for JIP

twilit nymph
#

That is Join in progress?

little eagle
#

init.sqf is shitty scheduler wizardry. It works, and then one day it stops working

twilit nymph
#

I do not believe I am gonna have people join in progressยจ

little eagle
#

yes, JIP = join in prgress

twilit nymph
#

Its a coop for me and three friends of mine

#

Ill have them join before i start the mission

#
intel1IsAdded = false;
add_intel1 = compile preprocessFileLineNumbers "fnc_intel1.sqf";

This is my init.sqf now

little eagle
#

Okay. I wouldn't be content with that but w/e

twilit nymph
#

Where to use remoteExec?

little eagle
#

I want my scripts to work in savegames loading in local hosted MP^^

#

Inside the addAction

twilit nymph
#

Im just starting with this scripting

#

It's further down the road for me

#

Three days ago I didnt know how to add virtual ammobox for objects

#

So Its fine for now

little eagle
#

Well. Tbh, I would have to look that up too

#

The problem with Arma is that it has no sane standards on how to do things. Everyone just jumps straight into init.sqf

twilit nymph
#

Yeah agree ๐Ÿ˜›

tough abyss
#

["AmmoboxInit",[ammobox,true,{true}]] spawn BIS_fnc_arsenal;

#

by the way if you do that

#

you should run on all connecting clients

#

["Preload"] call BIS_fnc_aresnal;

little eagle
#

["Preload"] call BIS_fnc_aresnal;
Insanity

tough abyss
#

Why?

twilit nymph
#

What I never ran the preload thing

tough abyss
#

Otherwise on our server we were experiencing extremely long delays with aresnal loading

twilit nymph
#

And got no issues

little eagle
#

if the arsenal was written by me, there would be no need to preload it

#

also typo

twilit nymph
#

Lol

little eagle
#

Otherwise on our server we were experiencing extremely long delays with aresnal loading
Scheduled environment....

tough abyss
#

Is there anything wrong with using function-as-files to create vehicles?

dusk sage
#

scheduled isn't that slow

tough abyss
#

Say for example I wrapped a single function into itself to allow me to basically plug in any vehicle.

dusk sage
#

shouldnt be causing really long delays

tough abyss
#

and it's position then spawn it?

#

Is that bad or good?

dusk sage
#

function-as-files
?

#

Files for functions?

twilit nymph
#

Correct?

this addAction ["Change loadout", remoteExec["fnc_change_loadout.sqf"]];
dusk sage
#

no

tough abyss
#

Hang on.

dusk sage
#

if its on one client only

#

sure

#

๐Ÿ‘

little eagle
#

scheduled isn't that slow
yes it is. pre rewrite the CBA keybinding menu took a minute to open on 10 fps

#

now it's 0.1 seconds

#

lol

dusk sage
#

-.-

twilit nymph
#

@dusk sage what do you mean?

dusk sage
#

Was it 20k lines of code or what

twilit nymph
#

It won't add the intel for all clients?

dusk sage
#

also

tough abyss
#

How can I get into @little eagle Using CBA for my mission development?

little eagle
#

How you get into me? What?

tough abyss
#

Using CBA_A3?

#

for mission development?

little eagle
#

Occasionally

#

Sure

twilit nymph
#
this addAction ["Ask for intel", {remoteExec["fnc_intel1"]}];

Would this work?'

dusk sage
#
this addAction ["Change loadout", {remoteExec["fnc_change_loadout.sqf", -2]}...
tough abyss
#

No how can I use CBA_A3 for mission development?

dusk sage
#

wait no

#

sorry

tough abyss
#

What do I need to learn?

dusk sage
#

Didnt spot the .sqf

#

It needs to be a function

little eagle
#

The macro library?

dusk sage
#

Not a file

twilit nymph
#

-2 is all except server?`

dusk sage
#

Yep

tough abyss
#

Is there a wiki?

dusk sage
#

fnc_change_loadout.sqf needs to be a function

twilit nymph
#

Ahh so the function I preloaded in init.sqf?

little eagle
#

to use the macro librabry just include it

twilit nymph
#

add_intel1 = compile preprocessFileLineNumbers "fnc_intel1.sqf";

little eagle
#

don't include it into the description.ext though

#

BI broke that

twilit nymph
#

This?

dusk sage
#

That's a different file now

#

which one are you trying to use?

#

Any function you wish to execute on a target with remoteExec, needs to be compiled into a variable (function)

#

such as

#

add_intel1 = compile preprocessFileLineNumbers "fnc_intel1.sqf";

#

yes

twilit nymph
dusk sage
#

add_intel1 is your function

#

not fnc_intel1

twilit nymph
#

Correct

#

Typo there

#

Thanks

dusk sage
#

yeh, so that's the right idea

twilit nymph
#

Perfct

#

Perfect

#

And now the variable i set in init.sqf line 1 doesn't cause any issues?

little eagle
#

btw. Cisco. You can try out your mission by exporting it to MP and connecting to a LAN game with a second game instance

#

that is how I debug MP

#

(if I debug MP, yolo)

twilit nymph
#

Great tips

#

However in my fnc_intel1.sqf i use teamLeader createDiary

little eagle
#

You obviously don't have to remotely execute every function you use, Cisco

#

For example the loadout function

dusk sage
#

The player keyword is your player object

twilit nymph
#

It still shows up on all players?

#

I do not

dusk sage
#

No need to use the names anymore

little eagle
#

All commands you use for loadout have usually "global effects"

twilit nymph
#

so marksman1 addItemToVest would work?

#

Without any remoteExec?

dusk sage
#

Look at the top

#

you see the little G icons?

twilit nymph
#

Eventhough I play as teamLeaderยจ

dusk sage
#

Most wiki pages have these

#

hover over them

twilit nymph
#

Yeah

#

Perfect

dusk sage
#

๐Ÿ˜‰

twilit nymph
#

But I'm supposed to change teamLeader to player in my script?

dusk sage
#

In which?

twilit nymph
#

And remoteExec then makes it run on all clients where player effectivly refers to theyre player?

#

fnc_intel1.sqf

#

this one

little eagle
#

"global arguments" means, that the unit you try to dress up can be local to every machine
"local arguments" means, that the unit has to be local to the machine where you are executing the command
"global effects" means that the unit will be dressed on every machine
"local effects" means that the unit will be dressed only on the machine, where the command was executed (doesn't happen with many inventory commands, although there are a few obscure)

#

And remoteExec then makes it run on all clients where player effectivly refers to theyre player?
exactly

twilit nymph
#

Very good

#

This sure comes in handy knowing

#

Thanks alot!

#

Have a quick question thought

#

Completely unrelated

#

If i define cfgMusic with a custom song, can I run that song on all players being gamemaster or adminLogged if I allow debug menu in my mission for host or adminLogged

little eagle
#

With playMusic right?

twilit nymph
#

I know how to play it with triggers, but not by scripting

#

Hmm let me check that on the wiki ๐Ÿ˜›

#

Big L on top

#

RemoteEcex is needed then right?

#

Like a function in init.sqf

little eagle
#

yeah

twilit nymph
#

And then call that function with remoteExec from debug menu?

little eagle
#

that's what I'd do

twilit nymph
#

Since it apparently is impossible (without modding game) to add it to Zeus

little eagle
#

I think it's pretty much impossible

twilit nymph
#

Shouldn't be though

little eagle
#

I mean you could probably make something, but it'd be ugly

twilit nymph
#

Should've been pretty easy if you ask me

#

Haha

icy raft
#

What's going on?

twilit nymph
#

Well debug menu it is

#

Thanks

little eagle
#

We're all making fun of you, Akryl

icy raft
#

Oh!

#

I feel so grateful

#

It's what always wanted! Thanks ๐Ÿ˜„

#

hahaha

tough abyss
#

@little eagle Is it bad practice to put most things in functions?

little eagle
#

I'd say that it's good practice to put things in functions

twilit nymph
#

Hmm

#

Creating a subj

#

subject

tough abyss
#

private ["_keyArray","_currentAO","_currentAOGrid","_targetPos","_targetString"]; 
_targetString = _this select 0;
_targetPos = _this select 1;
_targetMsg = _this select 2; 
_markerType = _this select 3;
_markerColor = _this select 4; 
_markerShape = _this select 5; 
_getKey = [] call GG_fnc_markerKeyGenerator;
_currentAO = createMarker [(_targetString) + _getKey,_targetPos];
_currentAO setMarkerShape _markerShape;
_currentAO setMarkerType _markerType;
_currentAo setMarkerColor _markerColor;
_currentAO setMarkerText format [_targetMsg,_targetString];
_currentAO; ```
buoyant heath
#

nooooo

#

use params

tough abyss
#

Then calling that from anything I like isn't bad practice?

twilit nymph
#

If I try to create a subject that already exist

#

Ist that bad?ยจ

#

diarySubject

tough abyss
#

Thats old code by the way @little eagle I wrote my code into a "generalised" function I could plug whatever into

little eagle
#

delete line 4-9 an replace private wth params

tough abyss
#

Was going too

buoyant heath
#

you can use private _currentAO = createMarker.... instead of initializing with private

little eagle
#

If I try to create a subject that already exist
no idea. try what happens

tough abyss
#

Over-writes it I'm pretty sure.

twilit nymph
#

Hmm well it doesn

#

doesn't create two of it

#

Or bugs out any way

#

Sooo maybe I'm good?

#

Or maybe I should just create the subject in init

tough abyss
#

@little eagle Thats from my I&A version

twilit nymph
#

So that it aldready exist

#

And then add stuff to it

#

So I'm sure

#

Well thats it for today

#

Thanks for the help guys!ยจ

tough abyss
#
    [["_targetString",""]],
    [["_targetPos",[0,0,0]],
    [["_targetMsg",""]],
    [["_markerType",""]],
    [["_markerColor",""]],
    [["_markerShape",""]],
    [["_getKey",0]],
    [["_currentAO",""]]    
]; 
_getKey = [] call GG_fnc_markerKeyGenerator;
_currentAO = createMarker [(_targetString) + _getKey,_targetPos];
_currentAO setMarkerShape _markerShape;
_currentAO setMarkerType _markerType;
_currentAo setMarkerColor _markerColor;
_currentAO setMarkerText format [_targetMsg,_targetString];
_currentAO;
#

better?

#

@little eagle

little eagle
#

I don't think _getKey and _currentAO are arguments of that function

tough abyss
#

They are.

#

key generators to ensure markers have a unique key

#

Which it does exactly that

little eagle
#

but you just overwrite them

buoyant heath
#

Doesn't look like it

little eagle
#

why would they be arguments, if the arguments do nothing?

#

I think you'd just put the private keyword before the variable when it's defined

tough abyss
#
private ["_target","_targetPos"];
_target = _this select 0;
_targetPos = _this select 1;
_AOMarkerIDs = [
    _target,_targetPos,
    "Take %1","o_inf",
    "colorOPFOR","ICON"] call GG_fnc_createMarkerIcon; 
    
_AOMarkerGridIDs = [
    _target,_targetPos,
    "","",
    "colorOPFOR","ELLIPSE",
    750,750,
    "FDiagonal",1] call GG_fnc_createMarkerEllipse;
_ret = [_AOMarkerIDs,_AOMarkerGridIDs];
_ret;
#

Thats the code that calls the other code

little eagle
#
params [
    [["_targetString",""]],
    [["_targetPos",[0,0,0]],
    [["_targetMsg",""]],
    [["_markerType",""]],
    [["_markerColor",""]],
    [["_markerShape",""]]
]; 
private _getKey = [] call GG_fnc_markerKeyGenerator;
private _currentAO = createMarker [(_targetString) + _getKey,_targetPos];
_currentAO setMarkerShape _markerShape;
_currentAO setMarkerType _markerType;
_currentAo setMarkerColor _markerColor;
_currentAO setMarkerText format [_targetMsg,_targetString];
_currentAO
tough abyss
#

This is all old legacy code.

#

Ohh so

#

only use params?

#

If you expect args to be passed?

#

use private otherwise?

little eagle
#

params is only for arguments the function is called with

tough abyss
#

so is private _var

little eagle
#

private keyword, yes

tough abyss
#

faster than private ["_var"];

#

?

little eagle
#

yeah

#

And you don't have to write the variable name twice

#

And you'll never forgot one variable

#

it's great

tough abyss
#

True

#

Definitely time saver

#

See why I did the above was because I've systematically been replacing I&A's guts

#

Completely.

little eagle
#
params ["_target", "_targetPos"];

private _AOMarkerIDs = [
    _target,_targetPos,
    "Take %1","o_inf",
    "colorOPFOR","ICON"
] call GG_fnc_createMarkerIcon; 
    
private _AOMarkerGridIDs = [
    _target,_targetPos,
    "","",
    "colorOPFOR","ELLIPSE",
    750,750,
    "FDiagonal",1
] call GG_fnc_createMarkerEllipse;

[_AOMarkerIDs, _AOMarkerGridIDs]
tough abyss
#

The I&A creates it's vehicles is like this

#
        _staticsArray = [_enemiesArray] call GG_fnc_createStatics;
        sleep 1;
        tickInStatic = diag_tickTime;
        if (_x == PARAMS_StaticMG) exitWith {};
    };  ```

for "_x" from 1 to PARAMS_VehPatrols do {
_randomNum = floor(random 3);
_MRAPPatrolArray = [_randomNum,_enemiesArray] call GG_fnc_createVehicles;
sleep 1;
tickInMrap = diag_tickTime;
if (_x == PARAMS_VehPatrols) exitWith {};
};

#

It uses for-loops to create vehicles

#

The biggest issue with this particular code

#

is it runs within the scheduled environment

#

and depending on how many clients are connected can blockade the servers startup

buoyant heath
#

not to mention severely slowing itself down with those sleeps

tough abyss
#

Particularly if I remove the sleep 1;

#

No remove the sleeps it makes the entire code literally lock up

buoyant heath
#

This is where commy2 steps in and starts preaching unscheduled

dusk sage
#

scheduled wont block anything

#

thats the point

tough abyss
#

Actually I just thought of a smarter way to create the vehicles

buoyant heath
#

Hard not to

tough abyss
#

I use an event handler on the tower and link the vehicle creation to that.

little eagle
#

place them with the editor /s

buoyant heath
#

and unhide them as needed! Brilliant!

icy raft
#

I want to be a veteran, where do I sign @little eagle ? ๐Ÿ˜ƒ

little eagle
#

scheduled wont block anything
maybe another script is waiting for the completion for this particular spawn script?

tough abyss
#

Yeah their collision box is still there.

#

Thats the problem

little eagle
#

Idk. I got my blue name one day.

icy raft
#

Oh, well, let's see if I can get that, I like blue

little eagle
#

I wanted the red one X39 had.

#

Trolls group

dusk sage
#

maybe another script is waiting for the completion for this particular spawn script?

He explicitly said scheduled -> blockade startup

#

Where is X39

#

I want that GUI editor

little eagle
#

Yes, maybe another script wait's for the completion of the scheduled spawn script

#

who knows

tough abyss
#
enInfantryArray =[currentAO] call GG_fnc_setupEnemyInfantry;
enVehicleArray = [currentAO] call GG_fnc_setupEnemyVehs;
#

And thats run from a spawn'd piece of code

dusk sage
#

We can hope

icy raft
#

well, good night ppl

buoyant heath
#

If there are enough spawned threads running, everything will bog down as each script waits its turn

tough abyss
#
_loopTimeout = 20;
while { true } do {
        
    // _mission = _missionList call BIS_fnc_selectRandom;
    // _missionList 
    _AO = compile "GG_fnc_regionManager";
    _SelectRand = floor(random(count(_missionList)));
    _currentMission = [] spawn (MissionNameSpace getVariable "GG_fnc_regionManager");
    
    diag_log format ["Mission Selected %1",_AO];
    
    waitUntil {
        sleep 5;
        scriptDone _currentMission
    };
    sleep _loopTimeout;
};
dusk sage
#

You'll never create enough to stop everything

#

I've tried

little eagle
#

You just have to have a slow enough machine and the switching between all the virtual threads eats up the 3 ms^^

dusk sage
#

_AO = compile "GG_fnc_regionManager";

#

ahhhhhhhhhhhhhhhh

#

that would be hilarious

tough abyss
#

Thats the issue?

dusk sage
#

3ms switch delay

#

Why compile it

tough abyss
#

It's a function name

little eagle
#

BoGuu, the difference might be that you use a desktop pc, while i'm using my notebook from 2011

dusk sage
#

I ran a completely exponentially recursive function to grind myself to a halt ๐Ÿ˜„

little eagle
#

_AO = compile "GG_fnc_regionManager";

#

10/10 code

dusk sage
#

aahhhhhhhhhhh

#

๐Ÿƒ

little eagle
#

obfuscation?

dusk sage
#

ohno

little eagle
#

I am obfuscated

buoyant heath
#

It still uses english words. Not obfuscated enough.

little eagle
#

AO is english?

buoyant heath
#

Assume AO is the area of ops, but more importantly, regionManager is rather descriptive

dusk sage
#

Means nothing to us ๐Ÿ˜‰

buoyant heath
#

Unless that's actually your obfusctated name for....oh, very sneaky

little eagle
#

why is this logging a function though?

#

Shouldn't it be the "mission name"

#

?

tough abyss
#

This was a rushed design @little eagle

#

Region manger did exactly that

#

Manage the entire "region" of the map

dusk sage
#

but

tough abyss
#

It was never commented because I didn't have time.

dusk sage
#

why the compile ๐Ÿค”

tough abyss
#

To be honest I think that was code that was never removed.

#

Derp.