#arma3_scripting

1 messages ยท Page 735 of 1

little raptor
#

> is binary

past wagon
#

yeah ik

little raptor
#

it has lower precedence

past wagon
#

yeah...

#

okay makes sense

meager granite
#
_hm1 = createHashMapFromArray [[1,2],[3,4]]; 
_hm2 = createHashMapFromArray [["test1", _hm1], ["test2", _hm1]]; 
str _hm2;
```throws

14:45:50 Circular reference found in HashMap, this will cause a memory leak!
14:45:50 โžฅ Context: Hash Key: "test1"

[["test2",[[1,2],[3,4]]],["test1",!!HashMap circular reference!!]]

#

I guess str does something that triggers the warning and the actual hashmaps are fine?

pliant stream
#

looks like a bug

#

why does it even allow a circular reference

tough abyss
#

ran into that same issue a while ago but with arrays for a recursive linking system

#

because apparently you can also somehow get circular array references

#

even though just like that hashmap none of the references were actually circular

#

there were just multiple arrays with the same reference

ivory lake
#

Has anyone encountered an issue with creating particle effects with createVehicleLocal and sometimes not being able delete them with deletevehicle in multiplayer? Ofcourse I mean the clients deleting their own specific version of the particle vehicle

#

Because I keep getting this reoccurring problem where a particlesource is supposed to be deleted - and it will delete for most/some clients but not on others. Seemingly at random

#

if it matters the particlesource is attachTo'd a unit or vehicle

pallid ravine
#

Is there a scripting command to add camo nets / slat armor / etc to the vehicles that have them available?

little raptor
pallid ravine
#

Got it, I'll investigate those functions next. I've been looking through the slammer cfg file to look for the references of the camo nets and slat armor, but only found references to the camo net. Let me pull up the cfg for the slammer up and see how it differs. Thanks for pointing me in the right direction!

little raptor
pallid ravine
#

Ah, you're right. Whoops. That might explain some things. I must have been thinking of the Rhino UP.

little raptor
#

maybe. afaik only APCs have those thonk

pallid ravine
#

Yep, Rhino UP has it. In the Cfg it seems to be listed in the animationList and the hiddenSelections / hiddenSelectionsTextures.

plush nova
#

is there a way to lock a player out of picking up certain items?

#

like blacklisting (or whitelisting) weapons that they're allowed to pick up

bitter jewel
#

maybe you can construct something out of the take eventhandler

jade acorn
plush nova
#

or does the ground generally count as a container

bitter jewel
#

every object on the ground exists in a groundWeaponHolder

#

which are containers too

#

so yes

plush nova
#

hm ok

#

thanks

bitter jewel
#

every item i mean

#

your tank is not inside a weaponholder

#

your your infantry unit

winter rose
bitter jewel
bitter jewel
#

do i remember correctly that if a unit is configured say west, and you createUnit it to a group that is east, the ai may be confused about that units side?

winter rose
#

no, I don't think so?

#

I can't 'member for sure though think_turtle check maybe join

still forum
#

It's become better recently as it now has multithreading owoyay

winter rose
#

Parallel.ForEach(m_allObjects, func) ๐Ÿ˜

still forum
pliant stream
#

so why do it for array

still forum
#

Because the programmer who did that years ago decided that, and backward compat

pliant stream
#

i guess inventing a garbage collector is too much to ask

winter rose
#

now yes

pliant stream
#

i mean when this cyclic array reference problem was first encountered

winter rose
#

ah, ok
well anyway, not going to rewrite the past now, so it is what it is

pliant stream
#

well seeing as arrays already forbid cyclic references, and how bad of an idea it is to let scripts leak memory, it seems to me that maps should have followed suit

still forum
#

Maps focus was performance

pliant stream
#

that seems a bit silly when seen in context

still forum
#

If people want to leak memory and ignore the big warning in RPT that tells you exactly which script does it. Then people shall do that

pliant stream
#

but you don't get a warning, do you?

still forum
#

You do, its posted above

pliant stream
#
local _m1 = createHashMap;
local _m2 = createHashMap;
_m1 set [0, _m2];
_m2 set [0, _m1];
_m1 = nil;
_m2 = nil;

do you get a warning for this?

pallid ravine
#

Why is
(_temp select ((_this select 3) select 1)) = 0;
causing a no semicolon error? Removing the assignment
(_temp select ((_this select 3) select 1));
fixes the issue, but I have no idea why.

pliant stream
#

in SQF you can only assign variables

#

there are no other lvalues

winter rose
#

use set if you want to set an array's or hashmap's value @pallid ravine

pliant stream
pallid ravine
#

Interesting. I'll do that, thanks for the quick answer!

spark sun
#

local

pliant stream
#

oh that. whatever, replace it with private then

#

i'm just used to local

#

so much for backwards compatibility huh

little raptor
winter rose
#

gniii

winter rose
little raptor
pliant stream
#

A2 has both local _v = ... and if (local _object)

little raptor
#

๐Ÿคฃ

pliant stream
#

i don't think there was any technical reason to remove local _v =

winter rose
#

private was introduced in A3 1.54 I believe, and was a local rename because local was a command that never was advertised for such usage at the time

#

as far as I know, iirc from KK

pliant stream
#

yeah i think i literally never saw anyone else use local _v = in A2 scripts. everyone was using some smoothbrained private ["_v"]

winter rose
#

private "_v" is faster, but still

pliant stream
#

yeah i shortened that for brevity. in actuality it's

private ["_cursorTarget","_onLadder","_isWater","_alreadyRemoving","_characterID","_objectID","_objectUID","_ownerArray","_dir",
    "_realObjectStillThere","_upgrade","_entry","_parent","_requiredParts","_requiredTools","_model","_needTool","_displayname",
    "_whpos","_wh","_object","_vector","_dis","_puid","_variables"];
winter rose
#

well, still better than omitting it

pliant stream
#

sure. it's just worse than local _blah

winter rose
#

yeah but local _stuff = value wasn't documented until 2015 ๐Ÿ˜ฌ hard to grasp

pliant stream
#

why is that

winter rose
#

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

#

I script since OFP and never knew it was a thing in Arma 2 before it was too late

pliant stream
#

i guess i have to blame BI then instead of those poor scripters

winter rose
#

on that, please yes

pliant stream
#

i could have sworn it was used somewhere in some BI SQF in A2 but maybe not

little raptor
bitter jewel
#

if i do g = createGroup east; unit = g createUnit ["B_RangeMaster_F", position player, [], 0, "FORM"]; then side unit will return WEST

winter rose
#

worth a note or description fix then

bitter jewel
#

i can even have g be a non-empty group of side east, the units will report different sides

winter rose
#

wait, that's in the first note actually
I will try to make it more obvious in the description

spark sun
bitter jewel
#

as in

unit = myGroup createUnit [<blah>];
[unit] joinSilent myGroup;
``` ?
bitter jewel
#

ok

spark sun
#

Also when you check side, do side group _unit

#

side unit can return civilian if the unit is captive for example but with group it is safer

winter rose
spark sun
winter rose
#

(and edited again, hop)

broken steppe
#

Hey guys I have another question, I created a mission with several SQF Files used. Now do I need to upload all SQF Files and the pbo or is it all compiled into the Mission pbo and uploading it is sufficient? We are having trouble connecting into the server with only the pbo uploaded but are not sure where the problem is.

#

Upload to my server ofcourse

winter rose
#

the issue might come from missing or wrong mods

broken steppe
#

okay so might look into that again

unreal heath
#

Is this appropriate channel for requesting help with ORBAT creating in description.ext?

winter rose
unreal heath
#

So, when I get everything set up (paths and roofs included in ORBAT module in editor, and description.ext set up), I always get error with game not identifying type of ORBAT group upon launch of mission, and they always dissapear when I load into missions. When I decided to copy entire description.ext stuff from one YouTube video, it worked fine without any errors, yet upon smallest changes it gives me errors

pallid ravine
#

Are textures for vehicles with more complex skins such as the CTRG Prowler or the various M-900 skins treated differently from normal textures? I've got a script that looks up the various vehicle definitions that share the same model as the current vehicle and gives the option to apply their textures (as defined in the vehicle class's hiddenSelectionsTextures array) to the current vehicle. It works great for most things, but for these seemingly special vehicles, it just applies a generic texture. Is there something I'm missing?
Edit: Alright, the issue with the CTRG prowler was just me being blind. Still working on the M-900 / Civilian Offroad textures

unreal heath
winter rose
pallid ravine
#

For vehicles with the skin randomization feature, in the CfgVehicles class it claims that you can set the texture of the vehicle by using this setVariable ["color",X];, where X is a number within a defined range and 'this' is presumably the reference to the object. However, testing this out with the local Exec in the debug menu, I can't seem to get it to work. Does anyone have any experience with this?
Disregard, I've figured it out. That's for setting the texture from the editor, not once the game has already started.

snow pumice
#

Hey i want to dynamicly (unlock / lock it on conditions like progress) disable a door during a mission,

inGameUISetEventHandler came in my mind, the enginename triggered is UserType.

Is there some other action where UserType will be triggered?

spark sun
#

Did you try setvariable bis_disabled_Door_1 ?

snow pumice
# spark sun Did you try setvariable `bis_disabled_Door_1` ?

i cloud create a list of all doors, could disable / enable it for every client when a condition changes, but this would mean i have to maintain it vs i could set an condition on a door, ask with inGameUISetEventHandler if this door can be unlocked and this central in one file

