#arma3_scripting
1 messages Β· Page 369 of 1
I had an evil plan of inducing epilepsy to cheaters by skipping time by infinite value, it used to make screeching noice and screen flashing black and white
Key down*
ok just for the records, i do have one and that triggers when i spress shift + -, and it does what it does and returns true.
Jesus, what if someone with mild epilepsy cheats, you 'gon kill some dude
BUT still arma does not care and executes the cheat
no longer possible though as infinites are no longer considered numbers
I think shift+- might be grabbed by engine before it reaches key handlers
but you can just kick the player when he presses that
Really?
I atleast do
People will stop using flush if they get kicked everytime
flush should be obsoltete since x64
Lol
ok sry
Lol
My server freezes me, I cannot use any shift numpad minus. Ive yet to bypass it
@tough abyss Actually as you are serverside. You can theoretically get nanosecond precision by using Intercept
Oh hell I would so much prefer c++ thanks for remind me of it existing
Or that lua interpretation
Maybe expand it to c# with ref classes and a wrapper hmm
We need to go deeper, write custom extension
nanosecond precision and arma sound like, nitro injection for my turtle ....
That's what I just said.. somewhat @meager granite π
Lol
its a good thing, but arma is just not able to handle it
Someone already tried a C# wrapper and failed so.. probably not gonna happen.. I guess.
I don't know C# myself
What did they try?
Because C# suckzzzz
I would personally try ipc or com or hosting clr
I dunno
inb4 Cloud needs to just send a public variable each 5 minutes
Better use Intercept then
#Intercept-Network
Public vars .... buhhhhh
Agreed
Use remotexec with jip m8
You're all so 2007, custom-written arma engine ftw
sqf-vm π
_unit = this select 0;
if ({!alive _x} count crew _unit == 0) then {_unit setDamage 1}
}];````
still did not managed to make it work
any script errors @astral tendon?
@still forum i like how you try to sneak that one in all the time >.> Why don't you just rewrite arma
literary nothing
Or join them for arma 4 and make it better
What am I trying to sneak in? ^^
That's the first time I sneak in sqf-vm
@astral tendon put some diag_log's into it to test what's wrong
Nah nah nah, there was no way around in since you had it released the first time XD
But I thinks its a good util so its fine
yeah ok i kinda put you two together sry
π
how?
Arma studio thingy and stuff ... you are married in my mind
@astral tendon like I said..
this addEventHandler ["hit", {
_unit = this select 0;
diag_log ["hit", _unit, crew _unit, {!alive _x} count crew _unit];
if (({!alive _x} count (crew _unit)) == 0) then {_unit setDamage 1;};
}];
I wish he just implemented the debugger into visual studio code or atom
Actually the only thing I ever made myself from scratch is my SQF debugger. That people only know through Arma studio..
Intercept, TFAR, whatever else I just joined in at some time and made it better
instead of making a whole new ide
Β―_(γ)_/Β―
15:36:07 ["hit",any,array,scalar]
@still forum new tfar compatible with battleye?
yes
nope, still noting
is there some kind of list what's new, changed etc
_unit = _this select 0;
if ({!alive _x} count crew _unit == 0) then {_unit setDamage 1}
}];```
or
Join TFAR Discord and read the changelog in #announcements
okay thanks
_unit = this select 0;
if ({!alive _x} count crew _unit == 0) then {_unit setDamage 1}
}];```
@astral tendon Leave the diag_log in and send me what it tells you
only change the second this
@simple solstice Or if you mean what changed in 1.0 in general: https://github.com/michail-nikolaev/task-force-arma-3-radio/releases/tag/1.0-PreRelease
If you don't want to read the changelogs of the about 200 builds since 1.0 started
15:41:25 No speaker given for
15:41:27 ["hit",any,array,scalar]
15:41:27 ["hit",any,array,scalar]
15:41:27 ["hit",any,array,scalar]
15:41:27 ["hit",any,array,scalar]
in the init
_unit = _unitthis select 0;
diag_log ["hit", _unit, crew _unit, {!alive _x} count crew _unit];
if (({!alive _x} count (crew _unit)) == 0) then {_unit setDamage 1;};
}];````
derp
not intended for production use ;(
@astral tendon Or.. As I told you.. just use params
holy shirt why is there unitthis
@simple solstice Just a disclaimer. in case something breaks and people think they can yell at me
so it's stable?
yeah
kk
https://steamcommunity.com/sharedfiles/filedetails/?id=894678801&searchtext= 3k users on steam workshop alone
5600 users in the last 24hours
So I'd say it's stable enough
yeah I guess
@little eagle Regarding my original question, why does it crash though?
It can find the files most of the time, but on some machines it just straight up kills the server the moment the mission is being loaded, so I guess it's not able to find the files that are meant to be included
Sorry I forgot what your question was.
I also fail to find it
"What's the deal again with including game files from the missionfile? I must have forgotten what the issue is with it again..."
"Randomly results in crashes while on other machines it works fine, strange to me"
Including an addon scope file in the description.ext ?
If the file is not there. Then crash.
Also you cannot #include from addons in missions that are loaded from folder instead of from pbo.. I think.. right?
Yes, has been broken since 3den exists.
Only applies to the dedicated server though when you log in as admin and pick it on the mission select screen or something like that.
_this select 0 params ["_unit"];
if ({!alive _x} count crew _unit == 0) then {_unit setDamage 1}
}];```
i still failed at this
DUDE
this addEventHandler ["hit", {
params ["_unit"];
if ({!alive _x} count (crew _unit) == 0) then {_unit setDamage 1;};
}];
And put the diag_log back in to find out if it's working
Hi, is there a way of detecting who the player is and make an AI unit join his group while activating an addAction?
the player is player
params ["_unit"];
if ({!alive _x} count (crew _unit) == 0) then {_unit setDamage 1;};
}]
16:28:55 [1.25919e+006,29732,0,"XEH: PostInit started. MISSIONINIT: missionName=dfbhd_bandit_cross, missionVersion=53, worldName=pja310, isMultiplayer=false, isServer=true, isDedicated=false, CBA_isHeadlessClient=false, hasInterface=true, didJIP=false"]
16:28:55 [1.25919e+006,29732,0,"CBA_VERSIONING: cba=3.4.1.170912, "]
16:28:55 [1.25919e+006,29732,0,"XEH: PostInit finished."]````
are you serious?
I don't have time for such learn-resistant idiots.
[yourAI] join (group player)
Will put that AI into the players group
Will it work in multiplayer if I do
[prisoner] join player;
?
oh group player
But yes. That #should work
Nerver mind, triggers are the way to go.
https://community.bistudio.com/wiki/join Wiki says effect is global. So it works the same in MP as in SP
Alright, I will try. Thanks
I've been told that we shouldn't script with 'player' in dedicated servers
it won't work if you script runs serverside.
And if Zeus is controlling a unit then player will point to the Zeus unit. Not the unit the Zeus is remote controlling
because everyone is a player in a dedicated server, but I guess that because I use an addAction it's making it dedicated to the specific player
yes.. everyone is a player. But on clientside there is only ever one player
player always points to yourself
right, I will try it. Thanks!
it says in the wiki that if I want the unit to leave the group I should use grpNull instead of player group
like [guy1] join grpNull
done it
_car = _this select 0;
if ({alive _x} count (crew _car) == 0) then {_car setDamage 1}}];```
now the car explodes when hit wile having no crew
Thanks @still forum
Random Q: is there a way to enable chat in SP?
No.
Ok, thanks π
never noticed the chat was disabled in SP
ctrl+F and F3, nigel
Chat is disabled in SP and so is respawning. And there is no way to get them to work. Well I guess you can try to recreate both features with a lot of scripting.
I get why you'd want respawning in SP. And I can see how you could emulate it. But why would you need a chat?!
if you want units to communicate via text, you could use drawIcon3D for it
atleast for regular communication, it may not be suitable for radio comms ^^
Oh, systemChat works fine in SP. And so do the other commands I think. But you can't type anything yourself.
@peak plover There's a RPG chat frameowrk Google might find it
didn't get any luck on this - maybe you remember where did you locate it? bif scripting subforums? the best bet i found is this one: https://github.com/AsYetUntitled/Framework
but i guess you were talking about a SP and MP compatible rpg-like conversation/chat framework?
with conversation tree support, right?
It was years ago on armaholic, someone made it for RPGs
not sure if it was mp compatable
you mean this: http://www.armaholic.com/page.php?id=31300 ?
it had selectable answers and text
Bad memory not sure π¦
But I know somewhere something exists
π
Hey, does anyone know why this script i made doesnt work? it just doesnt spawn the helicopter or anything nor does it give any errors what so ever
not sure, but it sometimes looks cooler to just setFuel 0 a helicopter and lock the doors if you want it to crash
first ensuring it's at a good altitude of course
nah its not susposed to crash
its susposed to fly around until a player shoots it down and spawn a crate
Is there any way to make an animal, lets say a goat, move faster then it does with playMove "Goat_Run"; It's "running" is more like slightly faster walking?
not that i know of lol (personally)
@zinc fossil setAnimCoef
not sure if it works on animals but give it a go
or setAnimSpeedCoef, can't remember
you can make players run at like 500mph though, smoke a joint and play around with it, it's fun
Will test it out. Thanks
does it work?
on animals? noice
Oh I thought you meant on players my bad
I can't get it to work on a goat
So still didn't find a good way to detect weapon change without writting a scheduled loop, as I will have to depend on a few of them later down the line, so the less I put the better. Anyone has any clues how to do that? In the video you can see that when you change weapon it still thinks you are out of ammo and there's no EH for that.
https://www.youtube.com/watch?v=TzZ2_NSmaXI
["lowAmmoBadge", "onEachFrame", {
playerEyePos = ((ASLToAGL eyePos player));
_weaponDir = (player weaponDirection currentWeapon player);
_vectorSide = (vectorDir player) vectorCrossProduct (vectorUp player);
avaHUDBaseVector = (_weaponDir vectorAdd (_vectorSide vectorMultiply (-0.12))) vectorAdd ((_weaponDir) vectorMultiply -0.6);
if(inAvaRange) then {
if(hasLowAmmo) then {
_lowAmmoVector = (playerEyePos vectorAdd (avaHUDBaseVector));
drawIcon3D [MISSION_ROOT + "resources\hud\low_ammo_hud.paa",
if(parseNumber(((currentMagazineDetail player) splitString "(/)") select 1) == 0) then [
{[1,0,0,1]},
{[1,0.8,0,1]}
], _lowAmmoVector, 10, 10, 0, "", 0, 0.025, "TahomaB"];
};
}
}] call BIS_fnc_addStackedEventHandler;
inAVArange = true and hasLowAmmo defined reliabiliy outside
Comparing two strings each frame is not that bad
There is no event handler so you have to produce the event yourself
Trying to execute simple script from addAction on an object. Works in editor, won't work on dedicated server. Here's what I have:
box1 addAction ["Action Text Here", "somescript.sqf"]
What am I doing wrong?
what do you mean by "won't work"?
option shows up, but when clicked does not execute
probably a problem in somescript.sqf then
works perfectly fine in editor preview, which is the strange thing
but that call function is still correct? nothing has changed in recent updates right?
i can also do execVM "somescript.sqf"; through debug console on dedicated server, and it works verifying that it not an issue with the sqf
seems to be something im missing in the call
does box1 addAction ["Action Text Here", {ExecVM "someScript.sqf"}]; work @tough moth ?
If the other situation isn't working where its just a normal addAction
Β―_(γ)_/Β―
If it works it works
ewwwwwwww
Some people just never get out of the beginner level
2real @still forum.
hides
i am the realest scripter i only use SQS
π±
@tough abyss loops Screenshot command endlessly
player addEventHandler ["Fired", {(_this select 6) spawn {sleep 0.1; _this setVelocity ((velocity _this) vectorMultiply -1);};}];
π΅
yes.. no... won't work
oh no
setVelocity takes object.. You give array π
oh... woops
thats what happens when you try to avoid a bad habbit at the wrong time
But if you shoot yourself indoors you still can't kill yourself π€
fear not, the ways of the fired-eventhandler are plentiful
player addEventHandler ["Fired", { (_this select 0) attachTo [_this select 6]; }];
Won't that be under your feet?
its the mΓΌnchhausen script
I'd suggest to attach yourself to the bullet but you probably can't
Oh, I thought you attached bullet to yourself
Anyway attachTo doesn't work with projectiles iirc
hmmm
no idea
i can write nonsense like that all day
replaced bullets with camping lanters once, at night
that was rather spectacular
felt a bit like shooting the plasma gun from doom
the fun really starts when you use ropes for that
especially when the other end attaches to static objects
or rpg-rockets that stop after beeing fired and then slowly follow you around...
I know it's sad but I never get tired of messing with "fired" π
anyway.... https://community.bistudio.com/wiki/createAgent
can anyone confirm what Waffle SS. posted there ?
that agents cost more resources than regular AI ? I kinda doubt it.
AI also see walls.. Otherwise they would just shoot through them.. Waffle's comment seems to say that AI completly ignores obstacles
Animal AI is also FSM. And Animals are Agents
But a Agent without FSM will just stand around and do nothing.
Wth a compilcated FSM attached they are ofcause worse on Performance than normal AI's
the animal behaviour can be disabled via variable though
im not sure if I should use agents as civilians or just civilians with most their AI routines turned off (including FSM)
yeh, also saves me the trouble of having to manage groups
then again, maybe agents are too limited
that is, if I ever need a civ to reach for his gun
Make it a 3den setting.
trigger_1 isEqualType objNull
true/false?
thanks
while {not isnull _caller} do { "mkr_unit1" setmarkerpos getpos _caller; sleep 0.5; };
}; ```
why is this not working?
caller is not defined?
do you guys know any easy script to revive a unit in SP? i just wanna trow that in the unit init and not be able to revive other AIs, only the squad mates
@deft owl local variables don't carry over into spawned scripts..
local varaibles (start with _) only exist in the current script. And get deleted when the script ends.
Spawn spawns a new script that might run when the current script has already ended.
https://community.bistudio.com/wiki/spawn "Additional arguments are passed to the code in local variable _this"
you have to pass the caller as argument.
See https://community.bistudio.com/wiki/call on how arguments work
so i need a loop?
i mean i am a noob π
yep. Read wiki thingies I posted and my message a couple times.
Is there a way to disable Regroup messages from player group leaders?
ACE
Is the way that ACE does it achievable through vanilla arma? I dont have much experience with ACE so unsure about it
I expected enableRadio to work for this but it doesnt
Well.. ACE is a Mod that runs on vanilla Arma
I think he means without mods. No in that case.
Yeah thats what I meant. Oh well thats a shame, thanks anyways thou
you want to disable the message it self or the order?
Just from coming up in general
then, you will have to be the leader or not be in a group
That'd work too.
Ah okay I guess its just another one of those things that are annoying but we cant do much about without mods lol
At least we can do something about them with mods. Could be much worse π
you can at least make em silent: _unit setSpeaker "NoVoice"
but the message itself...
maybe by disabling the group channel ? not sure if the AI cares about that
cant disable the group channel
doh
this might help https://steamcommunity.com/sharedfiles/filedetails/?id=876991445
MRB Voice Stop
although that'll disable enemy AI voices too, iirc
is there any list of all the special BIS_ variables like "BIS_enableRandomization" ?
or "effects"
Anyone know an addon for exile that allows the to get groups so they can get kit
Like donator 1 kit and donator 2 kit
you mean like a list of UIDs that automatically adds certain loadouts to people in that list, on spawn ?
yeah
you call them donator kits, youre aware of the monetization rules?
you can do it but basically only if those kits are purely cosmetic and have no gameplay advantages
i can make one for you for 90% of the income
thats a different thing tho
i dont think theres a list somewhere
:/ a shame
i know theres the special variable to lock doors, too
ah, variables.
yeh those
bis_disabled_Door_#
effects
number # (for karts)
color # (for randomized vehicles)
BIS_SUPP_useDefaultBurst # (for artillery vehicles)
BIS_enableRandomization bool
BIS_fnc_animalBehaviour_disable bool
BIS_noCoreConversations bool
bis_disabled_Door_# 0/1
missionNamespace setVariable ["BIS_dynamicGroups_allowInterface", false]
<curatorModule> setVariable ["showNotification", false]
found some more by searching the sitreps π
okay either i found a bug or i miss something, if im correct a rearm of a vehicle should take 'ammo cost' x 'count of that projectile' (like rockets) ammount of ammoCargo out of an ammo carrier (like vehicle ammo box)??
but if i use an vehicle ammo box (transportammo = 30k) the ammount removed is higher and if i use something with much more ammo cargo (huron ammo box) no ammo cargo gehts removed (it carries 1*10^12)
did i miss something for the cost or is this a bug because of some calculation error or something???
Why don't you do this. Post your code.
while {true} do {
sleep 1;
systemChat ((getnumber (configFile >> "CfgVehicles" >> typeOf _this >> "transportAmmo") * (1 - getAmmoCargo _this)) tofixed 6);
}
};``` thats the code i use to get the ammo amount used
1002,818970
1502,137207
2005,537720
2504,961426
3008,630371```
and these are the values of removed ammo cargo if i have an orca with a skyfire launcher and removing 1 rocket at a time and let it refill ( cost of sykfire rocket ammo is 500)
(the code to get the ammount used is put into the init of object)
The old way of making cinematic cutscens and camera movements is not working.
How do I do this in the new ARMA update?
Is it a zeus function now?
okay same with an wipeout were i remove the ammo of the minigun via cameraon setMagazineTurretAmmo ["1000Rnd_Gatling_30mm_Plane_CAS_01_F", 0 ,[-1]] cost is now 20013.925781 with an box_east_ammoVeh_f as ammo source O.o?
should only be 20000 <.<
There is bi useable guides for making mission into and outro cinematics and cutscenes because "camera.sqs" dont work anymore.
Does anyone know what could be causing a setVariable to be very slow like 5 second delays sometimes
just on a item
not really
its so weird
how do you measure?
its so slow i can count it
how do you measure.
If setVariable is slow.. you drop to 0fps for 5 seconds and your game freezes
if that doesn't happen then it's not setVariable that's slow.
I was using the watch on the debug console
What exactly did it tell you?
And so your game really froze for 5 seconds?
Whya re you guys ignoring me?
You can't tell if strings and integers are by reference or value, because they themselves are immutable.
My guess is just error reading the debug console output or missinterpreting "measurements"
I got my cutscene camera to work, now how do I make it switch back to playable units?
What makes you say that, Dedmen?
I know it. That's why I say it.
_str1 = "test";
_str2 = _str1;
_str3 = _str1;
All 3 variables point to the same string
and _str1 = "test" doesn't allocate a new string in memory
When does the copy on write happen?
@stable quest https://community.bistudio.com/wiki/cameraEffect
How do you modify a string?
"test" + "test2"
creates a copy of the first test and then appends "test2"
Shit, nobody told me there is a terminate camera function. Shame is. The camera position is even wrong.
Lol
ARMA....
Nobody in the tutotials that is
everything that does some modification on a string.
select returns a substring if the parameters tell it to return a substring.
but "string" select [0] returns a reference of the original.
That's not copy on write though.
Copy on write is used to emulate value semantics with references.
Strings are copy on write in the engine.
That there isn't really a method to write into a string doesn't change that
@stable quest you can start and stop it with effectName
It is 60 frames per second, seconds lol
I got it figured out, and there are no errors.
Time to make more camera cutscenes and stuff.
This will be a long day. Need redbull.
Anyway, https://msssops.biz
If anyone wants to join the project and help me get my civil crisis simulator to a realistic level, I would greatly appreciate it.
Now to pack a .pbo lol
just so you know @stable quest that link looks fishy as hell
Why?
Its a dev site, and its mine. Self hosted.
Scan it, tehre is nothing harmful on it
If you can't mutate a string then it isn't possible to use copy on write. Any operation on a string, including operations on two strings, simply produce a new string.
just how its written and ends with biz
Thanks for being a paranoid critic π
I am a legit business man. I do not appreciate that.
wait
@tribal crane just passing a string somewhere passes it by reference though.
Calling a function that takes string. Or assigning a string to a variable
youre not using arma as business platform
Im using it to story board, then I am developing in UnrealEngine
Am in Full Sail UNI for Game Design and Dev
there may be clauses in Arma eula about business use
his is actual game footage from the project. Enjoy! Coming soon, more missions. More videos. More Tactical Military Simulation.
In this day and age, we have to consider the posibility that it may be time for an urban warfare trigger discipline tactical simulator.
Along with military mission and state of the art x64 Linux Cloud Systems. We plan to bring out the best from Unreal Engine.
@stable quest You are showing Arma footage and claim it's your Unreal engine game?
Dedmen: You can't know that without having the source code of the engine. Immutable strings can either be passed by value or by reference and unless your scripting language lets you introspect the storage details of the string you have no idea which is actually happening.
They said as long as I dont make money from it it is fine.
"Actual footage from the project"
@tribal crane Oh.. I remember you.. You are that Idiot from BIF right? From the Server fps unlock thread
Why are you wasting my time??!?! Lol
BIF?
One thing I will say to the person with function string issues is this. EVERYTHING CHANGED IN THE LAST 3 MONTHS, DOUBLE CHECK THE WIKI
@tribal crane If you want to test it yourself. Get Intercept. And find out that everything I'm saying is true
^^
No debug console or stdout is gonna save you...
is ded
One thing I love about ARMA is this, the developer community is hardcore and pushes me to my limits.
@still forum thanks for telling me to edit the text on my website, indirectly so, but you helped. Thanks.
π΅ push it to the limit π΅
Wait with calling it or modify the function
Cause it is instantly ending the mission without any sort of debrief
Call it after the cutscene.
Thankx
Trigger to trigger?
Hmm. This will be tricky. I; need to learn timer functions
Who made the song "Push it to the limit"
Is that rick ross?
Yep
There is also one in the scarface soundtrack
You can just use sleep or whatever
Damnit, Rick Ross ripped off scarface hardcore.
I hope he payed to have that sample cleared.
I don't think Rick Ross was the one to create the Scarface OST...
Anyone know of any free alteratives to InfiSTAR which does the same things?
BTW, Dev's before a bad ATV accident I was a Audio Engineer, if you need custom audio let me know. I still have all my gear.
Many servers are fine without infistar though
Actually scratch that idk that much about public servers
I host everything on linux so we dont need that.
Debian β€
One bit of advice, dont try to load multip[le mods in the same -mod=@modname
Dedmen: Wasn't me in that thread, I guess the corollary of what I said is that you can know if you do have the source. π
you have to do each one individually
I fail to see what infistar has to do with server os
Unless it now offers more than it used to
Im just saying, use debian php7 and mariadb instead of windows
But what does that have to do with infistar
Altis life, asylum is F***** because of that reason, they use windows SQL db's
Not much, ill shut up
just a little check
_unit = _this select 0;
_selection = _this select 1;
_damage = _this select 2;
if (_selection == "?") exitWith {};
_curDamage = damage _unit;
if (_selection != "") then {_curDamage = _unit getHit _selection};
_newDamage = _damage - _curDamage;
_damage - _newDamage * 0.89;
}];
this addEventHandler ["HandleDamage", {
_unit = _this select 0;
if ((damage _unit)> 0.50) then { [[_unit,"PRONE_INJURED", ASIS],BIS_fnc_ambientAnim ] remoteExec ["call"]};
if ((damage _unit)> 0.50) then {_unit setCaptive true};
}];
0 = this addEventHandler ["HandleHeal", {
_this spawn {
params ["_injured","_healer"];
_startDamage = damage _injured;
if (_startDamage > 0) then {
waitUntil {damage _injured != _startDamage};
if (damage _injured < 0.2) then {
_injured call BIS_fnc_ambientAnim__terminate remoteExec ["call"] AND _injured setCaptive false;
};
};
};
}];````
this script i made will work in MP?
test in SP seens to do just fine
_damage - _newDamage * 0.89; this line is useless
this is the amout of damage to reduce
you dont assign it to anything
the higher value = less damage
so why don't you set up an mp test eviroment @astral tendon
because i suck at set up a server
"PLAY IN MP" in the editor
other than that i see many remoteExecs which seems fine, but then you shouldnt add it on all clients either
that does not really work right
currently they get added at every client
but the AI will only ever be local to the server
even after the tut i gave you?
pack it as a pbo so you dont have to worry about it all
thats the least useful advice
yes and i still sucked
I gotta step off to code now
especially when is moded
well theres channels to get help with that too.
What is the new replacement for this exec "camera.sqs";
just code in sqf
I am but the game logic wont export the camera positions unless I use that .sqs
also if you guys are interested, that is a verry simple revive system to the AI inits
just trow that on the init
@tribal crane You just sounded exactly like this guy: https://forums.bistudio.com/forums/topic/210492-server-fps-limit-testing/?page=2&tab=comments#comment-3233682
"You cannot know anything if you don't have the source!"
It's like saying you don't know how to walk because you didn't read the source code of your brain and legs
My point was that with immutable values you can't tell if the VM implementation is using values or references.
You might happen to know, because you wrote the VM or have the source, but you can't write a script that would detect one or the other.
And since the person originally asking the question presumably doesn't care about hidden implementation details I mentioned the above.
you can't via script. correct.
But with Intercept you can read the memory adress of the values
So if you pass a string and the passed value has the same adress as the original.. and the refcount was incremented by 1. Then you know it was now copied
He asked "by reference or by copy" I answered the truth. And then you told me "No! You can't know that!"
Also Whale specifically asked about the hidden implementation detail. He asked what the engine does.
Ah, yeah, he asked about arrays. Those you can definitely tell.
_unit = _this select 0;
_selection = _this select 1;
_damage = _this select 2;
if (_selection == "?") exitWith {};
_curDamage = damage _unit;
if (_selection != "") then {_curDamage = _unit getHit _selection};
_newDamage = _damage - _curDamage;
_damage - _newDamage * 0.89;
}];
this addEventHandler ["HandleDamage", {
_unit = _this select 0;
if ((damage _unit)> 0.50) then { [[_unit,"PRONE_INJURED", ASIS],BIS_fnc_ambientAnim ] remoteExec ["call"]};
if ((damage _unit)> 0.50) then {_unit setCaptive true};
}];
0 = this addEventHandler ["HandleHeal", {
_this spawn {
params ["_injured","_healer"];
_startDamage = damage _injured;
if (_startDamage > 0) then {
waitUntil {damage _injured != _startDamage};
if (damage _injured < 0.2) then {
_injured call BIS_fnc_ambientAnim__terminate remoteExec ["call"] AND _injured setCaptive false;
};
};
};
}];```
one small problem i am having, the cachater still lost hes helmet
even though i put it ASIS
Could it be that you wanted to "ASIS" ?
As the wiki tells you. And the examples show you twice. That argument is a string
i need to set up a trigger to start only if there is about 4 units in it
what is the code for the condition?
count thisList >= 4
thanks
anyone knows what this error message is about?
21:44:49 Error position: <latSlipDrive 0.8[-0.1, -0.4])*(Speed 0.8>
21:44:49 Error Generic error in expression
21:44:49 Error: Sound volume expression: engineOn*(1-asphalt)*(1-camPos)*(latSlipDrive 0.8[-0.1, -0.4])*(Speed 0.8[2, 15])```
never seen it before and appeared at 3 different times now about 10 times each time.
Anyone knows how to get a custom texture to display on Land_Laptop_unfolded_F? I tried using the texture field in the editor, tried setObjectTextureGlobal, setObjectTexture, setObjectMaterial and setObjectMaterialGlobal.
i use this one for the board [board2,[0,"images\medic.jpg"]] remoteExec ["setObjectTexture", 0, true];
worked with remoteExec, thanks
@distant egret is this your work or someone else's?
in any case latSlipDrive 0.8[-0.1, -0.4] and Speed 0.8[2, 15] seem wrong
it's probably supposed to be latSlipDrive [0.8, -0.1, -0.4] and Speed [0.8, 2, 15]
I don't even know what's it from. A vehicle?
it's RHS
no clue if there's a fix though
you could probably maybe make a patch PBO
Yea
bit easier
wait the file is a patch I think as it inherits all that's needed.
just need to add CfgPatches
{if(_x in _deletelist) then {hint"You can't smuggle explosives on the bus... are you crazy?!";_bad = 1;};} forEach Items player;
Does Items still work as it didn't do what It was supposed to do. π
https://community.bistudio.com/wiki/items
Druid
Arma 3, version 0.70 - magazines, explosives, grenades and all items currently linked on the unit are not returned now.
I have a question: when closeDialog 0 is used, does it removes all displayEventHandlers of the opened display? or do I need to remove them myself?
When the dialog is closed then it is deleted.
You can't remove something from something that doesn't exist
so yes. They are removed
great; thanks.
I need some assistance on how to traverse config files correctly.
be more specific
Traverse the configfile for all weapons, backpacks, items attachments etc.
It's being fed to the virtual cargo box
configClasses Or I think even forEach might work
{
_configName = configName _x;
diag_log format ["_configName: %1",_configName];
} forEach [
(configFile >> "CfgWeapons"),
(configFile >> "CfgMagazines")
// ( configFile >> "CfgVehicles" ),
// ( configFile >> "CfgGlasses" )];
Does anyone know if it is currently possible to write extensions using .Net Core platform?
Doesn't work due to configFile not returning the right data.
@jovial nebula yes. See Arma Extensions wiki page.
@tough abyss You should forEach through the config.. Not through the array containing configs
This was someone elses original code
it's apart of liberation and is pretty broken
the guy who wrote it
used dense expressions for "" configClasses
It wasn't a simple expression as explicitly recommended on the wiki
It uses one big ass string to determine the "expression"
@still forum
Borderline scrapping this script
Another one that had to be canned
facepalm
That function looks like a programmer trying to be clever.
And failed terribly with readability.
I don't see a problem in that configClasses string
** The condition code passed to configClasses should only be used for simple filter expressions and nothing more**
yeah.. and?
I actually don't see why..
It works.. And I don't see any problem with that. No Idea why KK added that warning.
Doesn't work
_fnc_linkedItems = {
"
if ( isText( _x >> 'Item' ) ) then {
_virtualItems pushback _configName;
};
"configClasses _this; // (_x >> linkedItems) resolves to: bin\config.bin/CfgWeapons/srifle_DMR_01_ACO_F >> "linkedItems"; to nothing...
};
Bool bad conversion
if ( isText( _x >> 'Item' ) ) then { _virtualItems pushback _configName; }; doesn't return a true, does it?
Select the array with the command and then pushback from that srray
Original code was
"
if ( isText( _x >> 'Item' ) ) then {
[ _box, getText( _x >> 'Item' ), false ] call BIS_fnc_addVirtualItemCargo;
};
"configClasses _this;
Which is different from what you are doing
Doesnt it want a boolean return anyway?
yeap
just use
" isText( _x >> 'Item' )" configClasses _this;
example on the wiki _configs = "true" configClasses (configFile >> "CfgVehicles");
Thats not a boolean comparison though?
_fnc_linkedItems = {
"
_bool = if ( isText( _x >> 'Item' ) ) then {
_virtualItems pushback _configName;
};
"configClasses _this;
what is not a boolean comparison?
What
your code? right.
Does it?
Oh der...
Still would need to be assigned right?
yes it returns a bool
or just add as the return type at the bottom _bool
_fnc_linkedItems = {
_virtualItems append "isText( _x >> 'Item' )" configClasses _this;
};```
Also virtualItem is might be nil
Original code is doing this
Bad conversion: bool
Bad conversion: bool
Bad conversion: bool
Over and over.
yea because your code in " " doesn't return a bool, does it?
{
"
if ( getNumber( _x >> 'scope' ) isEqualTo 2 ) then {
_configName = configName _x;
_itemType = _configName call BIS_fnc_itemType;
if !( ( _itemType select 0 ) isEqualTo '' ) then {
switch ( _itemType select 0 ) do {
case 'Item' : {
_virtualItems pushback _configName;
};
case 'Weapon' : {
if !( ( _itemType select 1 ) isEqualTo 'VehicleWeapon' ) then {
if ( ( _configName call BIS_fnc_baseWeapon ) isEqualTo _configName ) then {
_virtualWeapons pushback _configName;
}else{
( _x >> 'LinkedItems' ) call _fnc_linkedItems;
};
};
};
case 'Magazine' : {
_virtualMagazines pushback _configName;
};
case 'Mine' : {
_virtualMagazines pushback _configName;
};
case 'Equipment' : {
if ( ( _itemType select 1 ) isEqualTo 'Backpack' ) then {
_virtualBackpacks pushback _configName;
}else{
_virtualItems pushback _configName;
};
};
};
};
};
"configClasses _x;
Thats what runs all the comparisons
This is basically a piece of code to initialize a ammobox
the code isn't mine it's owned by someone else.
yes but nothing of that returns a bool
which it needs to function
Oh man thats a wonderful abuse there
So what just stick a "true" at the bottom?
Is that BIS?
No.
// LARs_fnc_addAllVirtualCargo.sqf
// Original code by Larrow - https://forums.bistudio.com/profile/770615-larrow/
and can you confirm his code is even working?
Sort of.
But the dump to the log isn't pretty.
Man there isnt supposed to be much code in those strings
It does work
no, because it doesn't work
I just dumps Bool bad conversion
But it does work...
if it goes bad bool conversion I doubt the rest of the code works
hence the abuse.
The switch might return something
I am thinking this is a can and rebuild job.
I'm not seeing any returns in the switch :/
I know.
This is in Liberation
by the way KillahPotatos liberation
The switch itself might return the value of the matching case or something, refer to wiki
I am just going to bin this and re-write it.
isn't it way easier to just use the virtual arsenal?
This is apart of the code for that...
Want to see worse?
no
I've got a Liberation running, edited from where KP left off, and I haven't seen that bad bool conversion anywhere
The worst code is the Virtual Arsenal itself π
0 = ["AmmoboxInit",[this,true]] spawn BIS_fnc_arsenal; seems a lot easier than that waterfall of code
make a CBA Arsenal @still forum
No.. Someone is already working on ACE Arsenal
π
It's awesome so far. Filters so you can search for items. Buttons to clear your vest/backpack with a single click... and moar
but it's on ACE.. wish it was donated to CBA
@tough abyss This is for a realism group
So the ammoboxes MUST be filtered
I run it for a realism group too, and we just have people capable of not using overpowered weapons
and I have yet to find a weapon considered overpowered in the addons
so if that is your concern, just talk to your gents π
Real men uses loadouts
saves on the 30 minute dress up on the start of every play xD
Something someone posted on the BI forums
_pistolConfigs = "((configName (_x)) isKindof ['Pistol', configFile >> 'cfgWeapons']) && (getText (_x >> 'displayName') != '')" configClasses (configFile >> "cfgWeapons");
@indigo snow
Actually thats not too bad.
@still forum I've just discovered that .net core does not support Unmanaged exports, how can I deal with this?
@tough abyss That first configName is superfluous, as isKindOf accepts CONFIG and STRING type.
@jovial nebula Have a intermediary .net library that has unmanaged exports. and then calls into your .net core thingy
@little eagle
_pistolConfigs = "_x isKindof ['Pistol', configFile >> 'cfgWeapons'])
&& (getText (_x >> 'displayName') != '')" configClasses (configFile >> "cfgWeapons");
?
Oh understood, then no cross-platform at all
Missing space.
I really miss the syntax highlighting here, which is why I'd just go wit "true" configClasses ... select {...} π
Now to search an array without iteratively looping through them... too much
Uhm, rephrase that?
This config I need to build a full list of items
_virtualCargo = [_virtualWeapons, _virtualMagazines, _virtualItems, _virtualBackpacks];
An abuse of the condition checking I'm told
So that entire script needs re-writing
@little eagle
This page has been removed!
That big string would annoy me so much.
Extreme abuse of the configClasses
Ye, pointless too.
private keyword is a place to start^^
PrivatizeAllTheThings
_fnc_getConfigs = {
format ["getnumber (_%1 >> 'Rifle') isEqualTo 2 AND getnumber (_x >> 'scope')
isEqualTo 2",_x] configClasses(configFile >>"cfgWeapons");
forEach ["Pistol","Rifle"];
};
Bad?
Would that even work?
The syntax is completly incorrect and the format will also not work
not familiar with using select
Wiki
https://pastebin.com/1v6RiRxj There. Better.
I guess you can use something simple as filter for configClasses:
'getNumber (_x >> "scope") == 2' configClasses _config select {...}
and it stays readable while making the select code block a bit smaller.
Most common convention to interpret a float as boolean is > 0, right?!
kinda
= 1 ?
People bother with
= 0.5 ??
I like > 0 because of how symmetric it is. It's like you slice the number line in two exact halves, while keeping 0 = false.
{
_configName = configName _x;
_getClasses = 'getNumber (_x >> "scope") == 2' configClasses _x;
_getWeapons = _getClasses select {_x == 'displayName'}
diag_log format ["_getClasses: %1",_getClasses select {_x == 'displayName'}];
} forEach [
(configFile >> "CfgWeapons"),
(configFile >> "CfgMagazines")];
?
a config class will never equal a string
Anyone know what script i can use to teleport someone to me?
And?
What's wrong with that? besides that load of crap(spawn compileFinal preprocessFileLineNumbers) instead of execVM
Thats spawn compileFinal I was referring to
Does it make any difference?
vs execVM?
How do you learn how the traverse config files?
Read wiki + logical thinking
Your script code is throwing type number expected bool
those are choices for scripter to waste time fretting about
True. Fortunately this channel is named #arma3_scripting.
@tough abyss If you're doing a virtual ammo box type thing you might want to time your configClasses calls to make sure they aren't locking up the game for too long. If they are you can walk through configs the old fashioned (CONFIG select ...) way.
Still wonder whats the source of this Bad conversion: bool
Just do
"1" configClasses configFile
"Code block" (string) reports something that is not a boolean.
Bad conversion happens when engine get's a value of different type and calls the getType method.
If it is not convertible a default value will be returned and Bad conversion will be logged.
So if you call getBool on a Number... ERROR.
Although they could've just builtin that numbers automatically convert but... Β―_(γ)_/Β―
Bingo found whats causing it
As in this case.. We don't actually care about what value configClasses is using.. One can just ignore that error
if ( ( _configName call BIS_fnc_baseWeapon ) isEqualTo _configName ) then {
I don't see it
"_itemType = [""Weapon"",""MissileLauncher""]"
"BIS_fnc_baseWeapon result: true"
"_itemType = [""Weapon"",""SniperRifle""]"
"BIS_fnc_baseWeapon result: true"
"_itemType = [""Weapon"",""SniperRifle""]"
then
"_itemType = [""Weapon"",""SniperRifle""]"
Bad conversion: bool
Why .. I don't see how that is connected to the code you posted
"BIS_fnc_baseWeapon result: true"
"_itemType = [""Weapon"",""SniperRifle""]"
"BIS_fnc_baseWeapon value: srifle_DMR_01_F"
"BIS_fnc_baseWeapon result: true"
"_itemType = [""Weapon"",""SniperRifle""]"
"_itemType = [""Weapon"",""SniperRifle""]"
Bad conversion: bool
"_itemType = [""Weapon"",""SniperRifle""]"
Bad conversion: bool
It is
this section
case "Weapon" : {
if !( ( _itemType select 1 ) isEqualTo "VehicleWeapon" ) then {
if ( ( _configName call BIS_fnc_baseWeapon ) isEqualTo _configName ) then {
diag_log format ["BIS_fnc_baseWeapon value: %1", _configName call BIS_fnc_baseWeapon];
diag_log format ["BIS_fnc_baseWeapon result: %1",(_configName call BIS_fnc_baseWeapon) isEqualTo _configName];
_virtualWeapons pushback _configName;
} else {
( _x >> "LinkedItems" ) call _fnc_linkedItems;
};
};
};
Is causing it
somehow BIS_fnc_baseWeapon fails
after a specific rifle
every time.
Is that code inside configClasses or in select? Did you add a false to the end?
Yeah there is a false at the end
Come back when you have a simple repro.
in dentation?
Why did the other _itemType -> Weapon's
not log the BIS_fnc_baseWeapon diag_log?
I guess because baseWeapon?
what is inside _fnc_linkedItems
_fnc_linkedItems = {
"
if ( isText( _x >> 'Item' ) ) then {
_virtualItems pushback _configName;
};
" configClasses _this; // (_x >> linkedItems) resolves to: bin\config.bin/CfgWeapons/srifle_DMR_01_ACO_F >> "linkedItems"; to nothing...
};
DUDE
It's not that causing it
RLY?`
Why?
What if it is?
You just learned that the configClasses code needs to return a bool
you don't return a bool. But you are still ABSOLUTLY sure that it's not the issue.
You know you are doing something wrong.. But doing something wrong can't be what causes the errors right?
sure not
DUDE
I can give it a bool and see what happens.
Are you stupid?!
This is a mess. Sometimes it's best to just start over.
You have an error. You know what's wrong.. But you ignore it and search the problem elsewhere? wtf?
"isText (_x >> 'Item')" configClasses _this
isText returns a bool?
I guess
@halcyon crypt I told him that about 2 hours ago already
I do something similar here and I think it's pretty:
https://github.com/acemod/ACE3/blob/master/addons/inventory/XEH_postInit.sqf#L11-L32
well that's the entire point of the is in the command ^^
isX always returns a bool unless someone was being a major idiot
@tough abyss "is this a cookie?" "15!"
?
Just imagine if it would not be a bool. You'd just be like "wtf? that's dumb"
If you ask if something IS something.. You get a yes/no back
The documentation about anything on the wiki is vague.
Someone said isText returns a bool.
what?! Return Value: Boolean
So I thought that wasn't a problem.
https://community.bistudio.com/wiki/isText
Return Value: Boolean dude?!
lol
And I already told you 2 hours ago that that part of code is wrong and how it would be correct
isText BOOLEAN
getText STRING
btw, this command should've been named getString
TEXT != STRING
isText MAYBE
true. But non-programmers would be confused what a string is ^^ I guess. Text is clearly text though
getText [config, default, ignoreInheritance]
^ When do we get this?
There is 0 documentation on how to traverse the configFile structure.
@little eagle #Intercept?
ffs stop self-prompting.
What doc do you need? configClasses reports an array of all non-inherited config classes of a main config class.
/ and >> are the same thing
[config / config ] or whatever.
and that's incorrect.
config/config is just how a CONFIG is visually represented.
Normal SQF list -->
array = [item1,item2];
configList = [config / \ config /\ etc
];
configClasses returns an array of CONFIG.
CONFIG's are no string.
lol
So if you convert them into strings you ofcause get a string representation of that. Which is not the same
It's the same as when you stringify objects
Yeah yeah I know.
Probably tired to go with it.
isText I can see your point now.
Codes still a mess.
I don't like it.
Start over.
But still you insist on editing it instead of starting over like you were told to over 2 hours ago
Ctrl + A, backspace
How can I tell if a config is of a specific weapon type
without feeding it to BIS_fnc_itemType ?
manually doing what BIS_fnc_itemType does
BIS_fnc_itemType is good though.
Okay thats part of the new specification.
That's what the editor uses, so it's official and covers all the edge cases.
private _virtualCargo = [];
private _virtualWeapons = [];
private _virtualMagazines = [];
private _virtualItems = [];
private _virtualBackpacks = [];
or ```SQF
private [array];
first one
compiletime vs runtime
It's prettier and it's easier to handle. the keyword that is.
so yeah.. performance difference at runtime is infinite%
using private keyword is infinite% faster than private ARRAY
Is that even correct?
Isn't that just 100% ?
No, you're saying it's not possible to measure
so 100% faster would be the right thing to say then?
If A takes 1 and B takes 0, then B is infinitely times faster than A and you save 100% of A's time.
okey.. "infinite times faster" sounds better. That was what I wanted to go for
That sounds like "WOAH! I will use that everywhere then!"
Need to find something like that for params
I guess the only negative about the keyword has having to write it down more than once. But it makes the code easier to read, because you immediately see where the variables are first declared, especially with a proper syntax highlighting tool.
Hi there sir, my code is infinitely faster than yours, goodday
And scopes are the biggest headache of SQF imo. This helps a lot.
guys, are there any good practices articles on SQF? a friend asked, wanted to get into A3 scripting a bit. been working with langs like Ruby (RoR and shit) and Erlang. thx, fellas.
There are a few of them
i got him prepared for the clusterfuck of SQF already, no worries.
@tough abyss Very different
@icy raft you mean by just skimming through their code and noticing the patterns??
do they have any articles published on their code structure and the reasons behind it for a large project?
@timber ridge LOL no, I mean, they have a doc for they contributors: https://ace3mod.com/wiki/development/coding-guidelines.html
But it's relative, I myself have a few issues with some details of it, so it's more of personal preference
whoa, that's a nice one, thx. it'd be great if this channel supported attachments for stuff like that...
@tough abyss read wiki. Two different functions doing two different things. In your case you really only need forEach.. Or count (For that one see code performance guide on wiki)
What is the difference between select and forEach ?
- one is CODE command ARRAY, the other is ARRAY command CODE
- one expects a boolean return value, the other doesn't
- one reports an array, the other the last return value of the code block
- one has _forEachIndex, the other doesn't
That's all I can think of.
so select is hacky version of forEach really?
No
count is hacky version of foreach
They serve different purposes
They're not really that different. They're pretty similar and related in my opinion. Their usage is different though.
select is a way to filter an array and return a new array with the results that passed
Or to select an element
@tough abyss if you ever touched Javascript, imagine select being like Array.proto.filter or Array.proto.find in JS.
πΊ
that's the way I understand it.
select an element > filter out the rest when weβre talking about the CODE variant
Or, its original usage, array[x]
Well, select NUMBER/BOOL is a totally different command from select CODE
thatβs array select number not code
He asked What is the difference between select and forEach ?
They just share a name.
True, select CODE assumed. The others are really different.
( "getNumber( _x >> 'scope' ) isEqualTo 2" configClasses _x) select {
false;
};
} forEach [
( configFile >> "CfgWeapons" ),
( configFile >> "CfgMagazines" ),
( configFile >> "CfgVehicles" ),
( configFile >> "CfgGlasses" )
];
That's pointless.
That code is useless
π€
no it's not
select false π
Where did I post that?
select {false} will always return an empty array
Have you started over already?
Dedmen
https://pastebin.com/1v6RiRxj There. Better.
I just... wtf?
( "getNumber( _x >> 'scope' ) isEqualTo 2" configClasses _x) select {
Thats a piece of your code.
"fixed"
yes
Thats what I said..
He said config classes needs to return a bool, not the select
guys, can you take this to a more personal level than here?? maybe PMs?
Which you seem to have added
no select with an expression has to return a bool.
I don't even know what this code is trying to do anymore.
or nil
You put one line of my code into your otherwise completly different code.. And said it was my code?
this entire chat is now flooded over some stupid discussions about 50 lines of code....
no select with an expression has to return a bool.
Naturally, but that was not what he said
Look at my code again @tough abyss
You just learned that the configClasses code needs to return a bool
I literally just moved the code from the string on configClasses into the CODE of select
@little eagle maybe we need a new channel, like #arma3_scriptingDebates?
Popcorn time and I cannot sit straight for an hour
This IS the debates channel.
lol ^^
@timber ridge #PopcornTime would be the name
Why can't I just get a straight answer.
And fixed the other error that you didn't want to fix although being told to several times
thereβs really no better way to explain ARRAY select CODE. the code part has to return true or false. the elements where it returns true will be in the result, the rest will not
ego select {false};
this makes communication much easier π
You have to ask a question to get a answer
Why can't I just get a straight answer.
What question?!
@timber ridge Read the channel description, it says, 'don't chat about script'
The description of this channel uses == true. It can be discarded.
π π π
Exactly 'don't chat about script' π
I post his code back to him, ugh... all I said was how select behaved in comparison to forEach thats it. Then @still forum just has to argue about whats true or false. ffs.
what @tough abyss is trying to say, is, in short, "fuk ur code, i'm doing it my way"
Actually it would be a script error so this channel is error by default
@tough abyss You posted a pointless piece of code that contained one line of my code.
That's not the same as posting my code
Only macros can save us
#define true 1
#define true (random 2 > 1)
π° you killed true !
#define 0 1
#include <stdbool.h>
@still forum I get the feeling you don't work in Software Development. No offense.
ok
ew
That's a compliment?!
how is taht even related ?
@cunning nebula it is called popcorn timr
He can't work in software development obviously, he's ded, dead people can't work
SDLC. Thats all I have to say.
@tough abyss Now.. If you have a question. Ask it.
Stop ignoring answers.
If you want help with your code. Stop ignoring advice and instructions on how to fix it
Accept the rules and wait for auto-summoning
#vote admin Inlesco
Careful, we'll start talking about how everyone who smokes weed is a degenerate
I heard weed is healthy
Donald would not agree
Duck?
^this
Duck aka US pres