#arma3_scripting
1 messages · Page 463 of 1
the function is being called with the onLoad from the actual dialog that contains all the controls
change the empty array in onload to _this and then use _this select 0 which is the display?
also why not set the controls to fade=1; in the dialog itself then they load hidden and you only have to unfade them?
or fade=0; it goes the opposite way to the script command
onLoad = "[_this] call life_fnc_startupIdcHideAndShow;"```
onload = "_this call...
my bad
onLoad = "_this call life_fnc_startupIdcHideAndShow;"```
yes. and then in the script _display = _this select 0;
Oh so I can set the attribute of each button as a fade = 0
yes.
okay thanks for that, Ill give it a go
👍
sweet, i finaly found it https://community.bistudio.com/wiki/BIS_fnc_showAANArticle
hello, is there a way to hide a button in a dialog by default ?
@compact maple buttonControl ctrlShow false;
or show=0; in the dialog config.
Thanks, show is the attribute i was looking for. Because if i want a button to slowly appear, i have to use a func, but the func is executed after the display shown, so its crappy
guys, it's possible to override a CfgRoles ?
ahh, sorry didn't know that there is a channel for that 😄
Config https://imgur.com/gallery/qZSSlVA (config editing)
heya, how would i write an if statement with 2 inputs e.g.
then{
"WC1CR" addWeaponCargo ["M16",5];
}else{
"You need to set a base down before you can purchase this teritory";
}```
what code do i need in description.ext to have a lobby parameter that allows or disables revive
on the choice of the host?
It's the last script i need, but i can't find anything about that one
@broken forge exactly like you did. Maybe add more parenthesis
kk
ah, bugger
i didnt put hint after the else
that's why 😄
nvm, still doesn't work
ty
that's what i'v been trying
And...?
is it possible somehow to enable Post process effects below water (or in other words, delete the blueness..)
i was thinking about something simple like class Params
" #include "\a3\Functions_F\Params\revive.hpp"
i mean
want to make a submarine interior
respawn.hpp
but i'm not sure
if there is a hpp like that
for revives there is paramRevive, so i'm sure something similar must be out there
oh wait
Having an issue, Button Controls will not disable, despite being clearly told to. which is problematic because when I ctrlShow a new interface, the buttons from the previous interface can still be pressed if the position in which they were located beforehand is clicked.
_display = findDisplay 16999;
//background buttons
_keychainButton = _display displayCtrl 17015;
_messagesButton = _display displayCtrl 17016;
_gangButton = _display displayCtrl 17018;
_playerInventoryButton = _display displayCtrl 17019;
_licensesButton = _display displayCtrl 17020;
_adminButton = _display displayCtrl 17024;
_syncButton = _display displayCtrl 17017;
_marketButton = _display displayCtrl 17021;
_paypalButton = _display displayCtrl 17022;
_settingsButton = _display displayCtrl 17023;
//hide buttons from previous interface
{
ctrlEnable [_x, false];
} forEach [_keychainButton,_messagesButton,_syncButton,_gangButton,_playerInventoryButton,_licensesButton,_marketButton,_paypalButton,_settingsButton,_adminButton];```
You have a syntax error there
CONTROL is not a number.
@tough abyss only works for scripted revive. https://community.bistudio.com/wiki/Description.ext#params
well i'm using the A3 wounding system script.
so for example, to hide the keychain button it would besqf ctrlEnable [17015, false]
with a ;
oops
_keychainButton ctrlEnable false;```
Ahh I'm not quite following man
I just replace them with the idd's?
ahh gotcha, made it work
cheers
Dedmen so i could include the a3 wounding system sqf in the description. ext and create a line for it to either enable or disable it?
don't think so
you can retrieve the setting from the parameter via script. And then you have to check the setting before you enable the wounding system
I forgot to ask, to fade buttons in, it is the same rule in which idc's must be used right?
Why are you so stuck on trying to use IDC's everywhere?
Man I honestly don't know. I was literally fine with them and then just hit a plateu of retardness, and now I can't interpret anything
I'm tempted to restart all my functions from scratch because they are just incoherent at this stage..
Don't use IDCs when you don't have to. It's easier to work with controls directly. Just my opinion.
I would not restart. Make it work first, then fine tune it.
Lately im not even using controls idcs anymore, just setting -1 by default. I turn to using idcs when its some RscEdit which is widely used in a interface functions, just to make it easier.
How do you hide/show your selected interfaces?
What is selected interfaces?
If you are talking about ctrlShow or ctrlSetFade its all about controls of a display. Interface is a final instance of display/dialog along with all controls in it.
Like how would you show a specific control, if you don't know it's idd
_someCtrl ctrlShow (true|false);
or
_someCtrl ctrlSetFade (0..1);
ctrlSetFade will require ctrlCommit
and you would define _someCtrl to be linked with a specific idc?
Well
private _someCtrl = _someDisplay ctrlCreate ['RscText',-1,_someCtrlGroup];
_someCtrl ctrlShow false;
Doesn't use IDC exactly.
I'm honestly not advanced enough to grasp that way of doing it, I started this like a week ago
I'll look into ctrlCreate
any idea, if this is still a thing? https://community.bistudio.com/wiki/buildingExit
Like... why doesn't this work... sqf { ctrlShow [_x, false]; } forEach [17000,17013,17036,17062,17061,17060,17059,17058,17057,17056,17055,17054,17053,17052,17050];
because it is looking on some other display
What do you mean?
so if I want to hide those idc's, what do I type
alright one sec
exactly like you did before with ctrlEnable
What is the syntax for getting the controls into a variable?
You've literally done that 2 hours ago...
how can i add system date(Real Date) in ingame ?
Just gonna call it a night, thanks for your help boiz, will try to figure out this mess tomorrow aha xd night
then{
"WC1CR" addItemCargoGlobal ["rhs_weapon_ak103", 1];
}else{}```
it's saying line 3 has a problem
well, technically…
^ 👀
Hey guys i have a weird problem I have the following UI element :
class RscExileXM8ListBox: RscListbox
{
type = 5;
style = 16;
colorBackground[] = {0,0,0,0.3};
colorText[] = {1,1,1,1};
font = "RobotoCondensed";
sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
text = "";
rowHeight = 0;
colorDisabled[] = {1,1,1,0.25};
colorSelect[] = {0,0,0,1};
soundSelect[] = {"\A3\ui_f\data\sound\RscListbox\soundSelect",0.09,1};
class ListScrollBar
{
color[] = {1,1,1,1};
autoScrollEnabled = 1;
};
maxHistoryDelay = 1;
};
When i add list items with pictures all the pictures are black instead of the actual color they are and my scrollbars are white and look broken. Do you have any ideas?
then{
"WC1CR" addItemCargoGlobal ["rhs_weapon_ak103", 1];
}else{}``` , yeah, i still don't get this
i tried Crate = "WC1CR"
Hi there guys, got a question about getVariable for first time players connecting to the server, if someone is free @ me
and then replaced it with the "WC1CR" before the additemcargoglobal
A variable called Crate that contains a string is still a string and not an object.
You have to pass the object you want to add the item to
not a string
so a string would be :
crate = "[crate name]" createVehicle position player
crate addItemCargoGlobal ["rhs_weapon_ak103", 1];```
?
yeah. for example
object into string.. or string into object?
object into string
str _object returns a string representation of that object
str can be used to turn almost anything into a string
I was using this code here
class Extended_DisplayLoad_EventHandlers {
class RscCustomInfoMiniMap {
synixe_nogps = "params ['_display']; { if (isNull objectParent ACE_player) then { _x ctrlShow false; } } forEach allControls _display;";
};
};
to prevent the GPS minimap from being used. I have just noticed today that it is no longer working, and the GPS can be opened again. Anyone know what has changed that would cause it to no longer work?
Question: Is it possible to get the view LOD of a vehicle? (Vehicle interior LOD)
What do you mean by "get"?
For example, I'd like to hide the view LOD for the client
"Get" as in store it in a variable or whatever. Is this possible or is it only done via config?
Scripting wise.
you cannot store a LOD in a variable
the clostest you can get to that is the OBJECT type
which is a whole object
You can't hide a lod generally
if you are lucky all the hiddenSelections for that lod are available in config and you can remove the textures. But I've never seen anyone do that
Yeah, a lot of these vehicles seem to let you hide everything EXCEPT for the interior.
Oh well. Not a big deal, just messing around with it.
Can someone help me apply texture to a class script I have? Here is the script: https://pastebin.com/ueLQ8pqL
@still forum can you help?
Someone please?
@violet gull I want to know the purpose of that actions.
It is for magical reasons. 
will sqf ctrlShow [_x, false]; just hide them, or hide them and disable them
it just hides it but if its hidden you cant click it so you could say its disabled i guess.
I see, thanks :3
Is it possible to remoteexec an execvm "scriptpath/script.sqf"; ?
Right so in the gui editor I press ctrl+s to export the code. That works great. Now when I close the game, and reopen it again, how can I load my gui that I was making? I don't quite understand. I'm using export classes as names if that matters...
try this > ctrl+i > missionConfigFIle >> "yourDialogName"
my dialog name?
oh im not using any missionconfig file, im bulding a gui for a mod im trying to make
[[<param>],"scriptpath/script.sqf"] remoteExec ["execVM"];
```@tough abyss
im bulding a gui for a mod
missionConfigFIle>configFile@icy light
Im a n00b. Im launching the game > editor > random map i pick > drop player > press esc > gui ediotor
do you have config for your dialog ?
no
well it adds a tablet to the game similar to an ipod.
im exporting the code, and putting it into that already written code as an addition
if that makes sense
essentially it's an "app" for the tablet they add to the game
you export classes as names, copy, paste
oh hell lol
someDialogName < that is the name
perhaps i can ask another way... whats the easiest way from scratch to create a gui, and be able to open it again after restarting arma?
i tried to copy what it exported and press ctrl + o... that did nothing lol
we have 2 options: config or dialogs/ui created with ctrlCreate... if second, that is just script and you can paste it into the console
for the first one, you will have to import it, to edit things
check this http://www.armaholic.com/page.php?id=33123
Is this missionNamespace global?
I had some weird behavior from a script today that was tested in SP and with only 2 MP players, acted really weird on a mission today with 18 players.
_message = _message + "<img image='https://i.imgur.com/1gP5rnQ.jpg' width='553' height='730'/>";
When i load up the server it says picture not found
Any ideas or edits i can make to the code for it to work?
unless i remove the width and height since its added in the picture already ?
For example <img image='https://i.imgur.com/1gP5rnQ.jpg'/>
you cant load external images like that
htmlLoad might work with ctrls for that kind of effect
but make sure it's allowed on the server
no it doesnt download images... if it did more people would do it.
@pine leaf this is what you have to work with https://community.bistudio.com/wiki/Structured_Text
or jpg. it just must be contained inside your mission or mod. in your case i imagine its a mission
it goes wherever you like
make sure you read that link, arma doesnt do html like ur expecting it to.
yeah i understand
@tough abyss No. I can't help with your 700 line crap script while my computer is turned off and I'm trying to sleep. And I personally also don't like people that just keep pushing as if their life depends on that script working.
Hi there guys, got a question about getVariable for first time players connecting to the server, if someone is free @ me
I asked last night and just now @still forum . I presumed it got buried. Hardly spam.
Its not like i'm asking every hour in various channels
Yeah. I read it last night. And I also back then thought no one will answer. And no one did. as expected
Now I'm curious what the question was.
Punny
Basically, when a player first connects, they need to run a welcome-esque script before being assigned a variable for them to skip this for future connects. So I have it working if you assign the variable to profileNamespace, obviously, but then comparing it to something that isn't there means it doesn't work. I understand this, it makes sense.
However how am I supposed to detect if a player has has a variable there or not? (I'm probably missing something here).
profilenamespace getvariable "var"
is it not as straight forward as that?
It just refuses to work within something like an IF or Switch_Do
it to something that isn't there means it doesn't work you mean comparing to nil?
Commands silently error and are skipped if you use nil
How do I insert code again?
How to check if he has the variable? isNil {profilenamespace getvariable "var"} -> doesn't have it
no no how do insert code into discord
```
```
cheers
```sqf
```
switch (profileNamespace getVariable "ReturningPlayer") do {
case true: {
0 = execVM "Scripts\ZeusIntroReturn.sqf";
};
case false: {
0 = execVM "Scripts\ZeusIntroNew.sqf";
profileNamespace setVariable ["ReturningPlayer",true];
saveProfileNamespace;
};
case nil: {
scopeName "Failsafe";
0 = execVM "Scripts\ZeusIntroNew.sqf";
profileNamespace setVariable ["ReturningPlayer",true];
saveProfileNamespace;
};
default {breakTo "Failsafe"; hint "Breaking to failsafe";};
};
so where the condition is, I can work it around to work with isNil?
yes.
Right
nil won't work because the case will just be ignored
thought as much
or you could just use a default value of false
but just ekpt it there just in case
See how easy it is when you actually ask a question instead of asking if you could ask? You are just wasting your own time by not actually asking the question you want to ask
Sometimes people just give sarcastic remarks, so I just went to DMs, worked once or twice however
I just wanted a quick answer, not some lecture on it all
😛
not saying thats you, just re-read that
sounds bad
digs hole deeper
ty!
Just saying.. We could've solved that yesterday in a couple minutes.
Yeah I see that now haha
If I were in charge of a script language, nil would work like you assumed it would.
That breakTo will not work btw.
And a global variable without OFPEC tag is a terrible idea, and especially terrible in the profile namespace.
First time I use that one
Just ignore breakTo etc. existing. They're not needed, and only make bad looking code 99%* of the time (*always).
Not everything that exists has a use.
Oh, I see
The 0 = should be deleted as well. Just pointless overhead.
whistle
xD
idk
if (profileNamespace getVariable ["commy_hasSeenIntro", false]) then {
execVM "Scripts\ZeusIntroReturn.sqf";
} else {
execVM "Scripts\ZeusIntroNew.sqf";
profileNamespace setVariable ["commy_hasSeenIntro", true];
};
This is how I would write this.
Or maybe:
with profileNamespace do {
if (isNil "commy_hasSeenIntro") then {
execVM "Scripts\ZeusIntroNew.sqf";
commy_hasSeenIntro = true;
} else {
execVM "Scripts\ZeusIntroReturn.sqf";
};
};
If you want to be fancy.
Thank you commy 😃
i didn't know about with 😮
when used in a do-construct in scripts with allowed suspension, an unexpected namespace switch could happen (see note below)
Another nice feature of the scheduler.
"feature"
just means namespaces are not saved permanent
in scheduler scopes
which is literally a bug
Ask Dedmen, they are. But not read properly.
obligatory "how to i use sleep otherwise?"
Don't.
event handlers
eh somethings are just way easier to do with triggers and scheduled scripts
if you want to end the mission 30 mins in, i don't see how you'd do that with an EH
or other such timed events
I think #arma3_scripting is the best place for this
I am trying to change the onUnload of the Insert Marker display.
With ACE and CBA loaded, the original is _this call ace_markers_fnc_placeMarker. I am trying to change it to _this call synixe_maps_fnc_placeMarker but the ACE script is still being executed.
The changes I made to onLoad are working just fine.
https://cdn.discordapp.com/attachments/403164505477218307/452434098267357194/thing.PNG
SuicideKing, if mission is nice, why you have to end it ? just keep playing... /s
@fringe yoke requiredAddons
@fringe yoke Did you check the master config via config viewer? If your addon is loaded before ace_markers, your addon overwrites vanilla and ACE overwrites yours.
I have checked master config, image attached
requiredAddons[] = {"ace_common", "ace_markers", "synixe_main", "synixe_common"};
If the master config no longer says onUnload = "_this call ace_markers_fnc_placeMarker;", then that function will not be exeucted.
It applies the marker rotation, which I am fairly sure is in the ACE code
My code is just
#include "script_component.hpp"
disableserialization;
params ["_display", "_closeNum"];
systemChat "synixe place marker";
and I don't get a systemchat message. It's got me quite confused
Did you restart the game?
Can you copy paste the master config?
For the addon? or something else
The master config is the config generated by the game on game boot.
Like an all in one config?
Yes.
Sure
onUnload = "_this call synixe_maps_fnc_placeMarker;"; is what the config has under RscDisplayInsertMarker
RIM7LB disableAI "AUTOTARGET"; RIM7LB disableAI "TARGET"; RIM7LB setCombatMode "BLUE";
RIM7RF disableAI "AUTOTARGET"; RIM7RF disableAI "TARGET"; RIM7RF setCombatMode "BLUE";
PhalanxRF disableAI "AUTOTARGET"; PhalanxRF disableAI "TARGET"; PhalanxRF setCombatMode "BLUE";
PhalanxLM disableAI "AUTOTARGET"; PhalanxLM disableAI "TARGET"; PhalanxLM setCombatMode "BLUE";
PhalanxCB disableAI "AUTOTARGET"; PhalanxCB disableAI "TARGET"; PhalanxCB setCombatMode "BLUE";
RIM116LF disableAI "AUTOTARGET"; RIM116LF disableAI "TARGET"; RIM116LF setCombatMode "BLUE";
RIM116RB disableAI "AUTOTARGET"; RIM116RB disableAI "TARGET"; RIM116RB setCombatMode "BLUE"; ``` So I tried to disable the CIWS on the USS Freedom so they don't shoot. That's not working. Is there any specialty for this? I mean it seems to be no normal UAV AI as you can't control it via UAV terminal
https://github.com/acemod/ACE3/blob/master/addons/markers/functions/fnc_placeMarker.sqf
Apparently placeMarker executes the setMarkerNetwork event.
So maybe this only synchs the angle etc. to everyone else, and with this disabled, it still sets the marker as expected for yourself.
I know this was written by me, but it has been 3 years... :(
With nothing in onUnload it will still create a marker
Yep, the placeMarker event only adjusts the addtional parameters of the marker.
The creation itself is still by the base game.
What's the goal here?
Unique maps, it was working fine using EHs, I was hoping this would be a more elegant solution
"Unique maps"?
Same in practice as https://github.com/acemod/ACE3/pull/3601 but different implementation
Mainly support for objects as maps, so a laptop could have a map attached to it for players to view to see locations
Honestly, I would just use a draw eventhandler doing icons and not use ingame markers.
@hollow lantern Just remove their ammo, or kill the drone AIs.
That is how I am drawing them, the issue is grabbing the info from the marker they place in the map. It also needs to support markers from the editor and from briefing. I was using the CBA marker events, but they don't tell you who created a marker, just the marker name.
and get executed globally which was causing too many issues
I think the marker name has the client id of the client machine in it's name.
It does yeah, I was just hoping this onUnload would be a more elegant, performance friendly way to solve both issues at once
no luck so far
["ace_markers_setMarkerNetwork", {
params ["_marker", "_data"];
_data params ["_markerClassname", "_colorClassname", "_pos", "_dir"];
}] call CBA_fnc_addEventHandler;
You can grab the additional info like this, iff you don't have the onUnload event disabled of course.
But this also will trigger for remote markers.
Should be a simple enough check though to just ignore markers placed by different CBA_clientId's.
@little eagle I just did it with sqf <CIWS> setCombatMode "BLUE"; and that works flawless
cool
I have the code : onMouseButtonDown = "_sTxt = lbText[1500, lbCurSel 1500]; hint _sTxt;"; And it works, but I have to click twice. Im assuming that its because its firing hint before allowing the return of lbText. Is there a fix for this?
Maybe the selection switches after the MBD event.
Thats how it appears
This is why you should use the lbSelChanged event instead.
That wouldn't do anything.
yw
what's the best solution to stop a group from moving around (formations I guess) without disableAI ?
Uhm, attach them to a dummy object?
@little eagle do you have any experience with extDB2?
wasn't there a parachute paradrop in the APEX campaign? How was that done?
@icy light I wouldn’t recommend using extDB2, it has a quite serious security flaw. Anyone can drop all your tables whilst in-game if they know how.
That's not extDB's fault. That's your fault of missconfigured user permissions for the database user
Hey hey hey, don’t shoot the messenger. It’s not really misconfigured user permissions since depending on the framework you’re using, you might require the drop permission.
Stored procedures all the way. And no rights other than executing these.
If the framework you are using is dumb. Then choose a different Framework. But that's not extDB's fault
Blame Koil with his messy Nopixel framework, yucky.
@storm crow well im making a mod for exile, which uses extdb2.. what should I use?
@icy light Personally, I would recommend extDB3 for better security and performance.
Well, IF i decide to go that route, is there any documentation on it? Like how to do a simple query?
Right now Im having to pick through existing code and reverse engineer the calls, its a pain
plus i reckon i will likely have to make it compatible with both so server hosts can use it
@icy light Try this Wiki page for documentation on extDB3 https://bitbucket.org/torndeco/extdb3/wiki/Contents
awesome ty!
Not a problemo
BIS_fnc_holdActionAdd possible to change the button , cant seem to find it anywhere ?
the button to hold? copy the script into ur mission/mod and define the button you want
yup was just thinking that xD
will probably put something in so i can just pass the dik code through with the function.
there is also BIS_fnc_keyHold afaik with just display EH KeyDown
Please don't ping me if you have a question that has nothing to do with me, thanks.
^ can be read as "ping me"
I answer if I know the answer, or know a way to get it.
so about SQF it self, is BI the only place where its used? or is SQF used in other places? What im getting at is, I was looking at pastebin and noticed that they had a SQF syntax highlighter and I was thiknig that it means that SQF is used outside of BI stuff, so I guess my question is, what else besides BI stuff uses SQF
It is used in VBS too, which is made by BI Simulations, which is a different company. Otherwise no.
what does SQF stand for? I prob should have asked this question like 4 months ago when I started scripting XD
I was looking at pastebin and noticed that they had a SQF syntax highlighter and I was thiknig that it means that SQF is used outside of BI stuff
No, that's just because KoffeinFlummi and I made the pull requests at the appropriate places a few years ago based on JonBons' syntax highlighting for Sublime Text.
what does SQF stand for
Status Quo Function, based on the older SQS - Status Quo Script, which uses a different syntax, but the same set of commands.
Point of SQF is, that you have functions with return values, instead of everything being a pseudo thread.
I want to check if a specific player is at a specific coordinate, and then if the condition is true, the rest of the function will start
private _posDefendant = [3638.17,13386.7,3.76691];
private _defendant = player getPos _posDefendant;
//bunch of checks
if (isNull _posDefendant) exitWith {["There is no defendant active in stand."] call life_fnc_notification_system};
if (playerSide != civilian) exitWith {["You are not a judge."] call life_fnc_notification_system};```
oh I see
or would sqf if (_defendant position != _posDefendant) exitWith {["There is no defendant active in stand."] call life_fnc_notification_system}; be correct?
It's very unlikely that the position of the player is exactly the same as _posDefendant.
Well in my script, the player will be teleport to the exact position, and their input will be disabled, so they can't move
Well I forgot to mention actually, that this function above is for a judge menu dialog, that has a 'monetary fine' button, and will spawn the give ticket dialog that will only apply to the person on those coordinates
I am trying this with ```sqf
private _posDefendant = [3638.17,13386.7,3.76691];
private _defendant = player getPos _posDefendant;
//bunch of checks
if (_defendant position != _posDefendant) exitWith {["There is no defendant active in stand."] call life_fnc_notification_system};
if (playerSide != civilian) exitWith {["You are not a judge."] call life_fnc_notification_system};
//start funtion once checks have been passed
while ((_defendant position) == _posDefendant) do {
createDialog "Life_ticket_give";
["Please select the amount you wish to give the defendant."] call life_fnc_notification_system;
};
private _defendant = player getPos _posDefendant;
that's wrong
Also _defendant position != _posDefendant
if ((position player) != _posDefendant) exitWith {["There is no defendant active in stand."] call life_fnc_notification_system};```
Better?
How do I apply the function to a different player? I think my function will only effect the person executing it
Yes, better. You would need to remoteExec it or refer to the unit not the player.
I have a generell question about locality, what is the difference if you initialize a variable with private in front of it? I thought that wouldn't be necessary considering the underscore in front of the name would make the variable only accessible by the object or script... What is the difference between declaring a variable private and the _underscore method... Im fairly new to SQF btw
https://community.bistudio.com/wiki/private Read this page, also the notes
It privatizes it :3
You cannot use == with positions, because positions are ARRAY's, and those are incompatible with the == operator.
You can compare ARRAY's with isEqualTo, but even a micrometer distance would result in the comparison evaluating to false. A very bad idea.
Yeah, point in circle, not point in point.
Would inAreaArray be better then?
((player distance _pos) <= 15)
Why do you refuse to make a simple distance check? inAreaArray is more suited for whole arrays of positions and objects, not a single one.
You have to be careful with what R3vo posted, because _pos has to be in the AGL format for the distance command to calculate correctly. I'm not sure you made sure of that with your hard coded position. I'd use distance2D for simplicity.
private _posDefendant = [3638.17,13386.7,3.76691];
^ this is what I'm referring to. I don't know where this comes from.
I see. And that is the same position in which the player will be teleported and frozen
in regards to private _posDefendant = [3638.17,13386.7,3.76691];
Joon, it still matters how you retrieved this position.
Where does it come from?
This somehow all doesn't seem right to me how you're using getPos here.
private _posDefendant = [3638.17,13386.7,3.76691];
private _defendant = player getPos _posDefendant;
The syntax is origin getPos [distance, heading], but _posDefendant in your example has 3 elements, not 2 (distance and heading). Seems broken to me.
I definitely need to revisit some things now.. I see what you mean. I will unscrew everything up first and get back to you with something
Yeah, maybe describe what you're trying to do. I'm away 2 minutes getting my meal ready.
alrighty cheers, will do
/*
1) Player is teleported behind defendant podium stand.
2) judge decides through the 'impose sanction' dialog, to impose a monetary fine
3) Life_ticket_give dialog is spawned, and judge enters amount, and gives the ticket to the player that is behind the podium
*/
@clever mantle I missed your question.
I have a generell question about locality, what is the difference if you initialize a variable with private in front of it?
Locality refers to the question of which machine controls a game entity in multiplayer. It has nothing to do with variables despite Global and Local variables being called the way they are. Don't think about objects at all, just about different script instances.
The underscore at the start of the identifier is what makes a variable a local variable. All others are global.
Global variables are available in all script* instances.
Local variables belong not only to one script instance, but specifically to a scope of the script. Scopes are everything enclosed inside curly brackets, i.e. functions and then-block in if-then-else control structures.
A local variable is only defined inside the scope in which it belongs to and all it's child scopes, but none of the parent scopes.
cont. after I check my meal....
@little eagle Thanks
@clever mantle You can also redefine _variable and change the value to something else throughout the script
same with global and privatized variables..
All others are global. This reminds me of why I hate Arma again...
Please don't spam the chat while I explain.
whoever got the idea of local variables without underscore should be fired
@clever mantle Every time you use the assignment operator without private, the game iterates backwards through all parent scopes of your current scope in the script instance. If it finds a variable with this identifier defined in the scope, it stops and overwrites the previous value with the new one. Only if no variable with this identifier was assigned in any of the parent scopes, the variable is set in the current scope.
The private assignment syntax is simpler. The game sets the variable inside the current scope and doesn't touch those with the same identifier in parent scopes.
This means that to get a script to work properly with all other functions that may be executed in the same script, the first time you create your variable you should use the private keyword for assignment. And you have to do that in the most outer scope you want to use the variable in.
The only place you theoretically don't need private is if you know 100% that you are the highest scope. Like init.sqf or eventhandlers or trigger code.
But in other places private makes your script safer and faster
Another place would be in the main scope after spawn. To me that's too many exception from the general rule though, so for simplicity, I turn my brain on autopilot and always use private if I assign a variable for the first time. Kinda like declaring the variable in other languages, except internally for different reasons.
on the other hand. If you add it on the highest scope although you technically don't need to. The script still doesn't get any slower
Yeah, you don't even lose anything. You have 3 keystrokes more with autocomplete, but at least you can easily see where a variable comes from if you have proper syntax highlighting in your editor.
Can you please define what input argument means? I am trying to better understand the use of params
(input argument) call my_fnc_script
You have 3 keystrokes more with autocomplete a intelligent IDE could auto-insert the private when you press = and the name wasn't defined before
"input argument" sounds weird to me. You could call it argument or input, but not both at the same time. Redundant.
Got it from the description of params on the wiki xd
basically. It mean _this variable.
or otherwise the left hand side argument of params
When would you chose to use params []; over private [_blah,...]?
completly different things
Example 3. One other command that is capable of creating private variables is params
private [...] defines a bunch of variables as nil and privatizes them.. I would never use that because it's fkin expensive
wiki confuses things for me :/
params takes values out of _this. and assigns them to private variables
Here. A copy-paste from last week:
params ["_var"] is equal to
private _var = if (_this isEqualType []) then {
if (count _this > 0) then {_this select 0} else {_defaultValue};
} else {_this};
or private _var = _this param [0, _defaultValue]
where _defaultValue is nil in this case
So it allows you to apply a whole function to variable without having to write the script out?
It's just a command that does what that script does
it basically does that script, but in engine thus alot faster
@little eagle Don't worry about my court function brother, thanks though. It's clear to me that I need to revise and learn some things first aha
7:41 - 8:30
Is anyone able to explain this more clearly?
Goes through one ear and out the other
That guy uses _this select N, which is pretty bad in 2018.
This video is ages old and he does not do tutorials anymore
watching youtube tutorials isn't really the best way to learn
nor a good way to learn at all.
I know, but Trying to grasp the concept of params is my worst enemy atm
It depends, if they are up-to-date it's a way of getting started
what's your issue understanding how params work?
How are they used? Why are they used? And a full example would definitely get me to understand
params is a command, what do you mean "how are they used" ?
private _fnc_print = {
params [
["_string", "", [""],
["_useChat", false, [false]]
];
if (_useChat) then {
systemChat _string;
} else {
hint _string;
};
};
["hello world", false] call _fnc_print; // prints "hello world"
["hello world"] call _fnc_print; // prints "hello world"
"hello world" call _fnc_print; // prints "hello world"
["hello world", true] call _fnc_print; // prints "hello world" in chat
Maybe playing around with this helps?
Just ask if you have a question about any specific line.
First of all, from what I can see a paramater has 3 elements, correct?
where does _useChat come from?
In params? Usually yes. It can be also one or four or two, in which case every other parameter is a default value documented on the wiki.
_useChat is a variable defined by params.
In those last four function calls, the value is passed to the function. The first time it is explicitly set to false, in the last time it is explicitly set to true
And in the second and third case it is undefined, which means that params sets it to the default value false.
_fnc_print is a variable, and it is being called by the last four function calls
Which is the first false after "_useChat" in params.
_fnc_print is a variable that holds a function, yes.
Only functions can be call'ed.
You can see that it is a function by the { } curly brackets.
mind is still blowing up ahh
Maybe something simpler. You have to understand functions first, otherwise params makes not much sense.
I don't see a single time a function being assigned to a local variable on that page. It seems to me that the author didn't know that much either.
your code above is an inline function right?
It's just a normal function.
doesn't matter where it is
A inline function would be
_stuff = stuff call {function code} for me
I don't think "inline function" is well defined.
Yep, Dedmen got it. That looks more like something that would be called inline function.
I think the author of the wiki tried to distinguish functions defined by your script from functions defined by the CfgFunctions framework.
But I would argue that functions defined by script are the most normal case of a function, so I would only qualify a CfgFunctions defined function with an attribute, i.e. "CfgFunctions-function".
a function is literally a CODE type variable.
No matter if local of global or from CfgFunctions or whatever
Yes.
I'd say my above example is could get the special "inline" name because it's actually never stored in a variable
Agreed.
//MyCode.sqf
params ["_parameterOne", "_parameterTwo"];
//Inline Function
myInlineFunction ={
params ["_parameterOne", "_parameterTwo"];
};```
the function is using the same code as defined in params?
does it mean that it takes the params from params and puts it in the function
The arguments are taken from the left hand side of the call command.
I'm not getting this, what should I do?
[10,12,15] call {
params ["_value1", "_value2", "_value3"];
_value1; // 10
_value2; // 12
_value3; // 15
};
functions don't store anything of where they are defined. Many people often think local variables carry over when you define a function. Completly untrue
private _function = {
params ["_value1", "_value2", "_value3"];
_value1; // 10
_value2; // 12
_value3; // 15
};
private _args = [10,12,15];
_args call _function;
Do you also understand that this is exactly the same?
how would _function know that the values are 10,12,15
call tells it.
_args call _function; Because you give them to it
so then _function inherits the same values
call has _args on the left hand side, and _args is [10,12,15] defined a line above.
whatever is on the left of call get's copied into the _this variable inside the function.
which is where params then pulls the arguments back out of
can you please provide a script example of lets say, setting the position of a player to 3 different locations
using params
if that makes sense
ill write one myself (or try to) and see how it goes
_positionPlayer = params {
_pos1; //[x,y,z]
_pos2; //[x,y,z]
_pos3; //[x,y,z]
};
_newPosition call _positionPlayer;```
just wrote this probs makes no sense at all
hmm lemme retry
private _fnc_updatePosition = {
params [
"_unit",
"_position"
];
_unit setPosASL _position;
};
private _target = cursorTarget;
private _targetPos = getPosASL _target;
[_target, getPosASL player] call _fnc_updatePosition;
[player, _targetPos] call _fnc_updatePosition;
Like this?
This swaps yours and your targets position.
if you were to swap `_target" with specific coordinates, would it be something like this: ```sqf
private _fnc_updatePosition = {
params ["_unit","_position"];
_unit setPosASL _position;
};
private _target = [x,y,z];
private _targetPos = getPosASL _target;
[_target, getPosASL player] call _fnc_updatePosition;
[player, _targetPos] call _fnc_updatePosition;```
or sqf private _target = getPos [x,y,z];
That would error, because then _unit becomes a position and not an object, and therefore _unit setPosASL will error.
Just read
for one. setPosASL doesn't take Array on left side. But you are passing _target as first parameter which get's the left argument to setPosASL
second. getPos doesn't take array on right side. So you cannot do that
^
well... params seems a bit adavanced
setPos is explained on the wiki.
yeah. it is.
but it's still one of the basics you need to know once you write more stuff than just trigger or init box scripts
Do you believe I should revisit it and learn something else now, or keep trying to learn it
because I am honestly still lost with the idea
You're lost by the idea of setPos?
Do you know what a variable is?
params is used to assign a set of variables inside a function. The identifiers of the variables are written down after the params command, and the values are retrieved by whatever the arguments passed to the function by the call command are.
private _myMoneyBalance = {
params ["_balance1","_balance2","_balance3","_balance4"];
_balance1;
_balance2;
_balance3;
_balance4;
};
_myUpdatedBalance = [500,200,100,999];
_myUpdatedBalance call _myMoneyBalance;```
I'm gonna write whats happening please correct me
Looks good so far.
The first part (everything above };, involves a variable which is defined as _myMoneyBalance. That variable holds four paramaters, that are not defined, because they will be defined later on. after the first scope, a new variable exists to set the four elements to [500,200,100,999]. Then this is initialized by calling the function that holds the paramaters.
I also don't understand why sqf _balance1; _balance2; _balance3; _balance4; is required?
wouldn't they need to be assigned to an empty string?
_balance1 = "":
It isn't required, but the function should probably be doing stuff with them.
Now another question I have is, why would you want to do this?
couldn't you just redefine the variables later on?
_balance1 = 5000;
So you can use the function in a lot of different places without having to rewrite the same code multiple times.
The function currently does nothing, because there is nothing relevant done after params.
Have you got a file I can look at that does this?
Actually, are you able to give me a real script idea to make, where I can try and use params
Hmm, very bad at coming up with stuff like that.
I'll take anything xd
[] spawn {
private _pos1 = [10,10,10];
private _pos2 = [222,222,100];
player setPos _pos1;
sleep 3;
player setPos _pos2;
sleep 3;
private _positionPlayer = {
params ["_pos1","_pos2"];
_pos1;
_pos2;
};
_newPosition = [5000,5000,5000];
_newPosition call _positionPlayer;
player setPos _newPosition;
};
You may want to fill your function with some content, because atm this truly doesn't make much sense.
A little preprocessor question: if I have a macro like #define MY_MACRO(param) , can it take a multi-line statement as parameter, like a multi-line block of {CODE}?
yes
Hmm... going to check my macro further, thanks
I mean if I provide a multi-line statement as a macro argument, while you provide a macro which expands into a multi-line code. I'll show it in a second.
Allright, that's quite weird preprocessor behaviour.
So, this code:
#define SET_FUNC(funcName, funcCode) funcName = funcCode
SET_FUNC(myFuncName, {
params["_unit"];
_unit setDammage _dammmage;
});
Expads fine into this:
myFuncName = {
params["_unit"];
_unit setDammage _dammmage;
};
But as soon as I add more than one parameter into the params block:
#define SET_FUNC(funcName, funcCode) funcName = funcCode
SET_FUNC(myFuncName, {
params["_unit", "_dammmage"];
_unit setDammage _dammmage;
});
It doesn't expand into anything any more. It's just all gone and only a ; is left:
;
You cannot use an argument that contains , , because the comma is used to separate the arguments.
Oh that explains a lot, you are obviously right
#define FUNC {\
params["_unit"];\
_unit setDammage _dammmage;\
}
#define SET_FUNC(funcName) funcName = FUNC
Could try this syntax.
Or maybe this?
#define FUNC {\
params["_unit"];\
_unit setDammage _dammmage;\
}
#define SET_FUNC(funcName,funValue) funcName = funcValue
SET_FUNC(blah,FUNC);
Yes, or like this: it's in SQF code not in a config or smth like that.
SET_FUNC(myFuncName, _myFunc);```
My idea was to make a macros of this kind for multi-line functions, but I found a workaround with two macros: one for the start and one for the end of a function definition.
Does it have to be a macro? Sounds like something more suited for script.
Most likely yes... I was trying to make an OOP implementation like oop.h by code34, so I needed a macro for defining methods of my class.
I just read that you should use BIS_fnc_loop instead of a while loop. Is this true?
Stop watching youtube videos.
lol
99% of while loops are not needed, and replacing them with BIS_fnc_loop (discount PFH) is just as bad. The rest 1% are never what you're having in mind either.
Gotcha, thanks
Do you think just reading and analysing script is good for practise
even if you have no idea what is happening*
Personally I learned the most by trying. The debug console is a nice tool for that, because you can paste and live edit code while the mission is running. With CBA mod you have the extended debug console where you have a bigger box and previous and back buttons, and the View fields are not as wonky.
Did you try anything specific?
About everything, because I still do, always something new to learn, and been doing it for 5 years <.<
How often were you looking at the wiki?
you can never be too sure of a command syntax, use the wiki
private _courtRoom = [3626.4,13377.6,3.00143814];
if !(alive player) exitWith {["How is this possible?"] call life_fnc_notification_system};
if (playerSide != civilian) exitWith {["You are not a judge."] call life_fnc_notification_system};
if ((primaryWeapon player != "") || (handgunWeapon player != "")) exitWith {["You cannot go on duty whilst you have a weapon. This is against the law.",false,"fast"] call life_fnc_notification_system;};
["Your shift will begin in one minute. You will be spawned in the judge's lobby to commence your awaiting trial."] call life_fnc_notification_system;
sleep 60;
player setPos _courtRoom;
["Your shift has started, please make your way to the court room to attend your given trial."] call life_fnc_notification_system;
For some reason this teleports the player immediately, rather than waiting 60 seconds.
Is that maybe unscheduled? you cannot sleep in unscheduled. How is that script executed?
class judgeOnDuty
{
displayName = "JUDGE";
onCall = "[] call court_fnc_judgeOnDuty;";
image = "judge.paa";
conditions = "license_civ_judge";
};```
dialog button
yeah. That's unscheduled
easiest fix is to replace onCall = "[] call court_fnc_judgeOnDuty;"; by onCall = "[] spawn court_fnc_judgeOnDuty;";
hey guys
ahh, ok cheers mate
1.82
just googled - yeah ty
"Tag\AddonName\music\filename2.ogg" - Do I have to specifiy this like for example to specifically the folder name?
while {_time > 0} do {
hint format ["Your shift will begin in %1 seconds.", _time] call life_fnc_notification_system;
sleep 1;
_time = _time -1;
};
Can someone check this for me xd
heh enjoying life?
tracks[] = {MyMusic1,MyMusic2}; - Mymusic, is that the filename* that will show up on the GUI?
see Description.ext wiki page for cfgMusic
Do you guys have a idea how I can get units array from the player FOV?
wait if something is arbitrary, does it mean no touching?
okay this is very rough
but I have completed the config? what now?
@astral tendon you couuuuld draw a triangle that extends to the limits of the map and get whatever is in there and then check for visibility
but that's very wonky
Whats bad about BIS_fnc_loop ?
not necessarly bad... Just if you are using it you are either searching for a CBA PFH alternative because you don't have CBA. Or you have some logic error in your script
Most likely the latter.
@astral tendon
allPlayers select {([objNull, "VIEW"] checkVisibility [eyePos player, eyePos _x]) > 0};
But I cant really remember at which FOV it will struck, so you might see units in a back of your head. Check it out
Anyways that still will require some additional checks afterwards.
whats the classname of a GBU you can use setDamage on? I've been told its a separate thing from a normal GBU
What made you think there is one?
@thorn saffron Projectiles are vehicles too, so any of them can recieve setDamage.
anyone can tell me why my addAction variable isn't global? ```sqf
params[ "_cond", "", "", "_cond"];
ACIWSOFF = 1;
publicVariable "ACIWSOFF";
ACIWSON = 1;
publicVariable "ACIWSON";
if (_cond isEqualTo "CIWSON") then { // Enable CIWS
Mk29LB setCombatMode "RED";
Mk29RF setCombatMode "RED";
PhalanxRF setCombatMode "RED";
PhalanxLM setCombatMode "RED";
PhalanxCB setCombatMode "RED";
Mk31LF setCombatMode "RED";
Mk31RB setCombatMode "RED";
ACIWSOFF = CIWS_Laptop addAction ["Turn CIWS OFF","itsAebian\CIWS\ciws.sqf","CIWSOFF"];
CIWS_Laptop removeAction ACIWSON;
[
["CIWS ON","font = 'PuristaSemiBold'"]
] execVM "\a3\missions_f_bootcamp\Campaign\Functions\GUI\fn_SITREP.sqf";
}
else
{
if (_cond isEqualTo "CIWSOFF") then { // Disable CIWS
Mk29LB setCombatMode "BLUE";
Mk29RF setCombatMode "BLUE";
PhalanxRF setCombatMode "BLUE";
PhalanxLM setCombatMode "BLUE";
PhalanxCB setCombatMode "BLUE";
Mk31LF setCombatMode "BLUE";
Mk31RB setCombatMode "BLUE";
ACIWSON = CIWS_Laptop addAction ["Turn CIWS ON","itsAebian\CIWS\ciws.sqf","CIWSON"];
CIWS_Laptop removeAction ACIWSOFF;
[
["CIWS OFF","font = 'PuristaSemiBold'"]
] execVM "\a3\missions_f_bootcamp\Campaign\Functions\GUI\fn_SITREP.sqf";
}
} ```
I'm certainly not sure how I can script this better =/
If by global you mean not available to every player it is because you execute it locally.
You should look into remoteExecCall
well the thing is that the actions are not getting removed and added
IMO it would be a lot cleaner if you would set variable ciwsOn on laptop object and add 2 actions on it. Then use condition param to display on/off action.
would it? currently I just execute ["CIWSOFF"] execVM "itsAebian\CIWS\ciws.sqf" at the initServer.sqf But I will try that
If you initialize add action on server it will be not visible to clients. You need to remoteExec it as i said earlier.
addAction must be executed on client machine.
its a local mission
so it works
the thing is that the action will not get removed
I don't have problems with locality or so
k.
so just because its in a sqf named initServer.sqf it's not the locality issue
but I'm not sure how the condition thingy works
at the addAction part
Still adding and removing action is unnecessary hassle if u can use condition param imo.
so the question here is: What do I need to add into my SQF to trigger yes or no
its a string of code that must return true if action should be visible.
yeah but still don't get it. My action just executes the SQF and passes an argument along, which then does the switch if on or off
and I'm not sure I my SQF needs to return anything so that the addAction will be invisible
because my goal is that if the CIWS is ON then only the OFF-Action is showing
and vice-versa
ah
You could do CIWS_Laptop setVariable ["ciwsEnabled, false], then add 2 actions to CIWS_laptop make one for enabling and one for disabling.
And as condition for enable action do '_target getVariable ["ciwsEnabled", false]'.
And for disable action '!_target getVariable ["ciwsEnabled", false]'.
I'm not sure how to put "" inside a string in SQF 😄
↑ ↑ ↑ ↑ ↑
is 'string' a valid string?
Yes.
So what i suggested should work then.
yup
Yes. You put double-quotes in strings like this:
"My ""quotes"" are here"
But if are using apostrophe there is no need to escape I guess.
Also escaping quote with quote 🤦
"this is a 'valid' string"
``````sqf
'this is a "valid" string'
``````sqf
"this is a ""valid"" string"
wonder if '' escapes as well, never used it
'is ''this'' a valid string'
these are all single quotes btw ^^
can't confirm, I am a firm believer of the superiority of double-quote master race :-p
"string"
'c' 'h' 'a' 'r' ¯_(ツ)_/¯
I mostly use single quotes, but that's leftover from other languages where double quotes might be slower, since it has special interpolation rules.
…PHP
player addEventHandler["FiredMan",
{
_this spawn
{
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle"];
waitUntil{speed _projectile > 10};
_velocity = velocity _projectile;
_direction = getDir _projectile;
_b = "Rabbit_F" createVehicle (getPosATL _projectile);
_b setPos (getPos _projectile);
deleteVehicle _projectile;
_b setDir _direction;
_b setVelocity[(_velocity select 0) + (sin _direction * speed _projectile),(_velocity select 1) + (cos _direction * speed _projectile),(_velocity select 2)];
};
}];
Sloppy code, but for anyone who wants to laugh a bit.
Lol - brief laugh-emoticon there xD
@errant jasper Son, I am disappoint 👀 😄
`js interpolated ${var} strings ftw`
``` 😄
C# does it now, too
I try to forget PHP..... One day I might sleep again, but still now my past keeps me awake
echo htmlentities($_GET['page']);
@gleaming oyster wait what. Is this replacing bullets with rabbits?! 🐰
ooouh yeah 👍
That last setVelocity seems strange? You take the existing velocity (in m/s), and then add the velocity in km/h except for Z-component.
i would setVelocity velocity bullet?
Exactly, but I might be misunderstanding the intention.
So a velocity of [1,2,3] --> [1 + 3.6, 2 + 7.2, 3]
Or in other words, the X and Y components gets multiplied by 4.6. I am guessing it is an accidental way to adjust for the probably larger air resistance of rabbits.
Hashtag Arma-RabbitStudies
People replacing bullets with rabbits, exclusevly now on #arma3_scripting
I did _b setVelocity (_velocity vectorMultiply 0.5);
back in my days, I shot M1A1 from M4 in Arma 2, and I also made frag artillery by splitting a bullet into 10 grenades… bored in the editor®
FYI, rabbits ricochet
500+ new messages 👀
commy_fnc_changeProjectileDirection = {
params ["_projectile", "_azimuthAdjust", "_altitudeAdjust", ["_speedAdjust", 0]];
// get old direction vector
private _vdir = vectorNormalized velocity _projectile;
// get azimuth and altitude angles and apply adjustments
private _azimuth = ((_vdir select 0) atan2 (_vdir select 1)) + _azimuthAdjust;
private _altitude = asin (_vdir select 2) + _altitudeAdjust;
// get new direction vector (this is a unit vector)
_vdir = [
sin _azimuth * cos _altitude,
cos _azimuth * cos _altitude,
sin _altitude
];
// get best up vector
private _vlat = vectorNormalized (_vdir vectorCrossProduct [0,0,1]);
private _vup = _vlat vectorCrossProduct _vdir;
// get new speed vector. Keep total speed, but change to new direction. Yay for vector commands.
private _velocity = _vdir vectorMultiply (vectorMagnitude velocity _projectile + _speedAdjust);
// set projectile direction dir and up. Projectiles are long objects, especially with tracers, so it would look dumb otherwise.
_projectile setVectorDirAndUp [_vdir, _vup];
// set new speed vector
_projectile setVelocity _velocity;
};
My version, @gleaming oyster
Heheheh. Nice commy.
commy_aiDispersion = 0.2;
commy_fnc_aiDispersion = {
params ["_unit", "", "_muzzle", "", "", "", "_projectile", "_gunner"];
// only for ai, commented for debugging
//if (isPlayer _gunner) exitWith {};
// dispersion projected on circle one meter away
private _radius = tan commy_aiDispersion;
// seeds to make this the same on all clients, todo find more randomized algorithm
private _seed1 = _unit ammo _muzzle;
private _seed2 = 100 - _seed1;
// find random position in that circle...
[0,0] getPos [_radius * sqrt (_seed1 random 1), _seed2 random 360] params ["_posX", "_posY"];
//... and then calculate their azimuth and altitude angles
private _azimuthAdjust = atan _posX;
private _altitudeAdjust = atan _posY;
[_projectile, _azimuthAdjust, _altitudeAdjust] call commy_fnc_changeProjectileDirection;
};
<OBJECT> addEventHandler ["Fired", {call commy_fnc_aiDispersion}];
Combined with this ^ to make the AI fire like drunk.
private _seed1 = _unit ammo _muzzle; < is that to make seed the same for all pc's ? 🤔
you are sqf hacker dude 😀
Hello all. Im needing a point in the right direction. I have items in a listbox populated from mysql. How would I go about allowing users to buy the item? Something like Client request to buy item id 123, Server says ok then deducts the money they have, gives them the item and updates the database. Ive found a few things but they are vague. Any help please?
Well when I say populated from mysql, its an array stored in a missionNamespace variable as an array
So I know I can add _this setvariable ["ace_medical_isMedicalFacility", true]; to the Edit Terrain Object module to make a building an ACE medical facility. I'm just not sure if I have to use the Global Object Init which exec's the code everywhere or if just the server will do. Can anyone clarify for me please
@icy light You need to create module, that will take responsibility for chains to write/read the data, like with DB or missionNamespace. It will tell which item to put/take, how much money you should give/take and etc.
ty
[] spawn {
if (playerSide == civilian) then {
if ((primaryWeapon player != "") || (handgunWeapon player != "")) exitWith {hint "You are not allowed weapons!"};
} else {
hint "Go ahead son.";
};
};```
This doesn't hint sqf hint "Go ahead son."; if the player has no weapons
is the player a civ? if they have no weapons itl hint nothing because there is nothing there to be hinted.
When using remoteExec, what is the root location? Like how do I set the path to the file on the server?
to a file in a mod? "mod prefix\rest of the path"
oh right so its the actual root of the server install then?
i dont think i know what you mean. is the file in a pbo?
no
so u enabled filepatching and its external like that?
ok if i have a file located at c:\arma\server\ @mymod \file.sqf how do I call that with remoteexec?
my main problem is I cant get cfgFunctions to work no matter what I do so I have to full path everything
Ive been trying for over 2 hours to call 1 script with cfgFunctions, cant fix it so i just call everything by full path
since it apparently doesnt work
cfgfunctions would need it in a pbo i would have thought. i dont know for sure tho so 🤷
well that is
are you able to voice? i'll legit pay you if you can help me get cfgfunctions to work
right if you cant voice give me a minute to type out
myfolder is located in the mission folder (that i pack into pbo)
I have a file called fn_runme.sqf located in myfolder\Functions\fn_runme.sqf
there is my cfgFunctions.cpp that is included via description.ext
I try to call it with ["blahblah", (lbData[1500, lbCurSel 1500])] call CyFs_fnc_runme
doesnt work
ive tried calling it as CyFs_runme CyFs_fn_runme nothing
please help me 😦
what am i doing wrong?
no errors in client or server rpt either is the worst part
https://pastebin.com/Z0DaYQB1 try that?
CyFs_fnc_runme
IT WORKS!!!!!!!!!
so what was I doing wrong?
you added class Functions... is that the folder name or just any name?
FINALLY!!! TYTYTYTYTTYTYTYTY
any name. have a read of this https://community.bistudio.com/wiki/Functions_Library_(Arma_3)#Adding_a_Function
oh nice!!!!!
I've seen too much. Time to go to sleep.
good morning @hollow thistle https://gyazo.com/65d99effab30cb2ec68e2770b9c8abf7 😄
👀
❤
For some reason auto spacing isn't working anymore for me in atom?
if (blah blah blah > 29347982) then {
do this;
do this;
};
if (blah blah blah > 29347982) then {
do this;
do this;
};
what happens vs what I want
can anyone help me with this problem ->
https://pastebin.com/Snmj6gRS
ha ha: which one?
Error Undefined variable in expression: bis_rscrespawncontrolsmap_display no, it doesn't
and random, sometimes work, sometimes error
Error Undefined variable in expression: _list
Error Undefined variable in expression: bis_rscrespawncontrolsmap_ctrldetailscontrolsgroup
Error Undefined variable in expression: _display
all these are script errors
a workaround would be waitUntil !isNil "BIS_rscrespawncontrolsmap_display" and so on
but why that happen randomly? :S
maybe a race condition.
also,
'/CfgRespawnInventory/B_Soldier_A_F.vehicle': Missing ';' prior '}' ↑ correction needed here
ups, didn't saw that :p
i have to run the server and give it like 5 minutes
if i join just on start the error wont happen
if it errors in SP, it will eror in MP
clean your code first.
you code specifically for a dedi?
…don't.
why would you want a mission you can't run in SP or in hosted MP?
and how is it easier
seems like everything from respawn menu with some errors, maybe respawn templates are messed up in description.ext or they added wrong/not added at all ?
maybe those semicolons
but i don't think so, happened sometimes without those semicolon errors
how many player sides in that mission ?
1
WEST and AI EAST
as always xD
no error now
can you guys clarify me about JIP?
when it's considered to be JIP
i know it's join in progress
but how much time asfter mission start it's JIP?
if you are not in the briefing on mission start, I believe it is considered as JIP
check with didJIP
persistent mission?
I believe a persistent mission start only on first player connection? I may be wrong though.
but anyway, any client connecting after mission start is technically a JIP
btw maybe you have there respawnOnStart enabled, but there is no players at start > nope, starts by it self > never wait for player
i have respawnOnStart to 1
there your trouble
but this has nothing to be with mission start or not
you said there are no players at start
to 0*
0 - Dont respawn on start. Run respawn script on start.
it's required for respawn menu
it's required for respawn menu
no it's not
yes, otherwise you respawn with the selected unit/slot loadout
and you respawn in the place the unit is
so no sense adding respawn possitions + inventory
well, that's my opinion
that mean that you don't have loadout for mission start/b4 first respawn, but not that any from respawn templates required respawnOnStart enabled 😀
you can add inventory b4 repawn
yes, true, not required
but btw, i just double check, and i have it to 1 xD
but this is stil not a problem
set it 0, just to test for those errors from respawn screen 😀
let's see
idk why i change it to 1, i know the best it's 0 in there (in this case)
but it's working with 1 also
wew, yes
i get error with 0
and no respawn menu
was no respawn, so no respawn menu...
11:07:02 Error Undefined variable in expression: _detailslist
11:07:02 File A3\functions_f\respawn\fn_showRespawnMenuInventoryDetails.sqf [BIS_fnc_showRespawnMenuInventoryDetails], line 241```
woops, BI
waitUntil { player == player }; maybe, really dunno
or time > 0
so they are not my errors huh?
Out of curiosity, is there a try catch in sqf? I normally never need it, but now I have the problem that a function in a mod might just kill itself and I would like to catch that.
of course. The problem is the function expects a location or object but it gets an array instead.
the only i saw was that
http://killzonekid.com/arma-scripting-tutorials-exception-handling-try-throw-catch/
if (result isEqualType []) then { ["received a pos instead of a location"] call BIS_fnc_error };
@digital jacinth
ah, so you cannot differentiate between the different "expections" (i am too used to java here) but just a general "oops that did not work". that is luckly fine by me
no, only exceptions that you create
try {
if (_this == 0) then { throw "hey, you tried to divide by zero!"; };
1/_this;
}
catch
{
hint _exception;
}
Well, guess that won't do then sadly
nope, I don't remember seeing someone using it tbh 😄
The problem is the function expects a location or object but it gets an array instead.
params? 😀
I have not debugged into ACRE for now as the error happend yesterday evening during a play session. Some people reported a script error within an acre function, I yet have to get their log files to check what is going on exactly. One thing I wanted to do was to circumvent the issue by creating my own signal calculation which instead just returns the best quality possible values instead of nothing.
🤔 If my debugger would dump a full call-trace with local variables in case of any script error... That would be nice right? 🤔
in this case, yeah since I suspect either a faulty params or some funky append to an object
Are you using Battleye?
nope
:3 Maybe I can get it done today.. I'll try
btw any eta on new brofiler version, Dedmen ? 😀
Currently everything I want implemented is implemented and released. Do you need some feature?
current one without the instruction showing up work fine
didn't test the "fixed" one with em'.
had couple crashes also, for the features idk... something for "extended debuging" maybe
It's still a profiler and not a debugger. The debugger is currently being worked on by others
and it's very good at what it does
That callstack idea is neat
Unknown error in expression
Error at L15 (z\ace\addons\common\XEH_preInit.hpp)
Callstack:
[] L7 (z\ace\addons\common\XEH_preInit.sqf)
[CBA_fnc_preInit] L109 (x\cba\addons\xeh\fnc_preInit.sqf)
_x: ["", "preInit", {call compile preprocessFileLineNumbers "z\ace\addons\common\XEH_preInit.hpp";}, true, []]
that's how it will look when it's done
full callstack on errors. With local variables into RPT
Okey. I think it's done. But I'm at work and can't test. Who wants to help me with that? :3
i am at work as well, plus i got no one from my group to reproduce the bug I am hunting
Dumping all the private variables is an awesome idea!
The only tiny problem is with nils since in arma when something is nil it doesn't exist.
No not a problem. I differentiate between nil and "doesn't exist"
so this will still print nil variables. Like when you do private ["_myVar"]. It does exist, but it is nil.
Okey I found someone to turn on my home PC so I can test myself now via Teamviewer 😄
Oh allright, i thought that nil and doesn't exist are the same
@unborn ether For some reason setDamage seems to not work on projectiles when I tried to destroy them that way, I could only do so by smashing them into an obstacle.
in the sense on how you use it in script it is the same as you just ask isNil '_myVar'. Just there is still some memory allocation somewhere for this variable.
at least that is how i think the interpreter does it
People think of "nil" == "doesn't exist" because if a variable doesn't exist the script engine returns nil. Because it HAS TO return something.
And if you set a global variable to nil it's usually also deleted to save memory. But you usually don't notice that in scripts. Only way to detect that is by using allVariables on a namespace to see if a variable exists
so a private variable exists until you leave the scope, be it filled with a value or not
yeah. private variables don't delete themselves when you set them to nil.
so if I set a global variable to nil, it's will be deleted to JIP queue ?
variables are always local unless you publicVariable it
If you publicVariable a globalVariable that's nil. Then yes. It will be removed from the queue
Atleast that's what I expect...
Ohh man... printing local variables is a bad idea if something inside CfgFunctions init triggers. Because it has an array with all CfgFunctions in it.. And turning that into a string to dump it out....... Well...
Probably should add exception for this case.
But how.. I can check for array length. But what if the array contains a few sub-arrays. But these arrays are huge.
I could just not print the code but instead print a {code} placeholder. But people might want code variables in their callstack..
I'll just add a length check and don't print arrays with more than 50 elements. 🤞
Can you make your program check for existance of a special private variable which will indicate that the user wants all the private variables printed anyway?
uhh... theoretically yeah.. But at that point you might aswell just use the full blown debugger
I can imagine something failing once a week, for that case that would be a nice option
Oh wait, probably your solution requires some debugging build anyway
nope
well it requires the mod to be loaded
Automatic crash reporting would be nice. Create a dump of the callstack. And you can register your PREFIX_fnc_func prefix and the crashdumps will be uploaded and sent to you 🤔
Though... That's not the full callstack. There are parts missing :U
Would be great if there was a way to disable a global object from syncing its position/direction/velocity to other clients.
How?
enableSimulation?
^ disableSimulation and that
unit enableSimulation false, disableSimulation doesn't exist ^^
…unless it's a config entry?
can relate ^^
ah, let me clarify - disable pos/dir/vel syncing to other clients, but leave all other simulation enabled.
e.g. getting in a vehicle with simulation disabled does not usually end well for the player.
also, not sure if the comment on the enableSimulation wiki page is correct, but someone said: "After using enableSimulation false or enableSimulationGlobal false on an object, setPos will still update its position across the network in MP."
Does anyone know the classname for the GBU you can use setDamage on? I'm working on a hard-kill Active Protection System for vehicles and right now I'm forced to smash the projectile int an invisible blocker object to detonate it. I do not want to just spawn a tiny explosion effect, I want to detonate the projectiles right and proper away from vehicle.
setDamage does not seem to work on rockets and such.
@thick ridge yes, setPos will update position once
(asking because of Advanced Train Simulator mod - would be great not to have to use local objects for all of the train cars)
i'm starting function with spawn, try'ed call but every time i get cicle, function run every frame. But i'm want to single start function and get result. Cicle not defined on script
Hi,
I have this error, and hope that you can help me.: Error Generic error in expression
My code:
hint _job; ```
You can see my ``` _str ``` here: https://imgur.com/a/1lk9nUq
Error:
16:26:24 Error position: <select 0;hint _job;closeDialog 0;>
16:26:24 Error Generic error in expression```
Interesting, it seems that that triggerWhenDestroyed = 1; is the thing that allows you to detonate stuff via scripts. I need to check what happens if I add this to the core missile, rocket and shell, just so everything else just inherits this.
so what is the content of _str? It sounds like it should be a string. And string select 0 is invalid afaik
@still forum I can't select something if it's a string?
Man.. you should really use isEqualType and params @verbal otter That would make that script half as long
and Tags for global variables
the Find = true; at the end is invalid @verbal otter
you cannot do that.
@modern snow https://community.bistudio.com/wiki/select no you can't. There is no syntax that can do that
i use to waitUntil {Find};
You cannot set a variable that has the same name as a command
And https://community.bistudio.com/wiki/find find has been a command since Arma 1
call compile format is also a big no-no. If you use that then you did something wrong.
i get array from database
thank you! i don't see that command
but still getting cicle on my function
disabled waitUntil
are you sure it's inside your function?
not that you are calling the function itself? multiple times
no, i start function and cicle starts
Well there is no loop (That's what "circle" is called) inside your script. Also you were talking about a waitUntil. I don't see that anywhere?
Either you didn't send the full script. Or your issue is not inside the script. Because there is nothing in there.
Not even the stuff from your logs that you posted before are in there
i start it from debug console
waitUntil function was it another script where i called this
but nothing changed
cicle (cycle) or circle?
Wait..
there is server part:
You said the circle starts when you do
[2,[]] call recept_framework;
// OR
[2,[]] spawn recept_framework;
But before you told me you use
// run:
[2,[]] spawn rt_frame;
What now?
recept_framework or rt_frame, waitUntil that doesn't exist. Debug logs that don't exist.
You're not making any sense
what is that? Is that TON_fnc_rt ?
i this sctipt
If so then yeah. It calls your recept_framework which then calls TON_fnc_rt again which then calls recept_framework again and so on.
What? But before you posted that rt_frame function. Which you then renamed to recept_framework and now suddenly recept_framework is a completly different function again?
And why is recept_framework calling itself on private _curLevel = [4,_craftXp,_craftLevel] call recept_framework; ?
There you have your loop. It's calling itself
Ok, so adding triggerWhenDestroyed = 1; to the missiles and stuff and using setDamage 1 causes something really weird. The projectile model is destroyed, but the projectile itself is still going, just invisible and it explodes on hit as normal.
delete it ^
@lone glade I'm working on a hard-kill Active Protection System for vehicles and right now I'm forced to smash the projectile int an invisible blocker object to detonate it. I do not want to just spawn a tiny explosion effect, I want to detonate the projectiles right and proper, just away from a vehicle.
@still forum thank you a lot!!! for now function work without loops 😃
@lone glade Tried, I do not get the explosion.
destroy, sleep, kill?
sounds like a normal day to me
@spark cobalt Neither destruction, nor setDamage causes the projectile to explode midair like I want it to
https://s.sqf.ovh/notepad%2B%2B_2018-06-04_18-30-19.png Line 44-52 is what Arma normally gives you.
that all logs into the rpt file even if loggin is disabled?
aight
Hello! Anyone now why aon object for player is a normal object but for server is OBJNull?
Thay both have the same addon
with the object
you are spawning the object with createVehicleLocal