snow pumice
warm swallow
#
{
    titleText ["You are the killer, kill all the survivors." , "PLAIN"];
    sleep 5; 
    titleFadeOut 5;
}; ``` this script is in my init. sqf. When I run the mission I'm getting an error with this if statement. Am I using it correctly?
#

(command) If Type = if condition this is the syntax

pallid ravine
#

playerSide = east
Need a double == for testing equality. A single = is for variable assignment.

warm swallow
#

ahhh. thank you!

pallid ravine
#

Is it possible to modify the parameters of an addAction? Namely changing the priority?

pallid ravine
#

Got it, thanks!

warm swallow
#

can you change the playerspeed?

past wagon
warm swallow
#

what command is that?

pallid ravine
#

The addAction function has a bunch of parameters that go with it, such as the radius, or the priority (how high it shows up on the scroll menu). I was wondering if there was a way to change the parameters of a currently existing action so that, for example, it could appear higher up on a list or be accessible from a different radius, etc. However, as per Lou's post, it is not possible (except for changing the name).

past wagon
#

oh got it

real basalt
#

So im trying to pull a script from a scenario, how does one get into eden to access the mission file

past wagon
real basalt
#

Yea but I cant find the scenario

past wagon
#

you have two folders: mpmissions and missions

#

if it is in either of those then you should be able to access it from eden

#

it has to be named in the format missionName.Map

real basalt
#

See ik where to find those, but its not showing up which is weird

#

I got it off the steam workshop

past wagon
real basalt
#

I figured it out lol, I had it put in the wrong spot

past wagon
#

ok

weak obsidian
#

I'm not going to complain but I've by accident found out that by using vestContainer <unitname> addItemCargoGlobal you can indeed add items to the divers rebreather. Once removed though you can't put em back in.

#

Might be interesting for the few people making such missions with vanilla assets

broken steppe
#

Hey guys, I built a ressource system for my MP mission using public variables for saving and cutRsc for displaying them. But I am currently encountering syncing problems, what is the best way to sync the ressource variables and displays for all my players?

plush nova
#

do multiple simultaneous appends to a publicVariable list from different clients get properly synced?

#

so if i append then publicVariable from two separate clients simultaneously, will i end up with a list of two elements, or a list of just the one element from the more recent client

broken steppe
#

To give some more info on the current system: I init the variables in the ServerInit.sqf to only load them up once, then I have a shop system where ressources are paid to get units and changes are displayed. But this alone isnt enough so I added a trigger which is executed every second which updates the display of the variables, but this is buggy and sometimes some units in the shop are not paid

broken steppe
#

I tried it a few times and it seems to work okay

#

And I am not using lists, just 3 seperate public variables to be exact

plush nova
#

Oh yeah I'm specifically worried about a list

#

And appending

#

I'm pretty certain that "normal" assignment operations will work

tough abyss
#

@plush novaThe most recent publicVariable will be what all clients are synced to

#

so ideally you want to append from one location and then broadcast

broken steppe
#

Is there a way to broadcast the public variable after assignment?

tough abyss
#

just publicVariable?

#

no automatic sync happens so you always need to broadcast after an assignment

broken steppe
#

So lets say I declare a publicvariable in my init, then after some time i change the value, do i need to put public variable again?

tough abyss
#

yes

#

there is no automated sync

broken steppe
#

Well imma try that

#

Thank you !

tough abyss
#

np

#

if you do want to "emulate" automatic sync you could use setVariable w/ the public param set to true

#

or make a wrapper function like so

plush nova
#

That makes sense

#

Was kinda hoping there was some special case array diffing logic lol

pallid ravine
#

It may be helpful to consider publicVariable a function as well, rather than a datatype (because it really is just a function). So you aren't really "declaring" a public variable, you're just broadcasting a normal variable with the function publicVariable.

tough abyss
#

SQF doesn't have a distinct data type for public variables afaik

#

it's all just whatever data type the var is and then broadcast

broken steppe
#
munitions = 500;
_munitions = (missionNamespace getVariable ["munitions", 0]);
_munitionsid = ["munitionslayer"] call BIS_fnc_rscLayer;

("munitionslayer" call BIS_fnc_rscLayer) cutRsc ["munitions", "PLAIN", 0];
_munitions = str (_munitions);
publicVariable "munitions";
_munitionsdisp = uiNamespace getVariable ["my_munitionsdisp", displayNull];
_textCtrlmunitions = _munitionsdisp displayCtrl 404;
_textCtrlmunitions ctrlSetText _munitions;
#

So this is the operation I call every time I change something

#

(substitute the 500 with whatever I do like add/subtract or whatever essentially)

#

But even after adding the publicVariable command it doesnt sync

tough abyss
#

Do you have any code to update the UI on the clients receiving the new value?

broken steppe
#

Is that not the last line?

#

the ctrlSetText?

tough abyss
#

That's updating it on your end

#

that won't automatically update all clients

past wagon
#

???

broken steppe
#

How would I go on and update it on client side

tough abyss
#

What I would do is

#

make this a function that each client has

#
_munitionsdisp = uiNamespace getVariable ["my_munitionsdisp", displayNull];
_textCtrlmunitions = _munitionsdisp displayCtrl 404;
_textCtrlmunitions ctrlSetText _munitions;
#

and remoteExec it after broadcasting the updated value

#

or just send the updated value as a param via remoteExec

#

and update it clientside

#

so like this

#
fnc_UpdateMunitions = {
  params["_munitions"];
  munitions = _munitions;
  _munitionsdisp = uiNamespace getVariable ["my_munitionsdisp", displayNull];
  _textCtrlmunitions = _munitionsdisp displayCtrl 404;
  _textCtrlmunitions ctrlSetText _munitions;
};
#

then remoteExec that whenever you need to update clients

broken steppe
#

Sorry for asking again and where would I a) save that and b) execute that? I guess executing right after updating the munitions

tough abyss
#

You wouldn't even need to update the muntions beforehand with that

#

it'd update for all clients just by remoteExec'ing the function

#

but where you'd save it depends

#

if you're just using a mission then you could define it in the init

#

otherwise for a mod I'd say cfgFunctions

#

so for example

#

to do what your code above does

#

to update the munitions to 500

#

you'd just do ```sqf
[500] remoteExec ["fnc_UpdateMunitions"];

#

and that should update the munitions and UI for all clients

broken steppe
#

okay I got that but u wrote i wouldnt even have to broadcast the new value for munitions did i get that right?

tough abyss
#

yes you don't need publicVariable anymore

#

what I just wrote above handles broadcasting the new value and updating UI

broken steppe
#

Okay so the line munitions = _munitions, updates it globally because it is executed via remoteExec right?

tough abyss
#

yes

plush nova
#

Hmm is there a way to give the client "hints" about an objects velocity so it doesn't glitch around

tough abyss
#

all of that function code runs on every client

#

since you're remoteExecing it

broken steppe
#

Perfect thank you very much I understand it much better now

tough abyss
#

setVelocityTransformation and some other functions take velocity params to better sync clients

#

but it depends what exactly you need/want

plush nova
#

Hmm well I have a scheme to constantly setvelocity every frame to make a man slide around

#

The velocity is largely unchanging

#

But I think the clients keep "syncing"/interpolating to the man's animation state offset which is 0,0,0 (since he is in a stand pose)

#

And therefore the man stutters and teleports about from the nonlocal pov

#

Ideally I want to let the client know that the man should continue sliding about at that velocity rather than... Not

#

I was thinking of also just calling setvelocity nonlocally every frame or something (since the velocity is basically constant and never changes so it should be known to all clients) but idk if that works

tough abyss
#

Doing setVelocity every frame is... not ideal

#

I would use setVelocityTransform with an identical start and end velocity for that

broken steppe
#

And another question concering that function, is it possible to implement locks on variables so that I dont have any anomalies like when two players use the shop at the same time and the method is executed at the same time?

tough abyss
#

You could emulate a mutex but you shouldn't need to

plush nova
#

Like is it fine if I just call it with interval time 0 repeatedly but update the start and end points

tough abyss
#

@broken steppe it would be better to figure out how to avoid it being an issue in the first place

plush nova
#

Or do I need to track the interval state

tough abyss
#

You could repeatedly call it but you don't need to

woeful sundial
#

easy way of getting the real time in arma?

lavish stream
woeful sundial
#

this is some new shit 2.0 โค๏ธ

plush nova
#

For continuous movement this command should be executed each frame while changing the interval value.

tough abyss
#

Oh yeah no you need to do that

#

I worded it poorly

#

I meant you don't need to repeatedly call with updated endpoints

#

Just the interval should be enough unless you're changing direction

plush nova
#

Hmm alright thanks

little raptor
#

This is wrong

tough abyss
#

Yeah I realized that a bit after writing it

#

I'll go back and delete it

#

should've used a string arg

little raptor
limber panther
#

hello! I've got a script, that works! It is a while{true}do{... loop and i guess , that it's executed every frame in game which is an unnecessary load to the server. I heard, that i can reduce it by adding sleep x; into it so the loop gets executed every x seconds. I would like to ask where/how to add the sleep into the loop to cause the desired effect and what is the ideal time for that (how to find out)? Thank you

kindred zephyr
#

can someone clarify me what the locality of

missionNamespace setVariable ["testVar",true];

would be?

I'm asking because according to wiki this is global but when being done by different clients they can have the exact same variable with different values on it and return correctly their own version in every single client. Also asking because I wanted to stop using

publicVariable "testVar";

as its not cool anymore according to some places and i'm using it alot.
Maybe i'm just misinterpreting the wiki again?

