#arma3_scripting
1 messages ยท Page 519 of 1
yes they are!
๐
have a quick read of this Folder Path subsection
https://community.bistudio.com/wiki/Arma_3_Functions_Library#Folder_Path
take off fn_
looking good ๐
awesome! Thanks so much. I've never used functions like this before, only scripts.
Could I get your help with one other function? This one is a little more in depth
depends what it is
Its supposed to create groups of units that have dynamic variable names (so that every single group has a unique name)
(_this select 3) params ["_side","_groupSize","_spawnPosition"];
//determine side of units
if ("_side" isEqualTo "EAST") then {
//create the group and name it
private _group = createGroup ["EAST",true]; // why is there a 1 in your script?
private _id = time; //(or sth similar to identify it)
private _groupVarName = format ["EastGroup:%1",_id];
missionNamespace setVariable [_groupVarName,_group];
// access it later again:
_groupVarName = format ["EastGroup:%1",_id];
_group = missionNamespace getVariable [_groupVarName,grpNull];
if (!isNull _group) then {/*group exists*/};
for [{private _i =0}, {_i = _groupSize}, {_i + 1}] do {
//create random units and add them to the group
private _unit = group player createUnit ["B_RangeMaster_F", position player, [], 0, "FORM"];
};
}else{
//same code, but for West
};
This is what I have so far, but I'm not sure it'll work
can confirm, it will not
easy enough!
"_side" isEqualTo "EAST" will always be false because "_side" is not "EAST".
is _side a string or type side?
_side is passed in as a parameter from the function caller...at least that's what I want it to do lol
passed in as a string
yea, but you write _side in quotes so its comparing string "_side" to string "EAST". you want _side isEqualTo "EAST"
that condition in the for loop is wrong as well
_i = _groupSize doesnt return true or false
not to mention _groupSize isnt defined, but i assume this just a snippet of a bigger script.
o rip
its in params, never mind ๐
so that doesn't act as the "maximum" of the for loop? I was thinking of it as for i=0:_groupSize, do {}
My background is in C++ and MatLab so SQF has been a earning experience lol...and come on, give me SOME credit lol๐
its the condition the loop will exit on when true.
_i == _groupSize or _i > _groupSize is probably what you're after.
Ohhhh, I just missed an =, ok. cool
when I added that second =, it started throwing errors for undefined vars
paste error here
nahh itl be fine
if you want it to go away you could do for "_i" from 0 to _groupSize do {
anyone here know anything about the 3den ui macros ? remaking my phone with the pixelGrid macros, and i worked out the sizes using my 1440p display, but when i went to 720 to test on a lower resolution .... https://cdn.discordapp.com/attachments/438011518618042368/550886726810206208/20190301034639_1.jpg happened
it makes sense, i feel like you may end up with some double up names using time but itl do. may want to consider using random as well, so ur var would be format["EastGroup:%1:%2",time,random 99999]
Oh ok, yea I thought about that too! I just didn't know if it worked like that. Yea that's a good idea
for "_i" from 0 to _groupSize do {
};
@wary vine do you scale ur ui sizes or just straight pixel grid coords?
it should use the 3den macros
Do units need to each have unique names?
#define pixelScale 0.50
#define GRID_W (pixelW * pixelGrid * pixelScale)
#define GRID_H (pixelH * pixelGrid * pixelScale)
#define CENTER_X ((getResolution select 2) * 0.5 * pixelW)
#define CENTER_Y ((getResolution select 3) * 0.5 * pixelH)
or can I just use _unit each time?
if you use the units outside of the loop, you will need to give them unique names, but it looks in your case you don't need to
Ok, so my end goal is to add each of these units to the group we just created, and then I'm going to pass that array as a return value. I'm going to then give them a way point. Is that done on the group level?
i recently had issues with 16:9 vs 4:3 and sorted out scaling like this:
// Mission UIs were built using small UI scale.
// These values are used to properly scale UIs for different sizes.
#define GRID_W_SCALE (0.00126263 * 8 * 0.50)
#define GRID_H_SCALE (0.0016835 * 8 * 0.50)
#define PX_WA(n) n*GRID_W
#define PX_HA(n) n*GRID_H
#define PX_WS(n) n*(GRID_W*(GRID_W_SCALE/GRID_W))
#define PX_HS(n) n*(GRID_H*(GRID_H_SCALE/GRID_H))
#define CENTER_XA(n) (CENTER_X)-(0.5*(PX_WA(n)))
#define CENTER_YA(n) (CENTER_Y)-(0.5*(PX_HA(n)))
#define CENTER_XS(n) (CENTER_X)-(0.5*(PX_WS(n)))
#define CENTER_YS(n) (CENTER_Y)-(0.5*(PX_HS(n)))
I feel like it may not quite do the job for you though, you may need to set max sizes based off the resolution so it cant go off the screen.
I shall take a look.
@robust hollow my functions are still throwing Takitest\functions\fn_countGarrison not found
is this a mission or mod?
Mission!
so your folder structure is <missionRoot>\Takitest\functions\<*.sqf>?
no, Takitest is the mission file name
remove it from the filepath
functions
this is in cfgfunctions.hpp correct?
yes
cause just functions didn't work either
class HP {
tag = "HP";
class HPfunctions {
file = "functions";
class countGarrison {};
class checkSectorOwners {};
class createGroup {};
class initGarrisons {};
class isSectorCaptured {};
};
};
missions\Takitest.takistan\functions and this is where the functions file is
folder* not file
r u testing this in editor?
are you reloading the mission in editor when you edit ur config?
Nope, didn;t realize I needed to
Ok, I think that was the error!
Thanks for all your help, I really appreciate it!
...I actually have one more question....
So I know you can access classnames by doing _configs = "true" configClasses (configFile >> "CfgVehicles"); Is there a way that I can then access the specific unit classnames for like rhs_faction_msv? Or would I have to use some sort of loop for that? I want to set up dynamic troop creation with arrays of all of the faction infantry
Could I take that one step further and do _configs = "true" configClasses (configFile >> "CfgVehicles">>"rhs_faction_msv");?
configClasses seems like a weird way to go about it but yea, keep using >> as deep as you want to go
Is there a better way to do it?
I just don't want to write out 500 class names by hand
then use it once to get the list of units and then define that list so you dont need to sort through all the vehicles every time.
that's a good point. Thanks.
How do I get a return value from a function? exitWith says it just returns a value from the current scope, so if I'm in an ifstatement or switch, statement how do I exit the whole script with that desired value?
This is my code, sorry for the length
exitwith is used instead of then. not how you have it
oh ok. So how do I return then?
case 0:{[]}; will return the array
I'm sorry, I don't understand what you mean
in other languages you have return <value> to return a value. in sqf it returns the result of the last operation in the scope. so if your last operation in a case is stating an array, it will return that array.
you set the array to variable _infantryArray. you dont need to if thats all the case does
so do I need to include some sort of like...dummy or holder array? or can I literally just hang _infantryArray
?
case "rhs_faction_usarmy": {[
"rhsusf_army_ocp_rifleman_1stcav",
...
"rhsusf_army_ocp_helicrew"
]};
will work
Oh ok, so I just need to remove the exitWith and i'm good to go?
no, because you set ur array to a variable
Ah ok, I see now
its a little weird to me that the switch statement will just exit out of the script once its done
Although I guess it makes sense if none of the other conditions are met and its not a loop
Works great, thanks.
@robust hollow Ended up fixing it by allowing the end user to modify the dialog size multiplier
#define DIALOG_MULTIPLIER (profileNamespace getVariable ["Lega_Dialog_Multiplier", 0.70])
#define DIALOG_W 175 * DIALOG_MULTIPLIER
#define DIALOG_H 175 * DIALOG_MULTIPLIER
It sort of makes my uis independent of interface size, as that was what was messing with it.
Maybe there's a faster way to add vectors longer than 3?
vectorAdd takes around 1us, and the solution from BIS_fnc_vectorAdd takes around 8us private _ret = []; {_ret pushBack (_x + (_b select _forEachIndex))} forEach _a;
Hmm this solution seems to take 4us :D
_a = [0, 1, 2, 3, 4, 5]; _b = [0, 1, 2, 3, 4, 5]; ((_a select [0, 3]) vectorAdd (_b select [0, 3])) + ((_a select [3, 3]) vectorAdd (_b select [3, 3]))
Hello. I'm trying to make the player teleport out of sight of other players but am having trouble with detecting if the player's teleport position is in or not of the light of sight of other players
private _Pos1 = [[["spawnzone", 90]], newBuildingMarkers] call BIS_fnc_randomPos;
if (!(count(allPlayers - [player]) isEqualTo 0)) then
{
private _inVisual = 1;
while {_inVisual isEqualTo 1} do
{
{
_inVisual = [objNull, "VIEW"] checkVisibility [eyePos _x, _Pos1];
} forEach (allPlayers - [player]);
_Pos1 = [[["spawnzone", 90]], newBuildingMarkers] call BIS_fnc_randomPos;
};
};
player setDir (random 360);
player setPosATL [_Pos1 select 0, _Pos1 select 1, 0];```
I'm not really friendly with that kind of explainations ...
even if the player is not visible. You are still getting a new position
private _Pos1 = [[["spawnzone", 90]], newBuildingMarkers] call BIS_fnc_randomPos;
if (countallPlayers > 1) then {
private _isVisual = true;
while {_isVisual} do {
_Pos1 = [[["spawnzone", 90]], newBuildingMarkers] call BIS_fnc_randomPos;
_isVisual = (allPlayers - [player]) findIf {
([objNull, "VIEW"] checkVisibility [eyePos _x, _Pos1]) > 0.5
} != -1;
};
};
player setDir (random 360);
player setPosATL [_Pos1 select 0, _Pos1 select 1, 0];
Here is a slightly better version of that script. You didn't say whether there is anything wrong with your script.
Hey guys, I'm getting this error: ``` 11:50:52 Error in expression <blicVariable "_garrisonsOPF";
} forEach _opFTerritories;
{
private _pos = getMa>
11:50:52 Error position: <_opFTerritories;
{
private _pos = getMa>
11:50:52 Error foreach: Undefined variable in expression: _opfterritoriesProfiles\Harbor\missions\Takitest.takistan\functions\fn_initGarrisons.sqf, line 19 ```
from this script, can anyone help me?
(_this select 3) params ["_bluFTerritories","_opFTerritories","_opfForces","_blufForces"];
private _garrisonsOPF = [];
private _garrisonsBluf = [];
{
private _pos = getMarkerPos _x;
private _spawnPosition = [_pos, 400] call CBA_fnc_randPos;
private _group = ["EAST",8,_spawnPosition] call HP_fnc_CreateGroup;
_garrisonsOPF pushBack _group;
sleep 0.5;
publicVariable "_garrisonsOPF";
} forEach _opFTerritories;
{
private _pos = getMarkerPos _x;
private _spawnPosition = [_pos, 400] call CBA_fnc_randPos;
private _group = ["WEST",8,_spawnPosition] call HP_fnc_CreateGroup;
_garrisonsBluf pushBack _group;
sleep 0.5;
publicVariable "_garrisonsBluf";
} forEach _bluFTerritories; ```
Not sure why the coloring doesn't work for me, sorry
can you do publicVariable "_xxx" local vars?, thought works only for global vars
Yea i think you're right. I just need that array to be public and when i tried passing in a global variable it gave me the global var in local space error
I'm just gonna take that line out since i don't REALLY need it anyway
Its still giving me the undefined variable error though, even thugh I'm passing it in as a param
publicVariable "_garrisonsOPF";
wtf are you doing? why are you publicVariabl'ing a LOCAL variable?
I'm a little slow
lol it was a dumb mistake that has been removed
did you copy the error correctly?
Error foreach: Undefined variable in expression: is it trying to say that "foreach" is the undefined variable?
It usually states the name of the undefined variable
Did you check whether that var is defined?
its just pushed to the next line of the error
te variable is _opforTerritories which is passed in as a param
Apparently it is not passed in as param then
I would agree with that statement
this is the function call ["BLUFTERRITORIES","OPFORTERRITORIES","OPFFORCES","BLUFFORCES"] execVM "functions\fn_initGarrisons.sqf";
add diag_log to log _this and crosscheck everything
yeah.. undefined then
(_this select 3) is "OPFFORCES"
I suck at using the params command I fuck it up every time
And you are trying to pull 4 parameters out of a single string
I thought _this select 3 on params said you're selecting what is passed into it
Correct
you are selecting the array where params will select it's arguments out of
that thing is a single string value though. Not gonna get 4 arguments out of that
Looks like you want to pull the arguments out of _this. Not out of a single value in _this
this function...it kills me
I don't understand what I'm doing with it rn. Just woke up, sorry
@still forum indeed I wasn't precise enough.
The position selected by my script is sometimes in the field of view of other players altho it's exactly what I'm trying not to get
is it possible to make a sort of "scrolling" credits effect for text?
(like you would with credits)
start its ctrl pos y at the bottom of the screen and set it again to above the top and ctrlcommit the time it should take.
to clarify a bit, you may start on safezoneY + safezoneH and end on safezoneY - _ctrlPos#3
Ok, thanks.
Hi im hosting a mission and currently on blufor all civillians in the area gets spotted on map vise versa
how would u disable spotting other people on the map?
could disable those icons in the difficulty but itl hide ur blufor friends too
using a custom difficulty, set mapContentFriendly = 0;
^
Wont that remove player position aswell ?
No
You can still center yourself on the map
you just won't be able to see any friendly icons
So mapContent should stay 1 or?
Friendly is a modifier of mapContent, mapContent can stay as 1 as long as you want to keep enemy map content active
Well in the mission its currently only civ and blufor so
Enemies wont be apart anyways right?
civ & blufor are considered friendly as a blufor unit as long as your rating is not below a certain threshold
friendlies are relative to the unit, if you're opfor. The blufor will be marked as enemies, if you're blufor the opposite applies
class DifficultyPresets
{
class CustomDifficulty
{
class Options
{
reducedDamage=0;
groupIndicators=2;
friendlyTags=1;
enemyTags=0;
detectedMines=0;
commands=0;
waypoints=2;
tacticalPing=0;
weaponInfo=2;
stanceIndicator=2;
staminaBar=0;
weaponCrosshair=1;
visionAid=0;
thirdPersonView=1;
cameraShake=0;
scoreTable=1;
deathMessages=1;
vonID=1;
mapContent=1;
mapContentFriendly = 0;
autoReport=0;
multipleSaves=0;
};
aiLevelPreset=1;
};
class CustomAILevel
{
skillAI=0.5;
precisionAI=0.5;
};
};
Still spots civs
Yes, if you look at what I wrote above civs are friendly.
they wont show on the map
They do atm
Oh you mean radio protocol communications ?
did you restart to affect changes?
Yes
Ye if i tp close to them it spots them
if i do hint str (difficultyOption "mapContentFriendly");
it returns 1
is ur custom difficulty selected?
class Missions
{
class Mission_1
{
template = "Altis_LifeDev.Altis";
difficulty = "Custom";
};
};
and i assume ur custom difficulty is in the server profile?
Yes
try putting this in ur server cfg forcedDifficulty="custom";
Ok
are your profiles getting loaded?
๐ค idk then. i dont do difficulties in the profile
class DifficultyPresets
{
class CustomDifficulty
{
class Options
{
is that correct ?
does the profile expect DifficultyPresets instead of CfgDifficultyPresets?
Might do ill try now
@robust hollow CfgDifficultyPresets is used for ingame config value, I mistakenly posted the wrong link
DifficultyPresets is for profiles
ffs :/
weird
just changed
can always just put ur difficulty in ur server mod
How would you do that ?
load a mod with -serverMod, client doesn't required it
you would put ur difficulty in ur servermod config instead of the server profile
class CfgPatches
{
class DanielDifficulties
{
name = "Daniel-Difficulties";
author="Daniel";
weapons[] = { };
units[] = { };
requiredAddons[] = { };
requiredVersion = 1.80;
};
};
class CfgDifficultyPresets
{
/*
Your preset here
*/
};
*class CfgDifficultyPresets

๐คฆ god damn it midnight
ยฏ_(ใ)_/ยฏ
๐
if i disable mapcontent then it returns mapcontentfriendly at 0
but also disables player marker
well yea... it removes all friendly markers?
So how would you make it so it would only show player makers ๐ฆ or isnt that possible with cfgDifficulty?
not possible. you could disable it in difficulty then script ur own in to replace what you wanted to keep
i tried doing that with draw3d but didnt like that
because you need to use draw on a map?
No just wanted seperate colors for different factions on map marker but the first faction you joined sticked with u until you restarted your game
well... i feel like that is an issue with the way it was written ๐ค
hmmmmยจ
most likely ๐
switch (playerSide) do
{
case west:
{
findDisplay 12 displayCtrl 51 ctrlAddEventHandler ["Draw",
{
player drawIcon
[
"iconman",
[0,0.3,0.6,1],
getPos player,
24,
24,
getDir player,
"",
1,
0.03,
"TahomaB",
"right"
]
}];
};
case civilian:
{
findDisplay 12 displayCtrl 51 ctrlAddEventHandler ["Draw",
{
player drawIcon
[
"iconman",
[0.4,0,0.5,1],
getPos player,
24,
24,
getDir player,
"",
1,
0.03,
"TahomaB",
"right"
]
}];
};
};
in initPlayerLocal.sqf
well wut teh fuk. player drawIcon
ohh dw that was just me being retarded, it originally had
_this select 0
i would hope so ๐
๐ Trying to learn by breaking it i guess (;
/*
Author: Midnight
Description: Event handler that executes code when given unit is able to see an enemy
Parameters:
0 - OBJET: Unit to add event handler on
1 - CODE: Code to execute when unit sees enemy (passed paramms: added unit, unit the unit can see)
2 - CODE: (Alternative code), called when unit cannot see any other units
*/
_this spawn
{
params
[
["_unit",objNull,[objNull]],
["_code",{},[{}]],
["_altCode",{},[{}]]
];
while{alive _unit} do
{
{
_cansee = [objNull, "VIEW"] checkVisibility [eyePos _x,eyePos _unit];
if(_cansee == 1) then
{
[_unit,_x] call _code;
} else {
[_unit] call _altCode;
};
} forEach (allUnits - [player]);
sleep 0.3;
};
};
Why exactly is there a constant activation for vision on the units?
_canSee is always 1
Tried GEO Lod (just for shits and giggles), VIEW lod obviously doesn't work for whatever reason.
Oh I am so dumb

(allUnits - [player]) whilst testing with local player
Ok. nevermind. It still does it
_this spawn
{
params
[
["_unit",objNull,[objNull]],
["_code",{},[{}]],
["_altCode",{},[{}]],
["_randomExecution",false,[false]],
["_chance",100,[0]]
];
while{alive _unit} do
{
{
_cansee = [objNull, "VIEW"] checkVisibility [eyePos _x,eyePos _unit];
if(_canSee == 1) then
{
if(_randomExecution) then
{
if((random 100) <= _chance) then
{
[_unit,_x] call _code;
};
} else {
[_unit,_x] call _code;
};
} else {
[_unit,_x] call _altCode;
};
} forEach allUnits;
}
can someone help me with this j trying to make a esimple map esp for myself
private _markers = [];
private _units = [];
forEach(allUnits); {
_marker = createMarkerLocal[format["%1_marker", _x], visiblePositionASL _x];
_marker setMarkerColorLocal "ColorWhite";
_marker setMarkerTypeLocal "Mil_dot";
_marker setMarkerTextLocal format["%1", name _x];
_markers set[count _markers, [_marker, _x]];
}
foreach _units;
while {
visibleMap
}
do {
{
private["_marker", "_unit"];
_marker = _x select 0;
_unit = _x select 1;
if (!isNil "_unit") then {
if (!isNull _unit) then {
_marker setMarkerPosLocal(visiblePositionASL _unit);
};
};
}
foreach _markers;
if (!visibleMap) exitWith {};
uiSleep 0.02;
}; {
deleteMarkerLocal(_x select 0);
}
foreach _markers;
_markers = [];
_units = [];
};
brand new to this stuff j trying to fuck around and see wat i can do:)
better off using draw event. no hassle creating and deleting markers when players join or leave
Hi, How do you call function with argument in SQF? I'm a python/Java programmer but I can't see to under stand how they are called. Some funtions are called wiuth the arguments pre fuction call and some post. Whats the difference?
what do you mean by pre and post?
its just <args> call {code}
<args> being anything or nothing in some cases.
could it also be <args> call function_name?
its the same thing. function_name refers to a code variable
like an anonymous function?
what?
@sinful flame yes
what sqf code can be run as part of config definitions?
color[] = {"(profilenamespace getvariable ['IGUI_TEXT_RGB_R',0])","(profilenamespace getvariable ['IGUI_TEXT_RGB_G',1])","(profilenamespace getvariable ['IGUI_TEXT_RGB_B',1])","(profilenamespace getvariable ['IGUI_TEXT_RGB_A',0.8])"};
x = "(profilenamespace getvariable [""IGUI_GRID_CUSTOMINFOLEFT_X"", (safezoneX + 0.5 * (((safezoneW / safezoneH) min 1.2) / 40))])";
@robust hollow did you do tests yourself yet?
an be run as part of config definitions That cannot be said definitely for all config entries
some are evaluated by the config evaluator (which is limited). Some are just passed as strings to SQF scripts, which then evaluate them on their own. These can ofc execute any code they want, even access local variables.
i cant say ive tested everything, but back in my earlier days i did some real stupid shit in those ui properties calling functions and commands.
would diag_log work everywhere or only in specific game/simulation "phases"?
like one thing i would love to do is the make the default difficulty based on SP or MP env
(cfgDifficulties)
I looked into what commands work in configs recently. Don't think I wrote it down tho
Ah no, that was serverside script. Not config
can you use a semi colon as part of the code?
sure
wouldnt this allow to inject new config parameters?
huh?
no
the script is called from a parameter. So don't see how you could inject new ones
x = "(profilenamespace getvariable [""IGUI_GRID_CUSTOMINFOLEFT_X"", (safezoneX + 0.5 * (((safezoneW / safezoneH) min 1.2) / 40))])";
IGUI_GRID_CUSTOMINFOLEFT_X = "'10;'; x2 = ";
sth along these lines
no
It obviously expects that script to return a number
you'd just make it return a string instead and kill the script that's executing that
syntax errors aside ofc
the config parser is not as script with string vs number
and it may not even apply for such script injected values?
huh? yes it is. string and number are different things in the config parser
text = 5; and text = "5";
Correct. This is a piece of string that's evaluated in a SQF script somewhere. The config parser doesn't care what it returns, for it it's just a string with whatever content
or x = 5; and x = "5 * 4711";
that is not the config parser
that is getNumber script command and engine side command having special implementations for when they are given a string
well you can/will break various stuff. yet would it even accept such code via pNS return?
like it would be a cool way to implement some features/configuration for config based stuff
but needs to be secure against abuse
I don't know whether the config evaluator does. But afaik the stuff you posted above is executed from a script
Best way would be to just try it out.
class CfgWeapons
{
class Default
{
// opticsZoomMin = 0.25;
opticsZoomInit = "(profileNamespace getVariable ['TEST_OPTICSZOOMINIT',0.75])";```
like this works
even without game start
dont quite remember as i tested it some weeks ago, but not even mission restart needed
but only read again when used
ie weapon change back and forth
Some entries will be cached, and you'd have to somehow get them out of the cache.
Which ones are cached, the engine doesn't tell you
the caching is not random though, is it? aka based on preloading defined in configs and some engine internal defined behavior, isnt it?
some engine internal behaviour
if i have an array with classnames but im to lazy to add the "" brackets around each one, can i do something like the {doStuff "_x"} foreach _array?
basically add the brackets around the variable?
is there no workaround?
chances are: nobody has any clue what you are talking about
if you got an array with classnames, then you already have an array full of classname strings thus adding another paranthesis makes no sense
no there isn't
You can't just grossly violate the syntax of a language and say "I'll just put a piece of cake into these gears and hope it will still turn"
you sound salty today @still forum
are you okay?
^
x39 i want to automatically add bracktes around array positions bc im to lazy to do it by hand.
that makes no real sense
at least to me
your input array? ["foobar", "barfoo", "anotherfoo"] and you now wnat to get a set of brackets around it or what?
the thing is if you use rightclick get classnames in the editor you get the names but in the script they need to have brackets around them
_stuff =
[BWA3_optic_EOTech,
bwa3_optic_compm2, //Aimpoint normal
bwa3_optic_microt2, //Aimpoint Micro
bwa3_optic_eotech552, //EoTech lang
bwa3_optic_eotech_mag_off, //EoTech vergrรถรerung
bwa3_optic_rsas , //Reddot
bwa3_optic_zo4x30,
bwa3_optic_zo4x30_microt2,
bwa3_optic_zo4x30_rsas,
bwa3_optic_zo4x30i,
bwa3_optic_zo4x30i_microt2,
bwa3_optic_zo4x30i_rsas];
{_crate addItemCargo ["_x",5];} foreach _stuff;
that is the basic thing.
doesnt work tho
then dedmen is right
As I said. No.
The layout is already perfect to just ALT+Drag select and then add a quote
now thats a nice feature i diidnt know about
thanks a lot
Still gonna try to get automatic bracktes
_stuff = [a,b,c];
_stuffBracket = [];
for "_i" from 0 to count _stuff do
{
_tempstring = str _stuff select _i;
_stuffBracket pushback _tempstring;
};
that should do it
Still gonna try to get automatic bracktes no.
why not? the "str" command does exactly that
No. It doesn't
what does it do then
It turns the content of a variable into a string
Converts any value into a string by placing " and " around the argument - quote BI website
you are trying to get the name of a non-existent variable. Out of it's content
You have a bag of air, and are trying to turn it into a cake
i take the value of the array at each position, turn it into a string and add it to a new array.
i turn air into "air"
no you don't
I don't know how else to explain
You simply don't understand how strings work
i take the value of the array at each position Yes. And the value you get will be any
how do you turn any which means (this value does not exist)
back into the string "a" that it came from? Right. You can't
not sure what you are talking about. i select the position "_i" from the string.
I might aswell just give up now.
It's simply not possible.
_stuff = [1,1,1];
hint str _stuff;
_stuffBracket = [];
for "_i" from 0 to ((count _stuff) - 1) do
{
hint str _i;
_tempstring = _stuff select _i;
_tempstring = str _tempstring;
_stuffBracket pushback _tempstring;
};
hint str _stuffBracket;
it works.
there is a major difference between a variable and a value dude
_a = 1;
diag_log str _a; // <-- "1", not "_a"```
ah wait you re righ tlol
cant just throw in classnames in the array since it will try to read them as variables
Well it does work for numbers so theres that
Sorry for bringing up your blood pressure @still forum
im still learning so dont get mad ๐ฌ
There is a preprocessor command # that adds " " around whatever you pass to it, is it what you were looking for?
#define STRINGIFY(s) #s
STRINGIFY(makeItAstringForMe) -> "makeItAstringForMe"
that sounds good
Then you still need to add preprocessor command everywhere ๐ to every line of yours and add () brackets around items, so it's pointless
cant just throw in classnames in the array since it will try to read them as variables NO SHIT
hey be nice i dont have a programming background and forgot about that ๐ฌ
Nothing to do with programming background
actually, it has
or more: with the memory model you have in your brain
Hello all. I was looking at the support modules. Transport virtual. Is there anyway to delete the vehicle as it spawns unless a variable is true?
Hello everyone.
I'm running into a issue (very new to scripting)
Trying to get a radio object to play audio after a interaction is done with it.
h1 addAction ["Put in casette tape", {h1 say3D "music1", 30, 1}];
h1 is the name of my radio and music1 is the name of the audio I want to play.
Using a .ogg as sound btw
"music1", 30, 1 that looks wrong
what's that supposed to be?
comma's outside of arrays == you are doing something wrong
Did you put it into CfgSounds?
30 is supposed to be the range you can hear it in
1 is supposed to be the deformation (default) of audio
^ That's not how that works
class CfgSounds
{
sounds[] = {};
class music1
{
name = "music1";
sound[] = {"\sounds\Srpska.ogg", 300, 1};
titles[] = {0,""};
};
};
That's my description.ext
"300" is volume, 300 seems wrong there.
Distance is the 4th parameter, not the second
I followed a shitty guide with a Stephen Hawking google translate voice explaining it.
Can't get the radio to play sound.
The addaction for Put in casette tape works but it has no result, doesn't play the audio after
i've been struggling with this for over 3 hours for no reason
Other than I'm very shit and have no clue
Holy shit it works
Hey guys. So I was wondering if I could get someone to tell me where I am going wrong here. Basically I have an intro.sqf being called by init.sqf along with some other scripts (unitPlay for the intro) where the intro is essentially a black screen showing some credits and then it fades into the players view as they do a helo insert into the AO. Anyways. I THOUGHT I properly handled when it gets to the "STARRING" part and listing off each players name in each role, but after testing while hosting an MP instance last night, I seem to be very mistaken. So for that specific piece in Intro.sqf I have
justPlayers = allPlayers - entities "HeadlessClient_F";
...code between doing title screens...
{
_name = name _x;
_role = roleDescription _x;
_nameRole = _name +" as "+ _role;
titleText [_nameRole, "plain", 2]; sleep 2; titleFadeOut 1; sleep 2;
} forEach justPlayers;
And it only is showing whoever the player is that joins and I am not sure why, because according to the documentation allPlayers should get an array of ALL players connected. Im thinking this is maybe because allPlayers needs to be run on the Server only and then grabbed by each script on the client that is joined? But I am not for sure.
is maybe because allPlayers needs to be run on the Server only and then grabbed by each script on the client that is joined no
should work
Wondering if anyone could properly steer me in the direction of not being a moron.
have you tried logging what's inside justPlayers?
Actually no. I should have. I was really tired last night when I was looking at it and didn't even thing to look at it. You're talking checking it via the debug menu? Or another way?
doesn't matter what way
Kk ill try that. I'll have to get a small group together to test it with me otherwise Im going to see what I expect which would be just myself lol. I'll try and do that and see what I turn up.
Is there a way to remove my addAction after its been activated once?
Yeah you have action Id passed to the code as _this select 2
So removeAction and itโll be gone for every player?
Donโt want 7 players activating the action at once so it plays 7 times
No for the player who activated action
Any way possible I could the action for everyone after one activation?
Yes but will be difficult
Would be easier to just put a variable in condition and publicVariable it false
This is my 2nd time trying something like this.
What would the line be for doing something like that?
Or a cooldown on activation?
So you can use the addAction again after x amount of time to replay the audio
If you want cool down you just broadcast future time you want action to be available again
And condition will be something like this "serverTime > actionAvailableTime"
And after anyone executed action you do this actionAvailableTime = serverTime + 60; publicVariable "actionAvailableTime";
And in init.sqf you put actionAvailableTime = 0;
So this will set condition false and action disappear for everyone and after 60 seconds appear again
Wow I am a moron. Thanks for the help @still forum its because I hosted it as a player. I skipped right over the part saying in player hosted game it may not get properly filled out and to use a specific function instead.
@tough abyss so it'd be like this?
actionAvailableTime = serverTime + 60; publicVariable "actionAvailableTime";```
ywes
Radio works for some reason though
and it fades when you walk away from more than 25m
So I could just delete it and it'll remain the same?
Alright I removed it
i cant seem to find what to use to determine the free "inventory" or cargo of a crate/car/etc. i dont want to overload it via script. what command do i use?
when adding stuff via addItemCargo
exactly what i was looking for thanks @ruby breach
@silver linden no. You are executing public variable in the wrong scope. I think you donโt really understand what {} means or just donโt bother reading wiki, which is it?
Literally no clue what I'm doing
Read wiki tho
Wiki tells you where to put condition, you donโt have it at all. Stop copying crap you find on the internet and read wiki
Wiki has explanation of every single param in addAction and what it does
Trust me, you want to know how addAction works and not guess
Read wiki
Dedmen made it to moderator? Everybody RUUUUN!
loads the machinegun
๐
๐
ho-lee-scheisse!
@silver linden what did you want to do with the AddAction?
Evening everyone. Is there a way to activate some code once multiple waypoints are complete?
EG - Once four units have moved to designated positions making all four waypoints complete, "this disableAI "MOVE";"
double click on code, you can either run code from there or activate a condition
double click on Waypoint*
There are four different waypoints is what I'm saying - sorry if I was unclear
so only if all are complete, the code should run?
there are no dumb questions
im no expert, if all waqypoints are from one unit, you can use the last one
if they are for different units, i would active a different condition with each waypoint and if all are true, execute the code
in the waypoint init on activation for eaxmple: waypoint1Active = true; etc for the other waypoints, in the code: if (waypoint1Active && waypoint2active && waypoint3active && waypoint5active) then {yourcodehere};
Would the code just be in a trigger?
well it doesnt really matter where you run the code from
and yes you can put the code in a trigger and put waypoint1active && waypoint2active ... in the condition
Where would I put the code though? Like, where would I physically type it
what kind of code is it, what is it supposed to do
either in an init of any object in eden editor, or in a texteditor program like notepad ++ or poseidon and save it as .sqf
So basically, once four waypoints are complete, the code I was to activate is:
car1 forceSpeed 50;
ah put it in the car preferably
but if your car has the variablename "car1" you can run it from anywhere.
an idea would be to give the car a waypoint and in the waypoint parameter conditions you put waypoint1active etc, in the waypoint init you put car1 forcespeed 50;
so the cars waypoint gets actived when the other waypoints are complete
https://community.bistudio.com/wiki/BIS_fnc_lerpVector
https://imgur.com/a/tdZPcr9
"Given two different vectors A and B, think of a straight line drawn between them"
But the line is following the terrain hill, i need a stright line if possible, is this intended ?
for [{_i=0}, {_i < 1.01}, {_i=_i+0.01}] do
{
_v = [getpos a,getpos b,_i] call BIS_fnc_lerpVector;
_a = "Sign_Arrow_Pink_F" createVehicle _v;
_a setposAsl _v;
};
you are using nonASL for the lerp, and ASL for the vehicle
use ASL for the getPos too
same line only with offset now
https://imgur.com/a/0ezOhuR
after restarting it worked somehow
got another problem, how do i spawn cetrain crates without having vanilla stuff automatically added to them? clearItemCargo and clearItemCargoGlobal has no effect.
especially this one B_CargoNet_01_ammo_F
restartet now the line is perfectly
https://i.imgur.com/J79R1On.jpg
@still forum it does clear the cargo now, although the canAdd still returns false. wierd, gonna use a different crate
you check the crate for canAdd ?
i made a mistake, had a faulty array
yes @radiant egret i put ammo from an array into the crate, if its full it spawns the next crate, fills that etc
until its done
how do i pass a variable to an ace addAction function? https://ace3mod.com/wiki/framework/interactionMenu-framework.html
i do see the params but i dont get where i have to define them to get them inside the function
Right now its like that, but it only returns caller and target, not the params tho
_params = _x;
_statement = {params ["_target", "_player", "_params"];
titleText ["Ausrรผstung ausgegeben","PLAIN"]; titleFadeOut 1;
[_this] execVM "L917\Ausruestung\Loadouts\Zinnsoldaten\BW_AFGHANISTAN\DynLoadout.sqf";
};
////////////////////AKTIONSSCRIPT DEFINIEREN, benennen
_aktion = ["EL_Trop_TL_416_IDZ",_Weaponname,"",_statement
,{true}] call ace_interact_menu_fnc_createAction;
_x is from a foreach command. I need to get _x into the script im executing but i cant seem to get it to work
Is sqf object orientated? what languges are similar?
imo javascript
Hmmm okay thanks. As in does it use JSON type objects? or just in the way you access methods? or both?
Neither
I said javascript mainly cause 1) js was my first scripting language and 2) scripting langs are kind of similar
Not object oriented, not like JavaScript.
more like a non-strictly typed bastardization of C with custom operators
It is pretty strong typed
Am creating a vehicle with
_vehicle = _classname createVehicle (_unit modelToWorld [0,20,0]), [], 0, "NONE";
Would like that the vehicle faces the same direction as the player does when the vehicle creation happens.
Tried
_classname setDir (getDir _unit);
but getting Error Generic in expression
Would need to be _vehicle setDir......
how to change a vehicles main weapon to something else? Ex. I am trying to change the vanilla bearcat from the 12.7 that its currently at to a modded weapon
RemoveWeaponTurret and addWeaponTurret commands
and LoadMagazine commands?
Possibly yes
thanks
alright well I am still having trouble with this
This is what I got:
this setObjectTexture [0, "apc2.jpg"];
this setObjectTexture [2, "turr.jpg"];
this setObjectTexture [1, "notturr.jpg"];
this removeWeaponTurret [m2, [0]];
this addWeaponTurret [Z6_Rotary_Blaster, [0]];
this loadMagazine [[0],"z6_laser","600Rnd_Z6_RotaryBlaster_Magazine"];
And what would be the problem?
It not changing let alone making the gun unable to fire. Shoulda mentioned that
My b
but ace and star wars mods are loaded. Ive been working on this for a while before I found this discord online
Does it give any errors or do any part of it work?
Have you tried each command in the ingame debug console separately?
The textures work but outside of that nothin
Like give the vehicle a name and use that instead of this
Ive been placing all of them directly into the init in the vechicle
Well go test them in live and see which ones work. If they don't read the commands wiki entry to see if you have made a typo
Aight
@young current Indeed it was _vehicle instead of _classname. Silly me. Thank You for the help and also for the quick reply!
๐
It says: Error type Any, expected string
Did you try just single command and if you did which one?
Paste it pls
apc removeWeaponTurret [m2, [0]];
The m2 has to be "m2"
ahh
Usually all names have to be string
I recommend y you check the scripting commands wiki again for the rest too
Thanks
@forest ore your createVehicle syntax is wrong, the last 3 params are just ignored
Yes
True since I'm not using them any way. The special parameter "NONE" is probably that by default(?)
No your syntax is wrong, these params are not even read
What is the correct way?
My guess is that I'm using this one _veh = createVehicle ["ah1w", position player, [], 0, "FLY"];
aaand I personally can't tell the difference between that and the version I'm using
I feel sorry for you
Thanks, I guess
So far the script has worked well enough so haven't really noticed anything being wrong
_vehicle = createVehicle [_classname, (_unit modelToWorld [0,20,0]), [], 0, "NONE"];
Any better?
You missed comma
True. And messed too ๐
That is correct syntax
Still both the versions work so, I don't know what to ask.. Is there some drawbacks in the version I have?
For once, the drawback is that what you think is happening is not actually what is happening
If you are ok with that then who am I to tell you otherwise
_a = 10, 20, "123", true;
All valid
But what is the value of _a?
Nothing?
It is 10
And the rest is ignored
Just like in your usage of createVehicle
And no errors
Because it is valid sqf
Will change the script to use correct syntax. Thanks for notifying me
NP
[1,2,3] apply { if (_x == 3) exitWith {"Test"}; _x }; // Returns "Test" instead of any array
๐ค not what I expected ... (kinda did tho)
I know item size is kinda abstract, but is there a better way to check how much items i can put in a crate then the canAdd way? check in advance to determine if i need a bigger crate.
read from config how much space the crate has. And then check the size for all the items you want to add
how much space item needs is in it's ItemInfo class the "mass" entry. For crates I dunno
a lot of weapons dont have real mass entrys afaik but ill check it out thanks
all of them have to have them
Hi, please help. I'm dumb ๐ .
Thats the error.
15:14:57 Error in expression <
temp_medical = [];
temp_player = [];
onEachFrame {
{
_playeruid = getPlayerUI>
15:14:57 Error position: <onEachFrame {
{
_playeruid = getPlayerUI>
15:14:57 Error Generic error in expression
15:14:57 File mpmissions\sk3yn3t_db_dev_ace.VR\initServer.sqf, line 21
Thats the code. It begins with Line 19
temp_medical = []; //[[playeruid,[0,0,0,0,0,0]],[playeruid,[0,0,0,0,0,0]],[playeruid,[0,0,0,0,0,0]]]
temp_player = []; //[playeruid,playeruid,,playeruid,]
onEachFrame {
{
_playeruid = getPlayerUID _x;
_medical_status = _x getVariable "ace_medical_bodypartstatus";
if !(playeruid in temp_medical) then { //Wenn spieler in temp_medical nicht zu finden ist
temp_medical append [_playeruid, _medical_status];
temp_player append [_playeruid];
} else { //Wenn spieler in temp_medical zu finden ist
array_id = temp_medical find _playeruid;
old_medical_status = temp_medical select array_id select 1;
if !(old_medical_status isEqualTo _medical_status) then {
//Update die Datenbank und das Temp
//array neu einspeisen
_del = deleteAt temp_medical array_id; //_del gibt das gelรถschte Array wieder
_del2 = deleteAt temp_player array_id; //_del2 gibt das gelรถschte Array wieder
temp_medical append [_playeruid, _medical_status];
temp_player append [_playeruid];
//Datenbankupdate durchfรผhren
["sk3yn3t_log_medical_status", [_x, _playeruid, _medical_status]] call CBA_fnc_localEvent;
};
};
} forEach allPlayers - entities "HeadlessClient_F";
};
I cant see my mistake ๐ฆ .
i've already change playeruid and medical_status to private with underscore
to private with underscore That's not private, that's local
why are you using the bad onEachFrame of which only one can exist at a certain time
temp_player append [_playeruid];
pushBack
It says the error is before the onEachFrame. But I don't see it.
The command is UID
it's not displayed in the error message because it's not erroring on that
//[[playeruid,[0,0,0,0,0,0]],[playeruid,[0,0,0,0,0,0]],[playeruid,[0,0,0,0,0,0]]]
Your comment says one thing. What you are doing says a different thing.
Comment says [[player,stuff],[player,stuff],[player,stuff]]
But you are doing
[player,stuff,player,stuff,player,stuff]
you probably wanted to use pushBack in there too
Also using CBA hashes could make this alot easier
And don't use onEachFrame. Use the eachFrame mission eventhandler, and call a function from CfgFunctions. You are recompiling your code every frame
in short: Stop doing shit with arma?! ๐
yep
yeah ok and thx
It says the error is before the onEachFrame or in it. if !(playeruid in... playeruid undefined most likely
wow thx oO
okey i changed to eachFrame mission eventhandler. CBA Hashes, not at this moment. Later maybe. Changed from append to pusback.
Thats on of that Moments i could delete Arma.
Does anyone know why i suddenly can't see scripted map markers on the gps? It used to work fine but somehow it broke in the last 5 months?
Hello, i have make this and that's work:
if !(isServer) exitwith {};
_spawn_pos = ["markerb_1","markerb_2","markerb_3","markerb_4"] call BIS_fnc_selectRandom;
"blue_flag" setMarkerPos getMarkerPos _spawn_pos;
if (side player == blufor) then {
player setPos (getMarkerPos "blue_flag" )};
But if y want IA bluefor at this spawn?
this work only for player
"IA blufor" ?
What do i do to check if a variable has been defined yet? i used that, but it doesnt work
waitUntil !(IRON_Equip_WeaponArray == nil);
workaround is: waitUntil {time > 30}; so the init has time to finish but its a dirty workaround.
@still forum
63/5000
Do I have to do something special for the EventHandler to start?
i put it in initServer.sqf but nothing happens -.-
no
okey, forEach needs time ....
Hi currently i am pulling alot of prices from a config, but the rank check comes in a string, how would i make it so it would be formatted to be used in a if statement?
getText
How would i use that on a string like "rank < 5"
because it gets pulled like this
_rankCheckString = (_unfilteredUniformCop select _itemLocation) select 3;
and _rankCheckString returns "Coplevel >=5", but i cant use that in a if (_rankCheckString)
I've learned Local Variables are (_variable). But what means arma with: Error Local variable in global space WITHOUT ANY FUCKING LOCAL VAR in my script ...
where does it print that? editor script box?
nope, rpt
where is the script it prints that for
it's either local variable where only globals are allowed, or other way around
private ["temp_medical","temp_player","a>
18:36:35 Error position: <private ["temp_medical","temp_player","a>
18:36:35 Error Local variable in global space
18:36:35 File mpmissions\sk3yn3t_db_dev_ace.VR\initServer.sqf, line 2
private ["temp_medical","temp_player","array_id","oldmedical_status","medical_status","playeruid"];
....
if !(oldmedical_status isEqualTo medical_status) then {
//Update die Datenbank und das Temp
//array neu einspeisen
//_del = deleteAt temp_medical array_id; //del gibt das gelรถschte Array wieder
//del2 = deleteAt temp_player array_id; //del2 gibt das gelรถschte Array wieder
temp_medical pushBack [playeruid, medical_status];
//temp_player pushBackUnique playeruid;
//Datenbankupdate durchfรผhren
diag_log format ["oldmedical_status verรคndert"];
//["sk3yn3t_logmedical_status", [_x, playeruid, medical_status]] call CBA_fnc_localEvent;
} else { diag_log format ["oldmedical_status unverรคndert"]; };
};
} forEach allPlayers - entities "HeadlessClient_F";
}];
Wtf
yeah..
You can only private local variables
private'ing global variables is nonsense
okey, give me a sec
also don't use private array unless you really have to
Nerds
okey, private only on _var
yes
i deleted my private line
yeah Arma ... be more retarded ... thats was my first idea .... thanks dedmen โค
2 hours for nothing ...
i hate this game
18:50:12 Error in expression <cal_status = [];
addMissionEventHandler ["EachFrame", {
{
playeruid = getPl>
18:50:12 Error position: <["EachFrame", {
{
playeruid = getPl>
18:50:12 Error Generic error in expression
18:50:12 File mpmissions\sk3yn3t_db_dev_ace.VR\initServer.sqf, line 5
temp_medical = []; //[[playeruid,[0,0,0,0,0,0]],[playeruid,[0,0,0,0,0,0]],[playeruid,[0,0,0,0,0,0]]]
temp_player = []; //[playeruid,playeruid,,playeruid,]
oldmedical_status = [];
addMissionEventHandler ["EachFrame", {
// no params
//diag_log "EachFrame";
generic error? The code looks to be correct though. You are having some really weird problems ๐
playeruid should probably not be a global variable
is it playeruid = getPlayerUID _x;
It says the error is before the ["EachFrame but I don't see anything wrong there
i've deleted the // from this only
//del = deleteAt temp_medical array_id; //del gibt das gelรถschte Array wieder
//del2 = deleteAt temp_player array_id; //del2 gibt das gelรถschte Array wieder
temp_medical pushBack [playeruid, medical_status];
//temp_player pushBackUnique playeruid;
trasformed tooooooooo
del = deleteAt temp_medical array_id; //del gibt das gelรถschte Array wieder
del2 = deleteAt temp_player array_id; //del2 gibt das gelรถschte Array wieder
temp_medical pushBack [playeruid, medical_status];
temp_player pushBackUnique playeruid;
del isnt _del
you should learn the difference between local and global variables. And where to use which
deleteAt temp_medical array_id That is invalid.
That's not how deleteAt works
oh
Rawrma
Awrma, y u no wanna ๐โโ๏ธ ?!??
i work on it since 11 hour. sry
any suggestion on how i can put in an OR condition?
waitUntil {(((getposATL _Cargo select 2) <= 2) or ((velocity _cargo select 2) =< -3))};
didn't you already put that into a or condition?
yes but it doesnt work
BI website says the code inside waituntil {} must return true
jup
yes "smaller or equal" not "equal or smaller"
This memory leak associated with compiling scripts, is an inline definition of code to spawn going to add to it?
_str Spawn {Sleep 1; Hint _this ;};
IIRC compiling random code adds to it
So static code shouldn't ๐คท but Dedmen knows better ๐
so i guess that would mean lazy condition evaluation also if (something and {something_else}) then ...
@cursive whale yes
The script file that contains your spawn statement will be cached forever
So yes. That spawn is also part of cached/leaked code
every piece of compiled code is cached, no exceptions
so if you can run it, and it's not SQS, then it's cached
But calling this code repeatedly won't cause RAM to increase, I think Defunkt means that?
no it won't
there is always only one instance
The bug is fixed in next arma update anyway, so doesn't really matter anymore
right but (in my example) the caching cost is based on the number of times the whole script is compiled not each time that fragment is called?
is based on the number of times the whole script is compiled no
compiled once, or compiled a million times, there is only one copy of the script in the cache.
not each time that fragment is called There is nothing being compiled when you just call a pre-compiled function
hmm... then that doesn't sound like a huge problem for scripts that have an ongoing use, it's more of an issue for use of compile to parse string data, yes?
yes
the issue is things that are compiled once and not reused. Anything that is "parsed" by using call compile
Though that also applies to anything CfgFunctions, as they are usually only compiled once. No reason to keep them in cache
The only things that benefit from the cache is code that is continously re-compiled. But if you are doing that, you are probably doing something wrong.
thanks. out of interest, presumably those CfgFunctions have to be stored in compiled form somewhere, so what is wrong with the engine caching them (assuming that's where they're retrieved/executed from when needed)?
assuming that's where they're retrieved/executed from when needed They aren't
While the functions exist and are used it's not a problem. But what if they are from a Mission's CfgFunctions, once you exit the mission and start a different mission they should be gone from memory, but they won't be.
right, you'd have thought it would be fairly simple (and fundamental to good memory management) to tag cache entries such that they can be purged based on origin (game, mod, mission).
That is actually TOTALLY not the case and would be very hard to implement
My idea was a timed cache, aka scripts that weren't accessed for 20 minutes will be removed from the cache
that would fix the leak problem basically. Not short term, but long term.
Or maybe some cache with fixed amount of entries? So the more often accessed stuff gets to the front of the array (sort of)? And the one which gets out of the array gets away to be replaced by something else
when you say it's fixed in the next update, is that the forceDisableCache option or something newer/better?
cache has been removed
So every time I start my mission in editor it will be recompiling everything instead of grabbing it from cache? ๐ฎ
no.
also, define your array first, it will be more readable
_myArray = (โฆ);
{ code } forEach _myArray;
see https://community.bistudio.com/wiki/Code_Optimisation#Rules for guidelines and rules of thumb
Here's the thread.
@winter rose The array is defined in another file. _x is from select expression, not forEach.
I'm so confused. My brain needs rest ๐
forEach (if ( nope, nope and nope
readability
Readability is the last of my concerns.
don't complicate it: understand what you work with, don't oneline too much
Getting it working is first priority.
Aaand here is why your brain is overloaded
๐
sorry not sure where to post this but how do you set a serpa holster point on a chestrig so holstered pistols stay in the holster
Maybe you can't read it but I can. The question isn't about readability anyway.
I actually think the issue is with the select expression and the actual keyword, the messagesArr contains "Log", "Warning", etc where as the listbox contains other values ```SQF
} forEach
[
"Show All",
"Show Only Information",
"Show Only Logs",
"Show Only Warnings"
];
Fixed it, Just as I thought ^^ - Guess my brain wasn't overloaded after all. So much for your readability concern so early on. Now that it works, I will make it more readable though tbh. It is only for my eyes really and I can read it. Thanks anyway! ๐
Whatever floats your code! Good luck though
Already fixed it.
private _pos = getPosATL _obj;
_obj enableSimulation false;
.. stuff happens here
_obj setPosATL _pos;
_obj enableSimulation true;
My _obj doesn't get restored to the same place, why is this? Kind of looks like being on a slope affects it a lot, can I do something about this?
Is it possible to change the amount of armor a vehicle has in a script?
@ebon ridge It's worth to getVectorDIrAndUp and setVectorDirAndUp probably
And maybe getPosWorld and setPosWorld... other set/getPos... are confusing in terms of measuring position above ground, but ...world is quite straight ๐คท
@young current What do you mean by handels damage?
@orchid nebula HandleDamage event handler
You can do custom damage processing there and return a custom number of how much damange your vehicle will receive instead of the standard amount of damage
๐จ
well... look for addEventHandler command on wiki, then check the HandleDamage event handler
aight
private _light = "#lightpoint" createVehicle [0,0,0];
_light setLightBrightness 1;
_light setLightUseFlare true;
_light setLightFlareSize 2;
_light setLightFlareMaxDistance 60;
_light setLightAmbient [1.0, 0.0, 1.0];
_light setLightColor [1.0, 0.0, 1.0];
_light lightAttachObject [cursorObject, [1,1,1]];
Any ideas why this appears to have no effect at all?
I see no lighting change
js_jc_fa18_wingtipAoA_right setParticleParams [["\A3\data_f\ParticleEffects\Universal\Universal",16,12,16, 0],
"", "Billboard", 1, 0.4,
[0, 0, 0],
[0, 0, 0], 1, 2, 1.5, 0.18,
[0.28],
[[0.8,0.8,0.8,0.7]],
[2,1], 0.1, 0.5, "", "",
_object];
Why my particles have this color in middle?
https://imgur.com/pGCSjTC
@ebon ridge are you actually looking at an object for it to attach to? also is it day or night? works for me a night.
Yeah I'm looking at object, it is bright day time though. Was hoping a 1 intensity light that is weird color would be obvious regardless...
I will try at night instead thanks
you can use setLightDayLight to help it show during the day. it isnt as strong as it is at night, but that is to be expected.
Is there any use of '#'in variable names? _module setVariable ["#active",_activated];
yes, BI does it in a fair few modules, most likely elsewhere too.
But its nothing special then?
afaik its no different any other variable.
Is there something similar to sourceAddress = "loop"; for Class MFD? I'm trying to draw MFD altimeter lines.
One should follow the hundreds value only, another thousands, etc.
I need a script that auto magically Kills the player is trying to do a photo shoot and I need dead people.
_unit setdamage 1
Some way to create simpleObject and handle damage on it?
i dont think you can.
Unsupported features include PhysX, damage, AI pathfinding (causes walking through walls), and built in lights.
simpleObjects are usually meant to be static props.
doesnt matter if you cant deal damage to it. just use createvehicle?
createVehicle doesnt fit
I need object that cant be locked (with R or T) and targeted (with 2).
Maybe you know how to avoid targeting on vehicle?
no i dont, however if you use the alt syntax of createSimpleObject you may be able to set the damaged .rvmat to the object to make it appear damaged.
Didnt find a way to appear damaged in alt syntax.
Do you mean BIS_fnc_createSimpleObject?
no. the command
because the alt syntax (using className) is a normal simple object instead of super-simple, so you can set textures to it. I dont know for sure, but i'd assume you can set materials to it too.
Need a sample...
_pos = player getRelPos [10, 0];
_tank = createSimpleObject ["B_APC_Tracked_01_CRV_F", AGLtoASL _pos];
_tank setObjectMaterial[0, "path\to\damaged.rvmat"];
Dont understand why rvmat..
because its a material
for visualization, not for a functionality...
what?
Material determine how to looks a surface and interacts with a light.
yes. and arma uses them to display damage over texture layers. Its how you get things like bullet holes without making ur own bullet hole texture.
I need to register damage on simple object.
Register damage and do actions after it.
I see. Well, I dont know any clean way to do what you need, simple objects dont support damage or eventhandlers (from a quick test).
It is sad, anyway thanks for your time.
if i set one side hostile to itself ( ex east setFriend[east,0] ) is there a way to stop units from attacking squad members?
if i set a variable in a building, and then the building get damaged (not killed) and its model change to a damaged one, the var set on it at the begining continue valid?
Thanks in advance.
@tough abyss yes I think so
@floral spade no, find another way
hello there
so ; can you show us your script and how it fails?
no thats the thing ive not put it in anywhere coz i dont know where it goes
i want to make a radio play a loop of radio chatter that doesnt play to everyone it fades and gets louder deppending on your position on the unsung mod but cannot figure it out
so why not "say"?
myRadioObject say "mySound" should do the trick
like for a person speaking, someone getting closer will hear it better, etc
where do i put that and how do i put the sound i want in the "mysound" bit
yeah that sort of thing
yeah that link means nothing to me where am i looking at what am i looking for haha sorry im very very very new to this
ok ๐ I but I will have access to a computer in an hour or so
Either pm me, have someone else here help or wait a bit, I am on my way!
haha ok ill be here
@winter rose thanks Lou. I added a Killed event handler to a building but when the building get destroyed it not run. This is normal?
I shall check, I am not sure here
@tough abyss try using BuildingChanged?
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers/addMissionEventHandler#BuildingChanged
it seems the original building gets destroyed
im like 90% sure it still exists, just a couple hundred meters underground. the variables do not transfer to the new building but are still accessible on the old one.
Thanks a lot.
Hey guys. How would I broadcast a message to all players on a server?
I tried allPlayers sideChat "Hello";
Didn't work though
RemoteExec
I tried allPlayers sideChat "Hello";
Why did you try this?
That would only display hello on one machine. Use remoteExec as Sparker pointed out.
unless it's executed in i.e. init but yeah, question is about broadcasting so remoteExec indeed seems to be more valid answer
What does _x do?
it is a magic variable used in forEach loops
it can be what ever the current object from the array is that is being process by forEach
{
systemChat _x;
} forEach ["1","asd","test"];
this will output:
1
asd
test
in the chat box
Gotcha, thanks mate
so guys ive got all the bits in place i need to get sound clip working on my mission but it doesnt seem to be working any suggestions on why
class CfgSFX
{
class SfxRadioLoop
{
sound0[] = {"\radio_chatter.ogg", db-10, 1.0, 1000, 0.2, 0, 15, 30};
sounds[] = { sound0 };
empty[] = {"", 0, 0, 0, 0, 0, 0, 0};
};
};
class CfgVehicles
{
class RadioLoop
{
sound = "sfxradioloop";
};
};
sleep 1;
createSoundSource ["RadioLoop", getPos player, [], 0];
and then my sound clip
im very new to this so keep you answers simple haha
it wouldnt work like that if the configs are in the mission? cfgvehicles doesnt work like that.
What is that CfgVehicles stuff? that looks very wrong
Ah you copied that from createSoundSource wiki page.
If you need the CfgVehicles class then you need to add that in a mod, you cannot add to CfgVehicles from description.ext
Although wiki says it works like that.. That's new to me
Why do you name the sound sfxradioloop in the CfgVehicles part, but SfxRadioLoop in CfgSFX?
Why did you change the casing?
You split that stuff up between description.ext and some SQF script right? You pasted everything as one block so I don't know what you did
would you look at that, he got promoted ^^
You are late to the party
the server has become a bit of a "mark as read" server ๐
Is it possiable to use a script that deletes wrekcage if it enters a certain area?
Ik that there are ones that clean up on a time basis but wasnt sure if it could be confined to a certain area using triggers or code
that deletes wrekcage if it enters a certain area
What? Does it delete wrecks that enter certain area?
Anyway, you can delete any object based on any criteria which is computable, so I think answer is yes
Like delete an object if no players are close to it
Hello there, comrades! Does anyone know if there is Killzonekid's makefile_x64 without write permission feature? I need autonomous serverside writing
Sparker has a Intercept based mod for writing to files
thanks. Do you mean this project? https://github.com/Sparker95/ARMA-ofstream
is there any better way to detect that an AI unit spots someone than polling on close units?
i.e. eventhandler?
Sparker has a Intercept based mod for writing to files so when do I want to use it?
@vague hull AFAIK no, but you poll whole group instead of polling a unit, because target knowledge is group based
Also it's worth to poll behavior before doing target query, if you want to wait until your group has spotted enemies it considers as threats, it's much cheaper
@calm bloom It's this addon, yes, however it will also log time like the standard diag_log and insert a newline character at each output as I intended to use it for debug purposes
so it writes line by line?
yes it will write something like 12:35:03 text\n when you ask it to write text
\n is newline character
timestamp is hardcoded?
Yeah but... if you have any C++ knowledge you can disable it... or I can do it. What do you need to write?
maybe I can just make extra commands to configure output formatting per each open file
basicaly i have the dll which does this (line by line wrighting), i was searching for another one to compare the performance
well I flush the output buffer per each line
ive tried the killzonekids makefile, it uses whole file aproach, but its hard to use because it has checkbox with permission
it's standard C++ ofstream class with standard buffer size inside
@astral dawn thanks for the hint
also been diggin a bit deeper.. does anyone know if fsmDanger is still a thing?
duh! yeah right! forgot that one existed ^^
Thanks for the answer and your dll Sparker! Hope it will fit good
Nice!
Make sure you disable battleye by the way
@still forum haha I just copied it as I was given it and all that stuff you just said to me makes no sense haha I havenโt a clue about scripting
hey their Arma Community, I'm looking for someone who I could talk to regarding some ideas me and my unit have. We want to estimate the workload and practicability of our idead, these ideas are scripts along the lines of spyder addons. I hope this is the right channel for this.
@thin pond nope, look into #creators_recruiting
@vague hull thanks alot
When arma 3 launches a mission made by the player in the editor does it seach for a default SQF file name? or does it execute all .sqf file in the directory?
executes init.sqf, initPlayerLocal.sqf, initPlayerServer.sqf, initServer.sqf
though to be clear, it doesnt execute any when you load a mission into editor itself, only if you play the mission.
Thanks ๐
Do you guys think that public variables will cause lag. Say you have 100 vehicles, 40 players. If you set a public variable on 100 vehicles will that cause lag because it needs to stay propogated on all clients?
itl have an impact sure, but it all depends on how much data each variable holds.
100 variables of 10000 character strings will make a bigger dent than 100 variables with a number value. you know?
the network impact being if you update them
Yeah so basically it would be better to have a remote script that checks against the server copy as needed
depends on what ur doing exactly. it can work out that publicvariables are less back and forth over the network (vs a remoteexec ping pong).
Again, it depends. There is no "perfect solution whatever the situation is"
If I've got a licenseplate, with 5 hiddenselections (being the plate number), is there a good way for me to insert text without having to manually setobjecttexture one at a time?
I want to not have to go in and write up 5 lines for each plate of "_this setobjecttexture" but rather be able to just write it in like a text "UTE35" for instance.
if this is some sort of "manual" number plate, then no probably not. if it is a real number plate then https://community.bistudio.com/wiki/setPlateNumber
So you're telling me that arma with its amazing abilities of .sqf cannot do this? I merely used a plate as an example.
I just want to be able to write a text somewhere and have it come out seperated into several hiddenselections without me having to do more
ur setting a texture... that texture file needs to exist somewhere and then u need to write the script (which wouldnt be hard) to pick the texture and the layer it will set to.
Yeah it's the scripting part that I'm curious about
I know I can just do a _this setobjecttexture but in the event that I want it to be more dynamic, can that be done?
yes
arma with its amazing abilities of .sqf will allow you to accomplish this with ease.
as a quick example:
{
_object setObjectTexture [_forEachIndex,format["\path\to\my\image\%1.paa",_x]];
} foreach (_string splitstring "");
takes the input string and uses the image for that character on the layer index it was written in.
Anyone know why this script isnt working:
this disableAI "MOVE"; this addAction ["Secure J. Maxwell-Clark",{_x commandChat "HQ, this is Alpha 1. We have secured the VIP. Requesting extraction. Over."} forEach allPlayers];
Doin my nut in
because ur code isnt in a code block
three `s on each side
{ }
Teach me daddy
{this disableAI "MOVE"; this addAction ["Secure J. Maxwell-Clark",{_x commandChat "HQ, this is Alpha 1. We have secured the VIP. Requesting extraction. Over."} forEach allPlayers];}
''' this addAction ["Secure J. Maxwell-Clark",{_x commandChat "HQ, this is Alpha 1. We have secured the VIP. Requesting extraction. Over."} forEach allPlayers]; '''
tildes ` / ~
this addAction ["Secure J. Maxwell-Clark",{_x commandChat "HQ, this is Alpha 1. We have secured the VIP. Requesting extraction. Over."} forEach allPlayers];
Nice, cheers mate
["Secure J. Maxwell-Clark",{_x commandChat "HQ, this is Alpha 1. We have secured the VIP. Requesting extraction. Over."} forEach allPlayers];
should be
["Secure J. Maxwell-Clark",{{_x commandChat "HQ, this is Alpha 1. We have secured the VIP. Requesting extraction. Over."} forEach allPlayers}];
though ur action will just make all players say that on the person who did the action i think
Oh - I want it to seem like some omnipotent being named "HQ" is saying that - got any hints?
Its cool if not, I can Google
Your correction worked btw, thank you mate
@noble zenith because it needs to stay propogated on all clients? That's not how they work. They don't re-propagate automatically on intervals. They just get sent once.
Yeah I know but I am talking about regular updates
Like it's a vehicle ownership variable so it's changed frequently
@long pewter you want something like
[playerSide,{[_this,"HQ"] commandChat "message"}] remoteExec ["call"]
Vehicle ownership, aka ownerID? That is very small.
Yes you are creating a network packet, but if the vehicle ownership is changed the game itself already sends a network packet anyway. Your additional one won't do much there
No as in a variable that stores uid's of the owner, but still small.
I just figure one more thing to lose.
hi guys i need your help on something. i want to create a Training mission in which you fight a friendly force. however them being friendly i just want to be able to shoot them and they go into a perm-unconscious state, is this possible using ace3 advanced medical ?
thanks
@still forum You updated my script like this last week. everything is working correctly except one thing : Player sometimes is teleported to a location in field of view of other players... Can't manage to find what's wrong...
private _Pos1 = [[["spawnzone", 90]], newBuildingMarkers] call BIS_fnc_randomPos;
if (count allPlayers > 1) then
{
private _isVisual = true;
while {_isVisual} do
{
_Pos1 = [[["spawnzone", 90]], newBuildingMarkers] call BIS_fnc_randomPos;
_isVisual = (allPlayers - [player]) findIf
{
([objNull, "VIEW"] checkVisibility [eyePos _x, _Pos1]) > 0.5
} != -1;
};
};
player setDir (random 360);
player setPosATL [_Pos1 select 0, _Pos1 select 1, 0];```
Are you sure he is in field of view?
Maybe the players had just a small tree or a street sign or some small object that blocked the view
yeah sure, I once TP 20m in front of another Player
I had asked him not to move
would it be because of the format the coordinates _Pos1 is returning ?
if it helps, this is the safe spawn script I use for close combat modes. have had very good results.
https://github.com/ConnorAU/A3GunGame/blob/master/mission/functions/systems/fn_moveToSpawn.sqf#L40-L66
I'll try to combine both ...
thanks Connor
Mmmmh it's slightly too complicated for me sadly. I'm not skilled enough to understand and use your script. i'll try to find what's missing up my one
i can explain it if you want
Is there a way to make an AI unit join your squad in a MP mission? For example, if I'm saving a brother and want him to follow me and my dudes into out ride
as in add the unit to your group?
https://community.bistudio.com/wiki/join
is it a problem if my while loop doesn't have a sleep in it ?
will it loop on each frame ?
It will loop each frame (if it can) and it will run multiple times per frame
the code I displayed above doesn't have a sleep. but since it isn't doing anything really heavy it wont have much impact right ?
okay so I kindoff mixed Connor's script with mine. it's a mess and it's not working but I can't figure where the problem is...
private _Pos1 = [[["spawnzone", 90]], newBuildingMarkers] call BIS_fnc_randomPos;
if (count allPlayers > 1) then
{
{
private _eyeIntersect = lineIntersects [(eyePos _x), _Pos1 vectorAdd [0,0,1.8], _x, player];
private _bodyIntersect = lineIntersects [(eyePos _x), _Pos1 vectorAdd [0,0,0.9], _x, player];
private _footIntersect = lineIntersects [(eyePos _x), _Pos1, _x, player];
} forEach (allPlayers - [player]);
private _isVisual = true;
if (false in [_eyeIntersect,_bodyIntersect,_footIntersect]) then
{
_isVisual = false;
}
else
{
while {_isVisual} do
{
if (false in [_eyeIntersect,_bodyIntersect,_footIntersect]) exitwith
{
_isVisual = false;
};
_Pos1 = [[["spawnzone", 90]], newBuildingMarkers] call BIS_fnc_randomPos;
{
private _eyeIntersect = lineIntersects [(eyePos _x), _Pos1 vectorAdd [0,0,1.8], _x, player];
private _bodyIntersect = lineIntersects [(eyePos _x), _Pos1 vectorAdd [0,0,0.9], _x, player];
private _footIntersect = lineIntersects [(eyePos _x), _Pos1, _x, player];
} forEach (allPlayers - [player]);
};
};
};
player setDir (random 360);
player setPosATL [_Pos1 select 0, _Pos1 select 1, 0];```
wait a second, gonna pull out my magic cristal to check your code
please hold the line
Thank you for your time
will refer you to https://stackoverflow.com/help/how-to-ask @quartz coyote
because that literally contains nothing but the actual code, which is not small enough to make me read and understand it
Since this is the next message of a conversation, I actually didn't expect YOU to look at my script ;)
But is you so well want to educate me, I we create a decent sentence for you particularly : Would you please @queen cargo, look into my code. I am having problems with it and cannot find what is going wrong.
for "_i" select [{this setFace "miller";} || {this setFace "IG_Leader";}];
this obviously doesn't work. can anyone point out why tho?
you then may want to annotate @robust hollow @quartz coyote as it is his script ๐ค
@tulip hare what would you expect it to do?
for "_i" is required in a for step loop
select expects an array lefthand, an index righthand
and CODE || CODE is not existing
@queen cargo was hoping that this line woud randomly pick which ever of the two functions but can't since I'm not well versed with coding.
ye ... no
selectRandom [{...}, {...}]
at best though, you start actually learning to code
otherwise you end up with such mess more then needed ๐ + the biki is your friend
so this doesn't need any conditions? I only know about conditional statesments but would take u so much time and space to make. sorry and thank you.
no (aka: check the biki ๐ )
wait it says missing ;
I'm sorry what's call?
Read the biki. https://community.bistudio.com/wiki/call
If you can't understand what you're reading, you're far better off making an effort to learn before you continue trying to write things yourself. Far less headache that way
ok. wilco. still taking classes for programming. currently learning C and these mentioned functions I have not encountered yet. sorry for the trouble. thanks for the help.
If it's any consolation; between the biki and this Discord I managed to learn a bit and I'm just an accountant. Just gotta be more stubborn than Arma is all.
maybe some here can help me.... I'm trying to make a vehicle spawner which allows the players on my server to spawn vehicles and customize them beforehand. I was able to make it via the virutal garage but the vehicle is only visible to the spawning player and also I dont know how to whitelist certain vehicles. Maybe there already is already a script doing this or you might be able to help me.
Intended functionality: The players can access the spawner on certain points on the map, each point has his own pool of vehicles which can be customized, the player can preview the vehicle and customizations he selected before spawning them in.
Yes @unreal leaf has such a script
Hey guys, how do i make an ammobox into an arsenal?
I tried ["Ammoboxinit",[this,true]] call BIS_fnc_arsenal;
But doesnt work?
@astral dawn @unreal leaf where can i find that, if i can use it
Hmm the Antistasi code has the garage where you customize a car and then spawn it
If you can use it, IDK, it's Jeroen's creation
@long pewter should be AmmoboxInit
When using setTriggerArea the triggerArea returns a different value for the angle even after hinting right after making it. Is there something I'm missing here? Am I having a stroke?
What do you set and what is returned?
Extended Event Handlers are a good thing if you need them. Works well for ACE for sure
And in regards of files, ๐คทโโ๏ธ
Do as you think it is best
But putting especially Events into their own files is actually kinda a good idea as it gets simpler to fine
Macros can be a pain to read but been through ACE code enough to know what they do. Is a pain when you start out though
Whats the quickest way to test code? Going into a init.sqf file then loading up arma going into the mission editor and then running a mission takes ages. Is there any benifit to using a SQF file over just writing the code in the init of that object you have selected??
Using the debugger is quite nice to do a fast test of some code
init boxes become a bit unwieldy if you have dozens if not hundreds of line, also it's a matter of organization and structure. E.g. why put some arbitrary code in an object init box that is not related to the object at all?
while {alive player} do {nul = [getPos player,240,"Banshee",2] execVM "MIL_CAS.sqf"; sleep 60;};
params [
"_position","_direction",["_vehicle","B_Plane_Fighter_01_F"],["_type",0],
"_logic"
];
_logic = "Logic" createVehicleLocal _position;
_logic setDir _direction;
_logic setVariable ["vehicle",_vehicle];
_logic setVariable ["type",_type];
[_logic,nil,true] call BIS_fnc_moduleCAS;
deleteVehicle _logic;
Above is the code being called upon attempting to run in a loop. However the game seems to freeze right before the mission begins. It works fine as an addaction. However i cannot seem to get it to load as an loop. Help...
Hi i exec a function an arma 3 crash haha
do u know what can be the problem?
Exception code: C0000005 ACCESS_VIOLATION at 7CC70B80
Whats the function?
private "_item";
private "_magazineSize";
private "_magazineSizeMax";
private "_magazinesAmmoFull";
_item = param [0,"",[""]];
if (_item isEqualto "") exitwith {};
_magazineSizeMax = getNumber (configfile >> "CfgMagazines" >> _item >> "count");
if (_magazineSizeMax isEqualto 0) exitwith {};
// allow repack for all magazines with greater than 1 bullet
if (_magazineSizeMax > 1) then {
_magazineSize = 0;
_magazinesAmmoFull = magazinesAmmoFull player;
if (_magazinesAmmoFull isEqualto []) exitwith {};
{
if (_item == (_x select 0)) then {
if (!(_x select 2)) then {
_magazineSize = _magazineSize + (_x select 1);
};
};
} forEach _magazinesAmmoFull;
// remove all
player removeMagazines _item;
// Add full magazines back to player
for "_i" from 1 to floor (_magazineSize / _magazineSizeMax) do
{
player addMagazine [_item, _magazineSizeMax];
};
// Add last non full magazine
if ((_magazineSize % _magazineSizeMax) > 0) then {
player addMagazine [_item, floor (_magazineSize % _magazineSizeMax)];
};
};
i call it ["classnameofmagazine"]
if i call in on the console, its works
If i call in a function game closed crashed
0xC0000005 - ACCESS_VIOLATION
This error is very generic. It may be caused by many issues, such as a hardware malfunction, a virus in the computer, but also an error in the game itself. Possible solutions:
Try joining another server, then rejoin the previous one.
Update the graphics card drivers to a newer version.
Rollback the graphics card drivers to an older version.
Check the temperature of your GPUs and CPUs.
Verify the integrity of the game cache using Steam.
Re-install DirectX.
Uninstall the Visual C++ 2013 Redistributable package (both x86 and x64 version), restart your computer and install the package again (do not use the Repair function).
Run a Windows System File Check tool to repair corrupted system files.
I would at least validate your files.
i will try xD
Executing a on a console is different then through a function.