tough abyss
limber panther
tough abyss
tough abyss
limber panther
tough abyss
#

You're saying there's different times between different color switches?

kindred zephyr
limber panther
tough abyss
#

So if there's different delays one universal delay won't work for you

#

What would probably work better for you is using a while {true} with no sleep, but having it call a function that changes the color and then sleeps for different times according to the color its switching to

#

I'm not going to write the code for you because I'm busy, but that would work for what you want

limber panther
#

ok thanks, i think i got the information i needed

little raptor
#

stop using
publicVariable "testVar";

as its not cool anymore according to some places and i'm using it alot.
the point is that you should just avoid sending variables over the network when there's no need

#

you should try to do as much as possible on client machine themselves

#

and when not possible try to reduce the frequency or amount of data sent

kindred zephyr
#

this are variables that are sent every 10/20/90 minutes

little raptor
#

if they're not big then you have nothing to worry about

kindred zephyr
#

I always thought that it would be better to manage variables and most of the operations serverwise and not the other way around ๐Ÿ˜ฎ

tough abyss
#

@kindred zephyr it generally is

#

and for that purpose you may find setVariable more convenient

#

But nothing wrong with publicVariable either

leaden summit
#

Quick question, I know I can get a players UID using getPlayerUID but how do I get just the very last number of that?

little raptor
#

but doing "most of the operations serverwise" will just ruin the server performance and thus will ruin the game for everybody

leaden summit
#

last digit in the number

little raptor
#

you mean 5 in 12345?

leaden summit
#

Yeah

little raptor
#
_uid = getPlayerUID _unit;
_lastChar = _uid select [count _uid - 1, 1]; //as string
_num = parseNumber _lastChar; //as scalar
leaden summit
#

Awesome thank you, I tried using trim but kept getting messed up between the variable being a number vs string

velvet merlin
hollow thistle
wary sandal
#

Hello, I've been trying to run a command through a trigger upon activation but I can't get it working

#

for some reasons I can't send images

winter rose
#

nope, but you can send code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

```sqf
// your code here
hint "good!";
```
โ†“

// your code here
hint "good!";
wary sandal
#

well in the trigger's expression menu I have ```sqf
// Condition
this

// When activated
deleteVehicle _unit2

#

the trigger seems to be working properly since it works with modules

winter rose
#

_unit2 is undefined

#

variables that start with an underscore are local to their scope ๐Ÿ™‚

wary sandal
winter rose
#

not here

wary sandal
#

and _unit2 is a player

winter rose
#

also I think you cannot delete a player

wary sandal
#

I saw that in a video, i'll try doing that with an actual vehicle

#

it worked, thanks @winter rose

#

i'm not familiar with arma3 mission making yet

winter rose
#

don't worry, it will soon drive you mad!

wary sandal
#

also it works with units but only AI players

winter rose
#

it works with AIs, not player-controlled units yes

wary sandal
winter rose
#

that's the spirit!

quasi condor
#

Hi I just started to make some script now, and I have some question.

_point = 400;
publicVariableServer "_point";
_pointMarker = createMarker [format ["Point: %1", _point], position wherePoint];
_pointMarker setMarkerType "hd_dot";
publicVariableServer "_pointMarker";

this is init.sqf. i ran this code but it only shows little black dot and there was no string. how to fix this?

#

(i'm not american. sry for my english skill)

winter rose
#

you cannot publicVariableServer a local variable (underscored one) ๐Ÿ˜‰
regarding the dot, you did not set a text

createMarker creates a marker and you provide a name
to set the text, use setMarkerText

quasi condor
#

It finally worked. thank you OwO

proven charm
#
class Test123 : DefaultForceGroups
{
};
warm swallow
#

will forEach act on all items in an array. I've made an array for each of my players in a scenario. I want them to have a random spawn location.

proven charm
#

Why does count (missionconfigfile >> "Test123") print 0 when DefaultForceGroups has classes that are inherited?

still forum
proven charm
still forum
#

configClasses configEntries?
Config entries is wrong. configChildren?

proven charm
#

configClasses exists

#
"true" configClasses (missionconfigfile >> "Test123")
#

gives me empty array

still forum
#

There was one more comamand

#

Takes array on right

distant oyster
#

configProperties

proven charm
#

that seems to work. thx terra ๐Ÿ™‚ thx dedmen

boreal parcel
#

heyo, trying to make it so that if a player enters a building he would get full ace healed but im not too sure how to go about it. I found a method called inArea and this is what I came up with to test, in the mean time any ideas on how I would get this to work?

if (player inArea "Land_Medevac_house_V1_F") then {
  [ player ] call ace_medical_treatment_fnc_fullHealLocal;
}
vapid drift
#

looks like if it's an object you're using, it needs to be a trigger

#

instead of a class name

#

You could just drop a rectangle trigger down name it something like "aceHealTrigger" then swap that out with "Land_Medevac_house_V1_F"

boreal parcel
#

hmm, the thing is we have a build script allowing users to place the building with that classname. Maybe I can have a trigger created and placed in the same position they build the building?

vapid drift
#

or use the alternative syntax to check a rectangle where the building is placed

boreal parcel
vapid drift
#

the alternative syntax is for inArea

boreal parcel
#

oh

vapid drift
#

if you use inArea I'm not sure you have to mess with the trigger activation... just create a trigger at the same location, dimensions, orientation, etc and feed the trigger name into the function

tough abyss
#

I'd go with either just placing a trigger down that runs the healing code directly

#

or, if you're using inArea, just use this syntax and bypass needing a trigger

#
position inArea [center, a, b, angle, isRectangle, c]
#

you can get rough dimensions of the object w/ boundingBoxReal for sizing them

boreal parcel
#

im incredibly new to arma scripting so im not certain how I could even get the building pos each time its built, im trying to figure out how liberations build script works im trying to find that now to create triggers

tough abyss
#

Ideally lib's building runs some sort of event handler, but if it doesn't you could look into alternative options

vapid drift
#

In the meantime... I'm back to creating issues for myself. I have "nests" I place down that run this: ["createNest", [this, 1]] call STY_RVG_fnc_zedNest;
in the function...
https://sqfbin.com/jicocodovobutexotuti

the markerText is incremented properly however if I access missionNamespace getVariable "STY_RVG_nests" it always returns an empty array

#

So basically I'm not sure why it seems to be filling the array in the beginning and then it's emptied I guess?

tough abyss
#

I don't see anything in that code that would be causing that

#

are you modifying this variable anywhere else?

vapid drift
#

in init.sqf I run ["init"] call STY_RVG_fnc_zedNest;

Which, at this point, is just: ```sqf
missionNamespace setVariable ["STY_RVG_nests", [], true];

#

but I mean that should be running before the init fields on the nests so I can't imagine why that would cause an issue

tough abyss
#

So this code is in the init field for the nests

#
["createNest", [this, 1]] call STY_RVG_fnc_zedNest;
#

?

vapid drift
#

Yes

tough abyss
#

Is that set up in 3DEN or config

vapid drift
#

3DEN

tough abyss
#

alright

#

yeah so

vapid drift
tough abyss
#

according to here

#

object init fields are run before init.sqf

#

that's your issue

vapid drift
#

... I promise you I looked at that earlier and would have sworn it was the opposite

tough abyss
#

no problem

vapid drift
#

been debugging this for an hour or more

tough abyss
#

On the bright side you shouldn't have to change much

vapid drift
#

lol nope... I guess if i needed to run an init on the function before everything else I could just do it via a placed logic?

tough abyss
#

Could possibly do that, alternatively you could set up cfgFunctions and do a preInit function

#

then again I assume this is a mission

#

so that's probably a no-go

vapid drift
#

ah yeah, that's the answer for sure

#

It IS a mission but I have my functions setup in descript.ext so that's still possible

tough abyss
#

good

#

should fix your issue

vapid drift
#

Awesome, thanks man

tough abyss
#

no problem

boreal parcel
#

is there a way I can export the class names from the arsenals so I dont have to keep tabbing from game to the file with class names, its incredibly annoying since the mods add a good amount of items

tough abyss
#

you could write an sqf script to dump cfgWeapons classnames

valid abyss
boreal parcel
tough abyss
#

Let me rig one up quick

boreal parcel
#

thanks man, I underestimated the amount of items in our arsenal

tough abyss
#
private _classNames = ("true" configClasses (configFile >> "CfgWeapons")) apply {configName _x};
#

Should do the trick

#

Then can just print them out somewhere

#

That will get everything in cfgWeapons, could filter it better if you know more precisely what you want

boreal parcel
#

Rog thanks man this should work fine

plush nova
#

Is there a way to access the current player mp face identity "config"

#

Does it show up under normal configs?

warm swallow
#
gen1 setPosATL (getPosATL selectRandom _glist);
_glist - getPosATL gen1;``` Is this code like written as good as it could've been. I'm trying to create an array of possible spawn locations, and then teleport an object to one of the possible spawn locations, and then remove that location as a possible spawn location, because I intend to run the code multiple times
winter rose
warm swallow
#

thank you

winter rose
warm swallow
fading dust
#

Good evening i want to make custom ranks icon for a mission (multiplayer mission) so players will have my custom rank insignia instead of vanilla but don't want to be server rank just the mission

warm swallow
#

_glist = [getPosATL g1, ...] something like this?

winter rose
warm swallow
fading dust
winter rose
warm swallow
#

how do I make my code colourized?

plush nova
#

Like '''sqf (but with backticks)

#

No you add it to the beginning

warm swallow
#

there wego!

plush nova
#

๐Ÿ‘

warm swallow
fading dust
#

i want to replace the vanilla rank icon " rank Chevron " ( the one that appear over the players head in multiplayer ) with custom insignias

#

but as mission sqf not server sqf

warm swallow
#




_gslist = [gs1,gs2,gs3,gs4,gs5,gs6,gs7,gs8,gs8,gs9,gs10];

private _gen1 = selectRandom _gslist;
_gslist = _gslist - (getPos _gen1);
g1 setPosATL getPosATL _gen1;

private _gen2 = selectRandom _gslist;
_gslist = _gslist - (getPos _gen2);
g2 setPosATL getPosATL _gen2;

private _gen3 = selectRandom _gslist;
_gslist = _gslist - (getPos _gen3);
g3 setPosATL getPosATL _gen3;

private _gen4 = selectRandom _gslist;
_gslist = _gslist - (getPos _gen4);
g4 setPosATL getPosATL _gen3;
#

@winter rose ok this is what I have, not exactly optimized, but it works!

fading dust
#

any help

#

what i want is change the player name tag icons by rank

vapid drift
#

Sort of a best practice type of question... would it cause a problem to have several triggers - approximately 14 - checking for the presence of a player or should I pursue a different avenue?

plush nova
#

is there a way to access the current player mp face identity "config"? does that show up anywhere under normal configs?

#

a way other than "read the face of the player's unit" i guess

warm swallow
#
    gentest,                                        
    "Repair Generator",                                        
    "",    
    "",    
    "_this distance _target < 2",                    
    "_caller distance _target < 2",                        
    {_caller playMoveNow "Acts_carFixingWheel";},        
    {},                                                    
    {
        cutText [Generator has been repaired", "PLAIN", 2];
    },                                                
    {
        _caller switchMove "AmovPercMstpSrasWpstDnon";
    },                                                    
    [],                                                
    25,                                                    
    0,                                                
    true,                                            
    false                                        
] remoteExec ["BIS_fnc_holdActionAdd", 0, gentest];
#

whats wrong with this script? getting an error that it didn't expect the last semicolon, and when I run it it just says "Init: "

warm hedge
#

Are you trying to put this into an object's Init field ob Eden?

warm hedge
#

Just don't. If you're doing a multi mission, this is a great way to break everything. Also that field is simply buggy

warm swallow
#

your saying i should move it into an sqf file and then call that through another script?

warm hedge
#

Perhaps. Or just put it in init.sqf or initServer.sqf

warm swallow
warm hedge
#

Then it isn't called properly I'd assume. Or the gentest is not initialized as well

warm swallow
#

hmm

#

@warm hedge I found the line that was causing the issue...

    { _this call MY_fnc_hackingCompleted },    ``` this is the text in the biki
#

why doesn't it have a semicolon after the code?

little raptor
warm swallow
#
    cutText [Generator has been repaired", "PLAIN", 2];``` this is my field for that
warm swallow
warm hedge
#

Semicolon is to end a sentence, and the code has just reached to the end

warm swallow
#

so I should remove my semicolon in my field

warm hedge
#

I didn't said so

#

You can but not mandatory not to have the semicolon

warm swallow
#

im so confused atm. So when I remove the code and the semicolon, the error squigly goes away...

#

i dont understand if its code

little raptor
#

you should remove the object itself

warm hedge
#

Also your sentence, it's broken. Put " in the Generator... part

warm swallow
warm swallow
little raptor
warm swallow
#

ohhh

#

so I dont need the setPos part.. ahhh

little raptor
#

the wat?

warm swallow
#
_gslist = _gslist - (getPos _gen1);```
little raptor
warm swallow
#

can be simplified to

_gslist - _gen1
#

right?

little raptor
#

no

warm swallow
little raptor
little raptor
warm swallow
#

ohhhh

#

what does [] do?

little raptor
warm swallow
#

ohhh

little raptor
#

you can only subtract two arrays

#

not array from a number, or object , etc.

warm swallow
#

I see

#

thank you very much

little raptor
#

you can even tell by looking at the syntax highlighting

fading dust
#

i want to replace the vanilla rank icon " rank Chevron " ( the one that appear over the players head in multiplayer ) with custom insignias but as mission sqf not server sqf any script for that

little raptor
little raptor
fading dust
#

so how

#

i want to be mission specific not server

warm hedge
#

Via making a Mod

#

And some script along with it

fading dust
#

u mean add it to my mod ??

warm hedge
#

What?

#

Add what? To what?

fading dust
#

create a pbo file for replacing the vanilla chevron with my own and add it to my faction mod]

#

but question is how to do the replacing

warm swallow
#

ah, one more question. What should I use instead of sleep when I am working inside the init field of an object. I want the players to have an animation that plays on start, but the full animation is too long, so I am cutting it short. I need another command that makes a delay but I am not sure what to use

#

p5 switchMove "Acts_UnconsciousStandUp_part1";
sleep 30;
p5 playMoveNow "";  

#

this is what I have in one init field for example

warm hedge
warm swallow
#

should I use execVM again...

warm hedge
#

Just spawn it

warm swallow
#

ok

warm hedge
#

Also why you do it in an object's init field?

fading dust
#

so is their a template for config , for the replacing the rank chevron in the player nametag

little raptor
warm swallow
#

hmm

#

@little raptor im still running into the issue where the spawns aren't deleting themselves after a player spawning there, so there are instances where 2 people spawn at the same location.

#

_pslist = [ps1,ps2,ps3,ps4,ps5,ps6,ps7,ps8,ps9,ps10];
private _player1 = selectRandom _pslist;
_pslist - [_player1];
p1 setPosATL getPosATL _player1;```
#

thats the script i use just multiple times for all the different players

little raptor
#

you're just deleting without saving the result

warm swallow
#

?

warm swallow
bitter jewel
#

_pslist - [_player1];

warm swallow
#

so.

_pslist = _pslist - [_player1];```
#

?

little raptor
warm swallow
#

thank you

warm swallow
#

@warm hedge im not sure why, but the script we were talking before, about the code. The hold action script still isn't working in context even though it worked before.

[
    g1,                                        
    "Repair Generator",                                        
    "",    
    "",    
    "_this distance _target < 2",                    
    "_caller distance _target < 2",                        
    {_caller playMoveNow "Acts_carFixingWheel";},        
    {},                                                    
    {
        cutText ["Generator has been repaired", "PLAIN", 2]
    },                                                
    {
        _caller switchMove "AmovPercMstpSrasWpstDnon";
    },                                                    
    [],                                                
    25,                                                    
    0,                                                
    true,                                            
    false                                        
] remoteExec ["BIS_fnc_holdActionAdd", 0, g1];``` this code is in an sqf that is called at the beginning of the mission, and I've made sure that the names match
little raptor
#

_caller
not defined

warm swallow
#

the holdaction isnt showing up when i go up to the object

warm swallow
little raptor
warm swallow
#

i thought they were optional?

#
[
    _myLaptop,                                            // Object the action is attached to
    "Hack Laptop",                                        // Title of the action
    "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",    // Idle icon shown on screen
    "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",    // Progress icon shown on screen
    "_this distance _target < 3",                        // Condition for the action to be shown
    "_caller distance _target < 3",                        // Condition for the action to progress
    {},                                                    // Code executed when action starts
    {},                                                    // Code executed on every progress tick
    { _this call MY_fnc_hackingCompleted },                // Code executed on completion
    {},                                                    // Code executed on interrupted
    [],                                                    // Arguments passed to the scripts as _this select 3
    12,                                                    // Action duration [s]
    0,                                                    // Priority
    true,                                                // Remove on completion
    false                                                // Show in unconscious state
] remoteExec ["BIS_fnc_holdActionAdd", 0, _myLaptop];    // MP compatible implementation```
#

this is the BIKI example that im going off of

little raptor
#

I'm not talking about that _caller

#

talking about _caller switchMove "AmovPercMstpSrasWpstDnon";

#

_caller is not defined there

#

only _this is

warm swallow
#

well, the script was working before

#

im not sure why it stopped

#
params ["_target", "_caller", "_actionId", "_arguments"];```
little raptor
#

where have you put that code?

warm swallow
#

on the BIKI it says this is the param for that field

warm swallow
#

I put it in the object's init but it still didn't work

little raptor
#

you shouldn't put that in object init

warm swallow
#

yeea

#

its not now

little raptor
warm swallow
#

wait, would it make a different if I have it set as a simple object

little raptor
#

yes

warm swallow
#

๐Ÿ˜ฎ

#

that could be the reason...

#

is remoteExec preffered over execVM?

little raptor
#

they're different things

warm swallow
#

ok

warm swallow
# little raptor yes

its a shame, I was using setObjectScale which requires it be a simple object, I see how they wouldn't be in conjunction with each other

tough abyss
#

Anyone have a config for a prop?

#

like a model that has exported from blender to arma 3 and I want the object to be a prop

tough abyss
jade acorn
#

i guess

tough abyss
#

ok thank you

chilly bronze
#

is there a way to make only certain AI in a team hostile to a player? example, make only 1 opfor in a group hostile to a civilian player, but the rest of the group is not

thorny gull
#

So I need some assistance, I am trying to use the tracer module, and it isnโ€™t working, I canโ€™t find any tutorials except one on how to place it in Zeus and I am trying to set some up to a trigger so there is ambient AA Fire. Can someone help me?

vivid estuary
pallid ravine
#

Is there any documentation out there on which scripting commands are usable in a public zeus custom composition?

pure socket
#

Has anyone ever only made a raffle mod?

#

I can only randomly select one item in an array to generate, I want the items in this can set the probability of generating items in it any friends have any good ideas?

jade acorn
#

there's a lottery mod for Exile mode, search for "exile scratchie" in google

little raptor
pure socket
#

that good i try it

#

thanks

finite lion
#

are we free to use the arma 3 base campaign scripts as we please?

#

because they're so cool, and useful that I wanted to use them

#

idk if it's possible to do that without broking the law

winter rose
finite lion
#

really? so I don't need to import them to my mission folder?

#

darn I'm so dumb I didn't notice it's loaded with the game

winter rose
#

no, you can directly reference them with (for a one time usage) [arguments] execVM "\path\to\file.sqf
or declare them in CfgFunctions with @path\to\file.sqf iirc

finite lion
#

oh

#

thank you very much Lou guy

#

XD I realised I don't actually need to read over 30 different scripts to use them
XP I just need to call them in CfgFunctions.

finite lion
#

Das a big yeet (ignore this I'm just autistic XD) (not lying I really am)

winter rose
#

not yeetin', only showing the wonders we have ๐Ÿ˜›

finite lion
#

yes, by the way, contact DLC is weird, at the same time we get a lot of persistency functions that earlier we did not have

#

which is why I may be buying Contact DLC... sadly

winter rose
#

don't buy it just for that ๐Ÿ˜‰ and most of its functions are tailored for singleplayer

finite lion
#

yeah, as the campaign I'm trying to make is for singleplayer

#

I'm still figuring out the Arma 3 base campaign Hub variables

#

so I can make the same stuff the base campaign made but for malden

storm jungle
#

How could i create a task where i would need to heal injured a.i? Could anyone point me in right direction ๐Ÿ˜…

#

I was thinking to create a pilot rescue task where i need to heal the pilot and extract him

real tartan
#

if I put code to init field of object, it is called on all clients and server? Is it same as calling script via init.sqf?

// init of object
[this] execVM "script.sqf";
// init.sqf
[myObjectName] execVM "script.sqf";
winter rose
hollow thistle
#

Kinda, init box is executed everywhere jip included. But it's executed way earlier than init.sqf (during object creation)

winter rose
#

and what ^ he said ^-^

real tartan
#

in addition to that, it is same as

// initServer.sqf
[[myObjectName], "script.sqf"] remoteExec ["BIS_fnc_execVM", 0, true];
digital hollow
#

How can I get the position of a rifle's muzzle, where the projectile will start?

little raptor
#

@digital hollow

onEachFrame {
    _w = currentWeapon player;
    //update weapon info upon weapon switch
    if (_w != player getVariable ["last_weapon", "?"]) then {
        _cfg = configFile >> "CfgWeapons" >> _w;
        _m = getText(_cfg >> "model");
        //if (_m select [0,1] == "\") then {_m = _m select [1]};
        _o = createSimpleObject [_m, [0,0,0], true];
        _off = _o selectionPosition [getText(_cfg >> "muzzlePos"), "memory"]; 
        _off = _off apply {[_x]};
        deleteVehicle _o;
        player setVariable ["offset", _off];
        player setVariable ["last_weapon", _w];
        player setVariable ["proxy", 
            [
            "proxy:\a3\characters_f\proxies\pistol.001",
            "proxy:\a3\characters_f\proxies\weapon.001",
            "proxy:\a3\characters_f\proxies\launcher.001",
            "proxy:\a3\characters_f\proxies\binoculars.001"
            
            ] select (([1, 4, 4096] find getNumber(_cfg >> "type")) + 1)
        
        
        ];
    };
    _offset = player getVariable ["offset", []];
    _proxy = player getVariable ["proxy", ""];
    // using LOD resolution 1 (and lod index 0). This is not always reliable
    // you should manually check allLODs and find the most suitable LOD (smallest res LOD usually has the best accuracy, but it might be slow too)
    player selectionVectorDirAndUp [_proxy, 1] params ["_vy", "_vz"];
    _pos = selectionPosition [player, _proxy, 0];
    
    _vx = _vy vectorCrossProduct _vz;
    
    _mat = matrixTranspose [_vx, _vy, _vz];
    _pos = _pos vectorAdd flatten(_mat matrixMultiply _offset);
    
    _p1 = player modelToWorldVisualWorld _pos;
    _p2 = _p1 vectorAdd (player vectorModelToWorldVisual (_vx vectorMultiply -1000));
    drawLine3D [ASLtoAGL _p1, ASLtoAGL _p2, [1,0,0,1]];
}
#

^ _p1 is the muzzleEnd in world

digital hollow
#

hotdamn

pallid ravine
#

In zeus, when an object with a variable name is placed multiple times, are the subsequent placements' variable names the same as the original objects' but with an appended _#, just like in the editor?

little raptor
#

are there even any variable names?

#

in any case I doubt it

pallid ravine
#

Via custom compositions, yes, there are variable names.

acoustic abyss
#

What is the least intensive method to script a condition on a server that fires periodically ?

#

In my case: an ambient flyby every ~15 minutes.

winter rose
pliant stream
#

i only have one though, and it polls expiry on a priority queue of timers

little raptor
#

scheduled and sleep will do

hollow thistle
#

sleep (60 * 15);

pliant stream
#

precise timers are very useful for lots of things. you get the 15 minute timers for free on top

#

i imagine like CBA or some other library must already have this or equivalent

hollow thistle
#

Yes it does.
CBA_fnc_waitAndExecute
CBA_fnc_waitUntilAndExecute

pliant stream
#

does it have repeating timers also?

hollow thistle
#

yes
CBA_fnc_addPerFrameHandler

pliant stream
#

no i mean like execute this callback every 50ms

hollow thistle
#

CBA Per frame handler supports interval in seconds

pliant stream
#

oh i see

#

would not have guessed that from the name

#

but it sounds good

acoustic abyss
#

Thanks everyone. Just to be concrete: for non-CBA users, the loop is made with a for , not BIS_fnc_loop on initserver.sqf ๐Ÿ™‚ ?

pallid ravine
#

Is there a way to either change a marker's name (not the displayed text), or a way to add a marker to the zeus interface as an editable object?

still forum
#

Markers in Zeus... I think are controlled by "creator"
If you create marker via script, you can put the Zeus logic as creator object, that might make it show in zeus

pallid ravine
#

Alright, I'll give that a try and see if it works!

still forum
#

If that doesn't work.
Place a marker in Zeus, and check what it's name format is in allMarkers.
I think Zeus also has a special format

#

But don't know if that matters

warm swallow
#

I'm trying to make an icon above an object that is a), in the physical world (not on map), and b) is only visible to one side. I thought a way to maybe accomplish this was using the waypoints as a way to make it visible, but for waypoints, can you move them to a certain location through scripting?

warm swallow
#

nevermind, im using tasks now

willow hound
warm swallow
#

@willow hound so I switched to using tasks. With waypoints it only has 1 shown at a time. Tasks work better for it. The only issue im having is that the tasks don't want to move to where I want them to move...

#

im moving the task to the module position, which is moved to the object, but on mission start they are where I place it.

#

nevermind! I got it to work by changing the objects pos to the syncronised object

winged gull
#

Guys so sorry. I need info on a script / command. Any one able to help? Ive got a awesome idea for my mission but cant do it without this issue resolved.

pallid ravine
#

This is the place for questions, so go ahead and ask away.

winged gull
#

Thank you.

So basically all i want is a OPFOR unit to wait for idk 10 seconds or something then move to a staging area to initiate an attack. Ive done some research on "sleep" , "wait unti" but i cant seem to find any solution. Is their a way to get this line of script into a trigger to make the unit move after a certain amount of time?

#

And is their a way to get units to move at a certain time in the game? For instance move at 12:00? (this method would be preferred)

pallid ravine
#

Triggers run in an unscheduled environment, so if you want to use sleep or waitUntil, then you'll need to run your code with something like:
arguments spawn {"Code goes here";};
More info on spawn here: https://community.bistudio.com/wiki/spawn

winged gull
#

Thank you however im really not good with scripting or coding. How would i use this in my game with a unit and what would i need to use to execute:(

tough abyss
#

@winged gull Basically you could just put this in the unit's init

this spawn {
  params["_unit"];
  // your code goes here
};
#

any code you put in that will run in a scheduled environment meaning you can use things like sleep and waitUntil

#

and you can use _unit to do things to the unit

winged gull
tough abyss
#

if you want more complex movement you'll want to look into the waypoint-related commands

winged gull
#

Lovely i see. So if i wanted a tank to move at 12;00 is that easily executable in the script init you just given me?

tough abyss
#

just keep in mind any code you put in the unit's init will be run for every joining player

#

so if you only want it to happen once a trigger will work better

#

you could script that, yes

#

there are commands for getting the current time and such

pallid ravine
#

Or wrap your code inside an if (isServer) if using an init is more convenient

tough abyss
#

^

winged gull
#

Right okay... Ill have a look. Thanks guys

warm swallow
#

How do I get rid of errors of possibly undefined variable when I have the variable as an object name in the mission?

jade acorn
#

check if you wrote the variable name correctly? clueless

#

or rewrite your code, you're missing something probably.

warm swallow
#

hmm

#
_pslist = [ps1,ps2,ps3,ps4,ps5,ps6,ps7,ps8,ps9,ps10,ps11,ps12,ps13,ps14,ps15,ps16,ps17,ps18,ps19,ps20,ps21,ps22,ps23,ps24,ps25,ps26,ps27,ps28,ps29,ps30];
_kslist = [ks1,ks2,ks3,ks4,ks5,ks6,ks7,ks8,ks9,ks10,ks11,ks12];```
#

thats just an array tho

jade acorn
#

and both are in local scope, if you try to call them globally you will get errorrs.

flat eagle
# warm swallow hmm

remember all those variables NEED to be defined before the array is call, or you will get an undefined variable

warm swallow
flat eagle
#

are they an object? like somthing you place?

#

because you need to place it in the variable space in the object (just double click on it)

pallid ravine
#

One option is to change the array to an array of strings representing the variable names, and to get a reference to the object with that name, use the missionNamespace getVariable "Name"; command.

warm swallow
#

ok

#

i got it, i ended up forgetting to name something for ps22

#

oops

flat eagle
#

its how it happens

winged gull
#

Guys ive had a play and so far ive got the time figured out (on what time to send AI) but how do i use it with the move commands??

daytime > 10.25 - how can i fit that with a move command?

flat eagle
#

use sleep

pallid ravine
#

Yep, you'll need to calculate how much real time until 10.25 in game time with (10.25 - dayTime)*60/timeMultiplier, and then sleep for that much time, then run whatever scripting commands you want.

warm swallow
#

so im still ecountering a var issue. at the beginning of my sqf, there is

 private _pscore = 0;``` and the part that the game doesn't like is 
```sqf
_pscore + 1;```
#

i dont see the issue..

#

wait

#

does it need to be

_pscore = _pscore + 1;```
pallid ravine
#

If you are trying to increment _pscore, yes.

warm swallow
#

i am, im still getting the error on the second one though, i have no idea why

pliant stream
#

let's see the whole code then

#

and the error

warm swallow
#
private _pscore = 0;
if (_pscore == 4) then (escape setVariable["bis_disabled_Door_1",0,true]); 
[
    g1,                                        
    "Repair Generator",                                        
    "",    
    "",    
    "_this distance _target < 2",                    
    "_caller distance _target < 2",                        
    {_caller playMoveNow "Acts_carFixingWheel";},        
    {},                                                    
    {
        titleText ["Generator has been repaired", "PLAIN", 10];
        _pscore = _pscore + 1;
        g1 say3D "s2";
        titleFadeOut 5;
    },                                                
    {
        _caller switchMove "AmovPercMstpSrasWpstDnon";
    },                                                    
    [],                                                
    25,                                                    
    0,                                                
    true,                                            
    false                                        
] remoteExec ["BIS_fnc_holdActionAdd", 0, g1];```
pallid ravine
#

Those scripts inside your remoteExec are their own scope, you need to pass _pscore as an argument, or make it global.

flat eagle
#

might be easier to make it a global

warm swallow
#

ok

#

yea

#

ill just do that

still forum
#

The if/then also has wrong syntax

#

then takes curly braces

warm swallow
#

ah

flat eagle
#

also _pscore in the way it is will alway be reset back to 0 when ever this script is called

pliant stream
#

depending on what you're doing, you probably need to be very careful about synchronisation here, if you care about correctly incrementing the score

warm swallow
flat eagle
#

right on

warm swallow
pallid ravine
#

If this script is only called once, then keep in mind that the if is always going to be false since _pscore will never be 4 when it is called.

Also, depending on whether or not this is singleplayer, you might want to consider saving your variable to object scope of each player unit with setVariable. Not necessary, but it can be usefule to keep things organized.

pliant stream
pliant stream
#

remote execute

warm swallow
pliant stream
#

is the score shared among all players or does each player have their own score?

warm swallow
#
publicVariable pscore;
pscore = 0;```
#

i changed it to this

pliant stream
#

yeah no don't do that

warm swallow
#

i should use setvariable instead?

pliant stream
#

i take it the score is shared?

warm swallow
#

well no it doesnt have to be, because im not like showing it on the screen or anything

#

like it doesn't matter until the score is 4

flat eagle
#

pscore = 0; that should be all you need

pliant stream
#

yes, but semantically do you want to have different scores on different players, or is there only one score for the whole game?

warm swallow
pliant stream
#

okay. then when a generator is repaired you want to RE on the server

warm swallow
#

why though, i thought i could keep that private

pliant stream
#

then the server checks if that generator was already repaired, and if not it increments the score, and marks the generator as repaired

pliant stream
#

not correctly anyway

warm swallow
#

okk

pliant stream
#

so you give the server a global variable happy_pscore and in the RE function you increment it if the generator isn't already repaired, and mark the generator as repaired

warm swallow
#

so youre saying i should make another sqf with just the incrments

pliant stream
#

yes, on the server

still forum
#

What is your actual logic?
Does the generator need to be repaired 4 times?

warm swallow
#

no, there are 4 different generators that each need to be repaired

still forum
#

In your repair action.
In the "generator has been repaired"
Just set a variable on the generator (setVariable), make it public (like you did with the BIS_ thing at the top).
The variable says "generator is repaired"

In the holdAction condition put a check for if that variable is set, so that the hold action doesn't show for generators that are already repaired

warm swallow
#

ok

still forum
#

And then, also in your repair action, after all that, just have a list of all generators, and check if the variable has been set on each of them, if yes, they are all repaired and you can do that BIS_ setVariable thing that you did on pscore==4

warm swallow
pliant stream
#

there's a race condition there, though it's probably pretty unlikely

still forum
warm swallow
#

well yea, so I have that code I sent, but x4 for each different generator (g1, g2, g3, g4)

still forum
#

Or rather, each generator you put into that list to be checked at the end.
You can also do 4 out of 6 need to be repaired if you wanted to

still forum
warm swallow
#

yes

#

I am dumb, so i didnt want to complicate things to much

still forum
#

I think in holdAction you have the _target variable, which will be the generator the player is currently repairing.
Then you do
_target setVariable ["generatorRepaired", true, true]

warm swallow
#

on the when completed code?

still forum
#

Currently you have
"g1 say3D"
You can do "_target say3D" instead I think

still forum
pliant stream
still forum
#

I can't look up the holdAction wiki page now

warm swallow
pliant stream
#

yes

still forum
pliant stream
#

to illustrate the synchronisation problems you will meet if you try to do this without involving a central authority

still forum
#

Please don't confuse a beginner with advanced stuff that will not actually matter, that's just confusing and counter productive

warm swallow
#
[
    _myLaptop,                                            // Object the action is attached to
    "Hack Laptop",                                        // Title of the action
    "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",    // Idle icon shown on screen
    "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",    // Progress icon shown on screen
    "_this distance _target < 3",                        // Condition for the action to be shown
    "_caller distance _target < 3",                        // Condition for the action to progress
    {},                                                    // Code executed when action starts
    {},                                                    // Code executed on every progress tick
    { _this call MY_fnc_hackingCompleted },                // Code executed on completion
    {},                                                    // Code executed on interrupted
    [],                                                    // Arguments passed to the scripts as _this select 3
    12,                                                    // Action duration [s]
    0,                                                    // Priority
    true,                                                // Remove on completion
    false                                                // Show in unconscious state
] remoteExec ["BIS_fnc_holdActionAdd", 0, _myLaptop];    // MP compatible implementation```
#

this is what im going off of for that

south viper
#

hi, how can i loop a "playsound" ?

cause while + sleep doesn't work

pliant stream
still forum
warm swallow
#
params ["_target", "_caller", "_actionId", "_arguments"];```
still forum
still forum
warm swallow
south viper
#

initPlayerLocal.sqf

player addEventHandler ["InventoryClosed", 
{
    if ("G_AirPurifyingRespirator_01_F" in goggles player) then 
    {
        
        if (!(gas_mask_effect_sound_playing)) then 
        {
            gas_mask_effect_sound_playing = true;
            "gas_mask" cutRsc ["RscCBRN_APR", "PLAIN", -1, false]; //Overlay on
            while {true} do 
            {
                gas_mask_effect_sound = playSound "gas_mask_effect";
                sleep 15;
            };
        };
    } else 
    {
        if (gas_mask_effect_sound_playing) then 
        {
            boucle = false;
            deleteVehicle gas_mask_effect_sound;
            gas_mask_effect_sound_playing = false;
            "gas_mask" cutText ["", "PLAIN"]; //Overlay off
        };
    };
}];

#

And i have an error for my while

still forum
warm swallow
#

yes

#
 [
    g1,                                        
    "Repair Generator",                                        
    "",    
    "",    
    "_this distance _target < 2",                    
    "_caller distance _target < 2",                        
    {_caller playMoveNow "Acts_carFixingWheel";},        
    {},                                                    
    {
        params ["_target", "_caller", "_actionId", "_arguments"];
        titleText ["Generator has been repaired", "PLAIN", 2];
        pscore = pscore + 1;
        g1 say3D "s2";
        titleFadeOut 5;
    },                                                
    {
        _caller switchMove "AmovPercMstpSrasWpstDnon";
    },                                                    
    [],                                                
    25,                                                    
    0,                                                
    true,                                            
    false                                        
] remoteExec ["BIS_fnc_holdActionAdd", 0, g1];```
#

like this?

still forum
still forum
# warm swallow like this?

Yes.
Now replace "g1 say3D"
With
"_target say3D"
And then after they you can setVariable on _target to remember them it's been prepared

warm swallow
#

hm, is there a way to shrink it so i only need 1 copy of this code for all 4 generators

south viper
still forum
warm swallow
#

well yes, but what do I replace g1 at the beginning with, which identifies which object to add the holdaction onto

still forum
warm swallow
#

wait would it be
_this

still forum
#

That will run the code inside the {} 4 times for each thing in that list, and set _x to the thing it's currently running

south viper
#

yes i have make a loop variable to check it. Do you think I would have problems in multiplayer with this type of variable?

params ["_player", "_didJIP"];

gas_mask_effect_sound_playing = false;
loop = true;

player addEventHandler ["InventoryClosed", 
{
    if ("G_AirPurifyingRespirator_01_F" in goggles player) then 
    {
        
        if (!(gas_mask_effect_sound_playing)) then 
        {
            gas_mask_effect_sound_playing = true;
            "gas_mask" cutRsc ["RscCBRN_APR", "PLAIN", -1, false]; //Overlay on
            [] spawn 
            {
                while {loop} do 
                {
                    gas_mask_effect_sound = playSound "gas_mask_effect";
                    sleep 15;
                };
            };
        };
    } else 
    {
        if (gas_mask_effect_sound_playing) then 
        {
            loop = false;
            deleteVehicle gas_mask_effect_sound;
            gas_mask_effect_sound_playing = false;
            "gas_mask" cutText ["", "PLAIN"]; //Overlay off
        };
    };
}];

warm swallow
#

okay..... my brain, i will try, but it wont be right

warm swallow
#
{
     [
    _x,                                        
    "Repair Generator",                                        
    "",    
    "",    
    "_this distance _target < 2",                    
    "_caller distance _target < 2",                        
    {_caller playMoveNow "Acts_carFixingWheel";},        
    {},                                                    
    {
        params ["_target", "_caller", "_actionId", "_arguments"];
        titleText ["Generator has been repaired", "PLAIN", 2];
        pscore = pscore + 1;
        _target say3D "s2";
        titleFadeOut 5;
    },                                                
    {
        _caller switchMove "AmovPercMstpSrasWpstDnon";
    },                                                    
    [],                                                
    25,                                                    
    0,                                                
    true,                                            
    false                                        
] remoteExec ["BIS_fnc_holdActionAdd", 0, _x];
} forEach [g1, g2,g3, g4]```
south viper
still forum
warm swallow
#

is the params still in the right place for that??

south viper
still forum
#

But Greg you shouldn't call your variable "loop", if any other script does the same, it will break yours.
Name it something unique.
Like "greg_gasmaskloop"

still forum
south viper
still forum
warm swallow
still forum
still forum
warm swallow
#
pscore = pscore + 1;
if (pscore == 4) then {escape setVariable["bis_disabled_Door_1",0,true]}; ```
#

isn't this also acceptable?

south viper
still forum
still forum
#

I assume playSound is not global, pretty sure it isn't

south viper
#

It's Local execution right

still forum
#

On wiki page it's called "local effect", LE icon at the top

#

Instead of GE

south viper
#

perfect

#

and how could I have improved it?

#

just to know how I could do better next time

still forum
warm swallow
#

ok @still forum

{
     [
    _x,                                        
    "Repair Generator",                                        
    "",    
    "",    
    "_this distance _target < 2",                    
    "_caller distance _target < 2",                        
    {_caller playMoveNow "Acts_carFixingWheel";},        
    {},                                                    
    {
        params ["_target", "_caller", "_actionId", "_arguments"];
        titleText ["Generator has been repaired", "PLAIN", 2];
        _target say3D "s2";
        titleFadeOut 5;
        _x setVariable ["repaired", true];
        execVM "repaired.sqf";
    },                                                
    {
        _caller switchMove "AmovPercMstpSrasWpstDnon";
    },                                                    
    [],                                                
    25,                                                    
    0,                                                
    true,                                            
    false                                        
] remoteExec ["BIS_fnc_holdActionAdd", 0, _x];
} forEach [g1, g2, g3, g4]```

```sqf
if ("repaired" getVariable [g1, g2, g3, g4]) then {escape setVariable["bis_disabled_Door_1",0,true]}; ```
south viper
warm swallow
#

wait

#

how do i check if they are all true

still forum
# south viper yes i have make a loop variable to check it. Do you think I would have problems ...

Your else checks if gas effect sound playing, you don't need to check that.
You are already in the "else" part of your if, you can only get there if effect sound playing was already set to true.

You probably don't want to check if that classname is in goggles player, you want to check if it's equal to the goggles of player.
So isEqualTo instead of in
That spawn and while loop, do you have CBA? With CBA that can easily be made more efficient and more precise (looping exactly every 15 seconds, instead of +/- one second or so)

still forum
#

_numberOfRepairedGenerators = [g1, ..., g4] count { condition }

still forum
warm swallow
#

ok

#

so 0 for default 0

still forum
# south viper yes i have cba

I'm on my phone i can't look up their wiki pout_kitty
What you would do instead of that spawn and while loop, would be a CBA_fnc_waitAndExecute.
And in the code, restart the waitAndExecute again
I don't know the exact syntax of it

still forum
#

Instead of numbers

warm swallow
#

hmm

#

so for my if statement

south viper
warm swallow
#

generatorsrepaired would have to be global

south viper
#

thank you very much it's very interesting

still forum
warm swallow
#

you had a _

still forum
#

And you did that, you set repaired globally

#

Oh

warm swallow
#

and I can't replace that with repaired var

still forum
#

Nono, doesn't need to be, what I wrote is right

warm swallow
#

where would I define _numberOfGeneratorsRepaired

still forum
#

You only replace the condition in what I wrote, with the correct getVariable.

At the end of your completed code, or inside your execVMed thing

warm swallow
#
if (_generatorsrepaired = count [g1, g2, g3, g4]) then {escape setVariable["bis_disabled_Door_1",0,true]}; ```
still forum
#

Nono

warm swallow
#

ach

#

yea

#

my brain is having trouble comprehending what youre saying atm sorry

still forum
warm swallow
#

would the condition be the getVariable [g1, g2, g3, g4]

still forum
#

No

#

_x is your generator (like we did on the holdAction with forEach)

Count, counts the number of times the condition returns "true"
And you want to know how many generators have the "repaired" variable set to true

south viper
still forum
#

So you just getVariable from _x, the "repaired" variable.

south viper
#

like

[{gas_mask_effect_sound = playSound "gas_mask_effect"; gasmask_loop = true;}, [params], 15] call CBA_fnc_waitAndExecute;


[{gasmask_loop;}, {gas_mask_effect_sound = playSound "gas_mask_effect";}, [params]] call CBA_fnc_waitUntilAndExecute;

still forum
warm swallow
#

dedmen im not gonna lie im lost chief

south viper
#

Description
Executes a code once in unscheduled environment with a given game time delay. Note that unlike PFEH, the delay is in CBA_missionTime not diag_tickTime (will be adjusted for time accl).

Parameters
_function The function you wish to execute. <CODE>
_args Parameters passed to the function executing. (optional) <ANY>
_delay The amount of time in seconds before the code is executed. (optional, default: 0) <NUMBER>
Passed Arguments
_this Parameters passed by this function. Same as โ€˜_argsโ€™ above. <ANY>

still forum
#

_function = {

play sound
[_this, _this, 15] call waitAndExec
};

[_function, _function, 15] call waitAndExec

still forum
south viper
#
[{_this}, [_this], 15] call CBA_fnc_waitAndExecute;
[{gas_mask_effect_sound = playSound "gas_mask_effect";}, [_this], 15] call CBA_fnc_waitAndExecute;

???

still forum
#

You are missing _function, and you are passing _this wrongly

south viper
#

oh

#

_function = {

playSound "gas_mask_effect";
[_this, _this, 15] call CBA_fnc_waitAndExecute;
};

[_function, _function, 15] call CBA_fnc_waitAndExecute;

still forum
#

Yes.
And add the gas mask effect sound =
Variable thing

#

That will then efficiently and timed exactly to the frame run every 15 seconds

south viper
#
if (!(gas_mask_effect_sound_playing)) then 
        {
            gas_mask_effect_sound_playing = true;
            "gas_mask" cutRsc ["RscCBRN_APR", "PLAIN", -1, false]; //Overlay on
            
            _function = 
            { 

                gas_mask_effect_sound = playSound "gas_mask_effect";
                [_this, _this, 15] call CBA_fnc_waitAndExecute;
            };

            [_function, _function, 15] call CBA_fnc_waitAndExecute;
        };


warm swallow
#
if (_x getVariable "repaired" = true)```
still forum
#

And after it ran, it restarts and waits another 15 seconds.
That's where you want to add your if(loop) then waitAndExecute check, so you can stop it

still forum
warm swallow
#

ok

still forum
#

You have only [] brackets, one underscore, " quotes and commas and letters
:D

warm swallow
#
[g1, g2, g3, g4] getVariable "repaired"```
still forum
#

There is no g1, g2, etc in here

warm swallow
#

so ```sqf
_x getVariable "repaired"

still forum
#

Yes

warm swallow
#

can that go in the execVM file tho?

still forum
#

But missing default value.
Check the getVariable wiki page on how you add a default value

warm swallow
#

ok

still forum
warm swallow
#

alright

#
_x getVariable ["repaired", false];```
still forum
#

The default value is important, because before a generator gets repaired, that variable doesn't exist, so it needs a default to fall back to

warm swallow
#

i get that

#

where do we put count now

still forum
warm swallow
#

ohhhhhhhhhhhhhhh

still forum
#

Lightbulb moment :D

warm swallow
#
_numberOfRepairedGenerators = [g1, g2, g3, g4] count {_x getVariable ["repaired", false];}```
still forum
#

Yep.
So now you are:
Out of this list of generators, counting, which generator has their "repaired" variable set to true.

And result is, number of repaired generators which is put in a variable.

warm swallow
#

got that

#

ohhhhhhhhhhhhhhh

still forum
#

Now, after this line.
You can put a
If number of generators repaired == 4 then...

#

And put there your other BIS_ setVariable

warm swallow
#
_numberOfRepairedGenerators = [g1, g2, g3, g4] count {_x getVariable ["repaired", false];}
if (_numberOfRepairedGenerators == 4) then {escape setVariable["bis_disabled_Door_1",0,true]};```
warm swallow
still forum
#

The bis_disabled door one i meant

warm swallow
#

oh so thats what you meant

still forum
#

You are missing one semicolon before the if

#

At the end of the count line

#

And that block you then put into your execVMed script.
And then it should be all done

warm swallow
#

mhm

#

do i need to do anything with #of repaired generators before this script?

still forum
#

No

warm swallow
#

ok

south viper
#

now the only problem i have is :

when i put if ("G_AirPurifyingRespirator_01_F" isEqualTo (goggles player)) then {code} nothing start but the condition is true...

#

with in goggles player it's working fine

still forum
#

What does goggles player actually return in debug console?

south viper
#

"G_AirPurifyingRespirator_01_F"

#

Yes i know...

still forum
south viper
#

and in the debogage console it"s return true to this : "G_AirPurifyingRespirator_01_F" isEqualTo (goggles player)

still forum
#

Try putting debugging stuff in your code.
systemChat or hint, so you can follow your code while it runs

south viper
#

i'm just stupid

#

_player_goggles = goggles player;

if ("G_AirPurifyingRespirator_01_F" isEqualTo_player_goggles ) then
{code};

that the problem

#

_player_goggles is local so the condition can't know it

#

so know it's working fine...

#

thanks

warm swallow
#

@still forum so

#

the code works except for _x

#

since its in another file it doesnt recognize it like it does in forEach

#

what do I replace that with

#

can I just replace it with [g1, g2, g3, g4]

pallid ravine
#

Paste your code? I'm having trouble following where you're at so far.

warm swallow
#
{
     [
    _x,                                        
    "Repair Generator",                                        
    "",    
    "",    
    "_this distance _target < 2",                    
    "_caller distance _target < 2",                        
    {_caller playMoveNow "Acts_carFixingWheel";},        
    {},                                                    
    {
        params ["_target", "_caller", "_actionId", "_arguments"];
        titleText ["Generator has been repaired", "PLAIN", 2];
        _target say3D "s2";
        titleFadeOut 5;
        _x setVariable ["repaired", true];
        execVM "repaired.sqf";
    },                                                
    {
        _caller switchMove "AmovPercMstpSrasWpstDnon";
    },                                                    
    [],                                                
    25,                                                    
    0,                                                
    true,                                            
    false                                        
] remoteExec ["BIS_fnc_holdActionAdd", 0, _x];
} forEach [g1, g2, g3, g4]```
#
_numberOfRepairedGenerators = [g1, g2, g3, g4] count {[g1, g2, g3, g4] getVariable ["repaired", false]};
if (_numberOfRepairedGenerators == 4) then {escape setVariable["bis_disabled_Door_1",0,true]};```
still forum
#

Well i think I told you to set the variable on _target

#

Just like the say3D

warm swallow
#

getting an error on _x setVariable ["repaired...

still forum
warm swallow
#

wait so replace _x with _target

still forum
#

Ye

#

Only on there

#

_target will be the generator that was repaired

warm swallow
#

ok

#

what about the other instance. its in the other file after count and before getvariable

#

it was _x but i replaced it with an array

#

im going to change it back to see if there is still an error

#

wait

#

@still forum

#

what do i do

still forum
#

The stuff inside the execVM was correct

warm swallow
#

so _x there?

still forum
#

The _x there is set by "count"

warm swallow
#

ohhhh

still forum
#

count and forEach and apply and select and findIf all iterate over an array, and set _x to the current element

warm swallow
#

type array expected code

#

and its like |#|count in arma

still forum
#

Oh maybe i mixed it up

#

It's probably
{} Count []
Instead of
[] Count {}

Just swap the sides

warm swallow
#

huh

still forum
#

Check wiki page for which is right notlikemeow

pallid ravine
warm swallow
#

well

#

the alternative

#

defintifely isnt correct

#
_numberOfRepairedGenerators = {g1, g2, g3, g4} count [_x getVariable ["repaired", false]];
if (_numberOfRepairedGenerators == 4) then {escape setVariable["bis_disabled_Door_1",0,true]};```
still forum
#

:D

#

Yeah no

#

Swap the arguments

warm swallow
#

so what would it be..

#

?

still forum
#

[g1,...] Goes to the end (like forEach)
And {_x...} Goes to the left

#

One argument is the list of things.
The other argument is the condition code

warm swallow
#

ok

#
_numberOfRepairedGenerators = _x count [[g1, g2,g3, g4] getVariable ["repaired", false]];
if (_numberOfRepairedGenerators == 4) then {escape setVariable["bis_disabled_Door_1",0,true]};```
#

@still forum

still forum
#

Omg what

#

Ahh

#

Go back all the way, to the variant that showed you the error

warm swallow
#

shoot

#
_numberOfRepairedGenerators = [g1, g2, g3, g4] count {_x getVariable ["repaired", false]};
if (_numberOfRepairedGenerators == 4) then {escape setVariable["bis_disabled_Door_1",0,true]};```
still forum
#

The stuff inside the [] and {} stays there, untouched
The [] and {} blocks just swap sides

warm swallow
#

o

#

k

#
_numberOfRepairedGenerators = {_x getVariable ["repaired", false]} count [g1, g2, g3, g4];
if (_numberOfRepairedGenerators == 4) then {escape setVariable["bis_disabled_Door_1",0,true]};
still forum
pallid ravine
#

^

warm swallow
#

so good?

pallid ravine
#

Try it

still forum
warm swallow
#

the first number of generator var turned blue

#

so theres that

#

ok

#

got no error on generator repaired

#

im going to do all of them and see

#

works like a charm

#

praise_the_sun ๐Ÿ›

still forum
#

So now that it's all working, back to the thing Untelo talked about

warm swallow
#

hm?

still forum
#

If two players, repair the last two generators at EXACTLY the same time, it will not work.
First player will see the second generator as not being done yet and thus not get == 4 at the end.
Second player will see the first Generator as not being done yet, and also not get ==4 at the end.
Because that repaired variable being transmitted around takes a bit of time

warm swallow
#

ok

still forum
#

But they need to do that so exactly on time that.. you don't need to worry about that to happen.
I'd say it's so extremely unlikely that it doesn't matter

warm swallow
#

what fix is needed though?

still forum
#

But that's something to at least keep in mind

warm swallow
#

thats true

still forum
#

Actually now that i think about it, it's really easy.
You can remoteExec your execVM, and run that on the server

warm swallow
#

doesnt it already run on the server?

still forum
#

No this code all runs on the clients

#

You send the repaired variable via the server to other players, but the code itself runs on the client

warm swallow
#

oh k

still forum
#

You are sending the repaired variable to the server, and the remoteExec.

In the problem case where two players do it exactly at the same time, a couple possible orderings can happen.

P1 setVariable
P1 execVM
P2 setVariable
P2 execVM

In that case, at the last execVM, both variables have been set.

P2 setVariable
P2 execVM
P1 setVariable
P1 execVM

Other way around, same result.

P1 setVariable
P2 setVariable
P1 execVM
P2 execVM

The final ==4 condition will run twice, doesn't matter in this case.

P2 setVariable
P1 setVariable
P1 execVM
P2 execVM

Same thing just mixed.

P2 setVariable
P1 setVariable
P2 execVM
P1 execVM
Mixed again, still same result.

But in every possible case now, it will have the correct end result

warm swallow
#

got it

#

so it doesnt really matter

#

@still forum can I ask if d1 setVariable["bis_disabled_Door_1",0,true] this is correct

#
d1 setVariable["bis_disabled_Door_1",0,true]```
still forum
#

If D1 is a house building thingy then i think yes

warm swallow
#

i cant find bis_disabled_Door_1 on the wiki though

still forum
# warm swallow so it doesnt really matter

If you run the execVM on the server, then all is good.
If you run it on the clients, it's possible that both P1 and P2 run in parallel and don't see each other's setVariable

still forum
warm swallow
#

ah

#

so this code still works?

if (_numberOfRepairedGenerators == 4) 
then {
    d1 setVariable["bis_disabled_Door_1",0,true];
    d1 setVariable["bis_disabled_Door_2",0,true];
    };
still forum
#

Ye, that would be two different doors then that you are disabling

warm swallow
#

well

#

in my case it is a fence

still forum
#

Well if the fence has a door, it's still a door :D

warm swallow
#

also I plan for the "power" that the generators provide open a lot of escape routes so

still forum
#

You can do a lot more stuff with your script now.
You can turn off lights n stuff

warm swallow
#

yes!

#

thanks

#

can I use sleep inside of a trigger?

pallid ravine
warm swallow
#

ok

true frigate
#

Is there some way to convert a string into something hintable?

Hint A; ```
works fine, but
```A = 1;
B = 2;
C = B+A;
hint C; ```
Gives a generic error (As C isnt surrounded by "")
and 
```A = "1";
B = "2";
C = B+A;
Hint C;
Hints "12"```

So is there a way to convert these, so the math works and so does the hint?