#arma3_scripting
1 messages ยท Page 262 of 1
huh
that wouldn't work like that
you'd need a string
so it's the same thing as sending an ordinary string
What would be the use of binary operations anyway?
^ it'd be similar to the new binary literals coming to C#
because you can't go over 7 numbers, as you will exceed floating point precision
uh
just google "bitwise operations"
I know bitwise functions.
it's a very very very common thing in programming
Are used A LOT in encryption
I'm just waiting for a XOR command ๐
that's stupid
try changing something on wikipedia
come back in few minutes, you'll see your change reverted
majority still wins
If universities smack you over the knuckles for using it.
uni's don't like it because they want you to do more research
Or learn to use it properly for University
^
and refer to the references: https://i.gyazo.com/0b1cde66cb8a43142053d62be8d06ced.png
It is not a credible source.
it is
No it is not.
not as actual sources
but credible enough
there are a ton of people editing it
as I said
try editing a big page
For that reason it is not credible.
you do realize wikipedia is written from other sources?
So something written by Alex Allain is more credible than something written by multiple experts, referencing many expert papers/books?
^ just wanted to say
Wikipedia is past the days of allowing anyone to edit it
And serves me amazingly almost every week for my University course
and even if you do, they will quickly blacklist you for false edits
of course you have to be cautious
you also have to be cautious for reading that post you just linked ๐
the expertise of the posters is not taken into consideration.
it actually is, as I said try changing something
and then come back tomorrow
A link from Harvard has more credibility than wikipedia ever will.
Fact is, Wikipedia posts information from credible (in your world) sources referenced. If you plan to use any information you see on it - read stuff that is being referenced, and reference it (from the references list)
The universal constant is wikipedia is banned
As I said AU, you will get failed if you use wikipedia ever.
Might be why we have some of the best universities in the world.
so what do you reference if you have diploma work and you are proving something on a case of some game (eg. machine learning), what do you use as a source?
If you were to reference Wikipedia in your work, that'd be stupid
Hence why, again, there is references
jonpas go through the appropriate channels
nature.com etc.
Scholary databases
etc.
how will that help me learn a game ๐
There is plenty of machinery learning papers in those databases
...
now read what I wrote again
you are proving something on a case of some game
I was looking for information on nanoparticles as antibotic carriers against multi-straint anitboitic resistant bacteria
let's say your diploma is machine learning, AlphaGo
#random
you need to understand how Go (the game) works
enjoy
I was curious if it worked, considerable research in googles scholary database says it is very effective. The game go? Is purely down to game-theory math. Although they successfully taught a machine to beat go using deep neural network learning
You seem to be missing the point still
Sure you can trawl through countless papers, but as I already said, you can pick up important information, taken out of these papers, and referenced on Wikipedia
I wouldn't recommend writing your PhD thesis off of Wikipedia, though
Teachers didn't want us using wikipedia because they didn't want us being lazy and useless when it comes to reseach. We were more than welcome to use the sources the wiki pages referenced though.
Good
Learn to filter information.
exactly @buoyant heath
then subject is done
Scan papers.
and get back to scripting chat
You just proved the point we were making
or move to general or something
because reasons
Why does anyone try to encrypt anything?
I don't understand it either
๐
Because people are going to steal their very unique sqf code
woohoo! not.
all encryption done for PBOs so far can be broken in notepad, sooo
It's mostly the life/wasteland/exile servers trying to "protect" their "unique" "features" from "hackers"
Everything is either a GTA ripoff Call of Duty or Wasteland variant.
There is lots of unique things out there
phwew, wearing out my " key
Want to stop your code being ripped
Recursively wire everything together so each depends on the next / taking it apart extremely hard.
I understand entirely why people do it. Whether it's 'right' or not, that's up for debate
The most simple way to 'encrypt' all your client side code, would be to run it through an algorithm, then decrypt it serverside
Unless people are going to hack, not much they can do
Then you can just take it to the editor ๐
Samatras script is encrypted
server-side but I was told he stopped working on KoTH long ago @dusk sage
And the "life servers"
with "unique" features aren't unique.
Crafting?
Not unique.
XP?
Not unique.
Jobs?
Not Unique.
So remind me which is unique?
One of the more unique missions I played but no one plays it.
Was GetWrecked
There is going to be servers out there with unique stuff
You could argue
Anything on ARMA 3? - not unique
But we aren't that pedantic
Then this game isn't unique, nothing on it is
Or completely start from scratch.
The game is unique.
A lot of the "missions"
are not.
How is the game unique
#offtopic_arma maybe?
I enjoyed Get Wrecked
well i actually didn't had the chance to play it sadly
but in terms of uniqueness, if you use the same framework as everyone, then you are close to not being unique.
And keeping people from ripping your code, you can make a mod and implement some decryption capabiletys
Or have decrypt scripts serverside, or keep everything serverside, or
siomply, write code that is very backend reliant, that doesn't work witout the backend. And maybe even encrypt the small clientside. or what ever, there are easier ways of making it hard to rip
how can i hide the dlc menu when im pressing shift+p ?
With an object spawned and the name of that object declared as "someguy_1", why is missionNameSpace getVariable "someguy_1" returning <NULL -object> and not the object?
But I am not going to tell you how to do it @dim owl
Especially if you haven't paid for the DLC's
i have paid but some persons who play on my dont own it
but i want to call a script when i press shift+p xD
You'd need the IDD value of the DLC window
block it and redirect to a script then
^ with onKeyDown
okay. like closedialog 0; []execvm myscript.sqf
no
If onKeyDown returns true, you'll block it
(if it still applies for the DLC window, I dunno)
Just the same that you can't control the Esc menu, really
I am betting not @dusk sage because I think that data is squirreled away inside an EBO
how could i block it ? i dont have a idea.
okay
If it doesn't work, it's not down to the EBO
https://community.bistudio.com/wiki/displaySetEventHandler is how you capture and handle a keypress
^ all the info you need
actually, use https://community.bistudio.com/wiki/displayAddEventHandler so you don't overwrite existing ones.
I think 46 is the primary window IDD
You'll want the display
(findDisplay 46) addDisplayEventHandler ["KeyDown", ""] @dim owl
okay. try it tommorow
bleh, I'm clearly doing something wrong with this.
d = vehicleVarName cursorObject; _object = missionNamespace getVariable d; c = vehicleVarName _object;
in debug results in this:
d = "someguy_1"; c = "";
What am I doing wrong here?
setVariable first?
_object = missionNamespace getVariable "d";
@paper rain d is already a string as vehiclevarname returns a string
@tough abyss set what value?
but d is named "d" in the missionNamespace
Oh?
@paper rain testing.
d = vehicleVarName cursorObject; _object = missionNamespace getVariable "d"; c = vehicleVarName _object;
results in Error VehicleVarName: Type String, expected object.
at position c = |#|vehicelvarName _object;
@tough abyss correct. error is occuring on setting c.
c = typeOf(_object)
or d = cursorObject;
That should return the vehicle object
Returns a string
Typical type coercion problem -_-
No, typeOf returns the vehicle class string
@tough abyss c = vehicleVarName typeOf(_object);> 19:12:21 Error position: <typeOf(_object);> 19:12:21 Error typeof: Type String, expected Object
_object = missionNamespace getVariable "d";
c = vehicleVarName _object;```
@paper rain the problem is Im working with just the variable name. Im using cursorObject for debugging purposes.
One thing to note about CursorObject
it has to be "revealed to you"
My own testing showed once that you have to "spot / reveal" whatever you are pointing at
To give you some better understanding of this
so for arguments sake lets say I spawn a box, and that box is named "thisDamnBox" in the editor. I want to reference that box by varname only (lets say it's hidden and I want to unhide it, for example). How can I reference that object via the variable name alone?
Are you using the debug console?
@broken mural Is this via debug console?
@tough abyss yes, currently Im standing in front of the object and setting d = vehiclevarname cursorObject
do this
See the 4 watch fields in the debug console?
type into of them
cursorTarget
Then look at him.
<NULL -object>
Thats why.
What does that suggest, though?
No, it's still a typeconflict, because the default return is stuill an object
and typeOf returns a tring, not object
I said only use cursorTarget it's still returning null
Watch fields are very useful
for working out small things
They run in unscheduled environment too
hitting T revealed the object, but I wont have access to any of that from in game. All of this will be happening server side.
cursorTarget shouldn't be affected
Can you... run cursorTarget on the server?
it has none
^
objNull all day, every day
_d = vehicleVarName cursorObject;
_object = missionNamespace getVariable _d;
you went from having the object, to having a string, to having the object again
vehicleVarName only returns missionNameSpace anyway?
It returns a string
the value of vehicleVarName returned will be local to the PC on which command is executed
Okay so lets back up because I think I might be going down the wrong path with this.
I have 2 AI dudes. One spawns hidden. When the first dies, I want the other to unhide.
I have their names set in an array, and when one dies, their name is removed, and the next one is grabbed and is suppose to have _object hideObjectGlobal false ran against it. The problem I have is Im trying to reference the remaining, invisible AI based on it's varname.
["dude1", "dude2"] _myObjectInstance = missionNamespace getVariable "dude2"; _myObjectInstance hideObjectGlobal false;
So it effectively is missionnamespace only anyway
@dusk sage I was doing that to see where the breakdown occurs.
"Local to the machine" it is executed on"
correct.
dudeX hideObjectGlobal false
dudeX is your missionNamespace object variable
dude1, dude2, etc
For proof of concept, type dude2 setDamage 1
Its a bit more complicated then that. When they spawn their names are added to an array and are referenced later. This causes the problem where I need to set an object variable to utilize hideObjectGlobal
I'll look into that.
@dusk sage I have no idea what warped concept i had running inmy head when I thought it was a good idea to add the variable name to the array and not the actual object -_- thanks for the help all
Hmm
I could have sworn there was a command, but it doesn't seem so
Do you need info on them, or just to know if one exists?
I'd prefer checking if the eventhandler exists, tbh
What eventHandler?
the array contains a bunch of different objects, not just AI, and some of the AI have damagehandlers, Killed handlers.. if they are invis I'm switching them to be immune to damage, but when I show them I need them to go back to the original status. A box isn't going to have that handler though lol
Currently, just need the HandleDamage
Check if they are isKindOf 'Man'?
Might work but just noticed I have different types of damage handlers. All good I found a workaround.
hmmm?
@dusk sage eh thought I found the problem to my question but totally didnt ._. I'm trying to consolidate code Im reusing by creating a function in the same .sqf file
`universalDetails = {
_var1 = _this select 0;
_var2 = _this select 1;
_var3 = _this select 2;
//some code that uses these variables
};`
and calling said code;
["one", "two", "three"] call universalDetails;
but i get a weird, generic error. Error undefined variable in expression: universalDetails. Ideas?
"Since you play for 1 hour, and not 0.001 seconds, use [] spawn {}!" Magus
People trying to avoid spawn, create tons of problems and archieve worse situation, that inclusively affect gameplay and "soul".
So i start to think what really is inteligence. Good night.
"In the future, code execution lag will be 0. You can play 10 hours of your favorite game in 0 seconds" Magus
What is going on ๐ฎ
๐ค
Any C++ guys here???
tool_makers definitely has some
for the lazy: #arma3_tools ๐
(L)
thanks
just trying
I'm just too new to C++ and trying to do threaded network stuff
-.-'
Will work it out
Some year
Are you using boost::asio?
For a callExtension .dll?
KK had some stuff about keeping from blocking the A3 thread.
(Or he was playing with it at least)
Testing stuff, wanna make a RPC system that is hosted in NodeJS+MongoDB in a remote server for data
Nah, the theory it's what I got right, making thread and a ticket system for polling data
It's similiar to what extdb2 does
But maybe is better to go thought sockets... I could build my own protocol on top of TCP
And yeah, KK has great stuff about ANYTHING
Love that guy
Yeah, I wouldn't bother with json-rpc, a web socket library sitting on boost:asio would probably be cleaner
boost::asio has built in support for calling from the A3 thread into the websocket thread like you need to.
Thank you @tough abyss . That got to be the most retarded thing I've ever read.
The idea is to make an extra thread that gives futures and promises (if return value is expected) so it just posts the request and give a request ID back to SQF space, then keeps a new thread waiting for the response and it's responsability of the SQF to check from time to time if the C++ thread got a response, if not, keep waiting
lol @little eagle
Arma 3 used ASCII or UTF-8?
I believe it was ASCII but not sure now
SQF variable names do not support ASCII characters.
you can have them in strings, but most string commands bug out with them
stringtables on the other hand even have Japanese and stuff
Hmm... Yeah, but they must use some enconding standar right?
Variable names?
Or are they just being lazy and using a custom one?
Nope, string encoding
Char tables
Which string commands fail with characters 128-255?
Hahahahaha
Nah, it's just I'm trying to figure out which char use as delimiter that won't be used by idiot players
Everything that is used as HTML command if you plan to use structured text with player names
< > etc
I'm trying to do a protocol between C++ and SQF, and as they connect though strings, I want to find a char that I can use as a separator that even the most completely uselesss and idiotic user won't use
Like in "get:steam_id:money:position:health:name", but I'm sure some player is capable of calling himself ":::::::::::::"
And that would be very painful to a few people...
You can use str on an array
@icy raft You don't need a delimiter anymore, since arma3 escapes quotations now i.e possible to parse a str _array correctly now
Also pretty sure its utf8
@tough abyss What you mean? And if it really is UTF-8 that rocks, can play the bit lover card
ah you edited, i'll check it
Oh, okay
i.e a rough example.
_data = [_playerID, _pos, _inventory]
"dll" callExtension (_str [ _jobID, _data]);
You can parse the stringified array inside the extension. No need for a delimitator at all
I can parse it back easily
@tough abyss Thanks!
Hah! I'm now creeping your GitHub
I was sure I saw your name earlier
Now I know why
Don't have any public code for parsing an array ;)
Still need to finish coding it & make sure its faster than using seperators.
Since you just need to parse enough data before handing if off to seperate thread
stringJoin is quicker aparently
or joinString
But the difference is probably not worth caring about
Following you, you seem to have neat stuff there
"Overoptimization too early is the root of all evil"
drop the "Over" and you're good ๐
Inexperience is the root of all evil
Hahahaha
Inexperience is fun, you feel like a child going all around and touching everything, but from time to time something drops and breaks, but still fun
"Code in the future will be manage waits and sleeps" ๐
"Code is the parents" Akryllax, ruining childhood fantasies since 1994
"I like this game that happens on year 69483784578383"
@tough abyss Does the Discord not compatible with the sheep head?
Wrote a script that fetches every single attachment off config and adds random ones onto your weapon for some guy on reddit, here it is in case somebody is interested:
http://pastie.org/pastes/10962087/text?key=q1vdggfuyty7egl5tetawq
@icy raft Do it through ids, not names
anyone know how to get a variable of an object from an object
for example i set an addaction
_npc addAction["test123",this getVariable "thisvar","",0,false,false,""];
it wont get the var, with this reportign as undefined
and i got it ยฌ.ยฌ
_this select 0;
as its relation to the object
fml
@little eagle you only say that to persons you consider cool.
@tribal crane sheep head?
cheap head?
Discord is compatible with everyone.
No, sheep head.
@icy raft you can take a look at https://github.com/intercept/intercept
@meager granite I was going to use steamid as key, more unique than that can't be ๐
intercept is a pretty big risk for something simple
@warped thicket Interesting...
But I'm using this as a learning tool, so I don't want to rely too much on third parties or I won't actually learn anything haha
But will check it, everything adds on
I have a group of AI spawning with a damage handler that makes them immune and hides them, and when a trigger is activated Im trying to get them to unhide, remove the original HandleDamage eventhandler and add in a new one. This is hit or miss. Ideas?
_x addEventHandler["HandleDamage",
{
_unit = _this select 0;
_damage = _this select 2;
_shooter = _this select 3;
if (side _shooter == side _unit)then{_damage == 0;_unit setDamage 0;};
_damage; //return damage value.
}];
};```
I've also tested with _x allowDamage false; instead of creating a handleDamage EH (though from what i've read they are the same thing)
How to do multiline comments in arma scripting?
/*
like this
*/
Thanks ๐
To make a vehicle not move do I need to put Init code in group or the driver unit?
not move in what way?
figured it out
Put this init on driver
this disableAi "Move";
He won't move even if I use zeus and tell him to move
I know I could just set fuel to 0. But I wan't players to be able to take the ride
I understand I have taken water over my head with my next obstacle. I want my players to dive to land, walk up to a cargo container, then script the container to have a "scroll option" rearm or something that changes from diving gear to spec ops gear (uniform and stuff)
I know (can figure out) how to remove all items and add what I want by scripting. However to make functions and call them by a player interacting with an object is my real issue
well to let players interact with them you'd use addAction
["Change loadout", [this, true]] spawn customFunction;
That won't work?
Just guessing based on this code
["AmmoboxInit", [this, true]] spawn BIS_fnc_arsenal
Nvm
How and where to add custom functions though?
In init.sqf?
anywhere. functions are just a variable that contain a code block
my_fnc = { hint "hi" };
call and spawn take the value to their left and execute the codeblock to their right
Thanks, you are really helping me out here @indigo snow
addAction ["Change Loadout", {call fnc_change_loadout}];
How to send unit variable name to the function and change based on what unit it is.
fnc_change_loadout =
{
if (_player = "teamLeader") then{
removeAllItems _player;
_player addItemToUniform "ACE_morphine";
};
if (_player = "medic") then{
removeAllItems _player;
_player addItemToUniform "ACE_epinephrine";
};
This in init.sqf
I imagine this is far off how to do it, but you hopefully understand what I want to do
@indigo snow
_this select 1 maybe?
Instead of _player
_player is a private variable you'd need to define. player is the a3 reference to the player unit. = is only for setting values. You need == or isEqualTo for comparisons depending on what you're doing. You'll also need to get the role (I think) of the player unit to be able to compare to "teamLeader" or "medic"
this is the syntax for addAction: unit addAction [title, script, arguments, priority, showWindow, hideOnUse, shortcut, condition, radius, unconscious]. You already put in a title and script, arguments would be the value after that.
This says _this select 1 in script will refer to the unit that activated the action
I do not need to pass any additional arguments then yeah?
ah true indeed
params ["_target","_caller","_ID"]; would set up these values into local variables for you to use
This
this addAction ["Change loadout", {removeVest _this select 1}];
Gives this
error type array, expected object
its seeing (removeVest _this) select 0
try removeVest (_this select 0)
(also the player would be the caller, and thus _this select 1)
Finally
Thanml
Thanks
This is what I did:
this addAction ["Change loadout", "fnc_change_loadout.sqf"];
and this in fnc_change_loadout.sqf
_caller = _this select 1;
removeVest _caller;
Imagine it is going to be easy from here on
Why do I get error on line 12 (the if statement line)
http://pastebin.com/DHaPuPMr
I see you already answered this @buoyant heath
_calleris a unit. It's not going to be=="teamLeader"- you use
thisinstead of_caller
How to get role thought?
Doesnt work
Remember the pastebin is my sqf file
And I'm using addAction to access it
_caller = _this select 1;
Thats my first line of code
Code from line 1 to 11 works fine
It removes my items
But the if statement fails
That's because _this select 1 is the player's unit.
You then try to compare <unit> == <string>.
Then inside your if you use this as a reference, which is an unrelated problem
Oh sry
I have tried with _caller instead
Wrong code uploaded to pastebin
Change all this to _caller
Thats how it really is
This is my current file
Lol
I fixed
On a side note, if you haven't tried it, I find codeshare.io more convenient than pastebin.
You could try if (isFormationLeader _caller) then {<code>}; That might work for what you need.
That or a switch-case
if (a) then {
stuff
} else {
if (b) then {
stuff
} else {
if (c) then {
stuff
}
}
}```
Thanks
or
switch (<condition>) do {
case 1: { <stuff>};
case 2: { <stuff> };
default { hint "default" };
};```
Why does this not work?
intel1IsAdded = false;
if (intel1IsAdded isEqualTo false) then{
teamLeader createDiarySubject ["intelligence", "Intelligence"];
teamLeader createDiaryRecord ["intelligence", ["Nightvision", "We have aqquired intel that suggest Daesh has been donated nightvision. Be aware!"]];
hint "Intel has been added. Check it out!";
intel1IsAdded = true;
}else {
hint "No new intel availible";
};
Seems like it is not able to save intel1IsAdded var from time to time
This is a sqf file I call from a units addAction
Ahh
Next time it runs it sets it back to false
Logic flaw?
Yea
if you want a piece of code to exit
the scope after a condition is met
use exitWith {};
problems with addactions they experience the same issue with eventHandlers
So where do you want the addaction to be available?
Have you got the addacton?
code as well?
You can think of an addaction is very much like an eventhandler
Actually it very similar to an event handler
They both handle a "type of event"
Ill find it
E.g addaction creates a text-box type thing that you can interact with and fires when you hit spacebar on it or etc.
this addAction ["Ask for intel", "fnc_intel1.sqf"];
Add the condition for is leader into the addaction
Have this in a civilian init
Because there is 2 problems with your script
- Is locality.
addaction is local to the machine that executes it.
Unless it is placed onto the init of a object.
This is what I want to do:
Have a Civilian in which you ask for intel. First time you ask every player gets the intel. If someone ask again a hint pops up with "No new intel"
```'
which the this addaction ["Ask for intel","fnc_intel1.sqf"];
That is in the init of a unit in my mission yes
I am assuming is on the civilian?
Yeah
Okay so that addaction is global then
Okey
I know
I could just name him dude and use dude addAction in init.sqf instead
No no
That doesnt matter
Its 4 players
Anyone can get the intel
The teamLeader is just my varName for the player
Okay so lets look at your logic here. When you call this code via the "Addaction" which is effectively an eventhander.
You do know what EVH's are ?
Ehm I remember some stuff from my earling codin
programming in school'7
But basically no
Okay eventhandlers are things that fire when a specific event is trigger.
Say. Real-world example would be if I sat down on a chair and added an event handler to the chair
That event would "fire"
Okay. Now this addaction adds an action like a loop to whatever.
executed
It may as well be a sort of loop
But it doesnt loop
In essence it kind of does
For each time I click space yes
When ever you add the action it will be there for ever that a condition is true
And that makes my variable false again
Exactly
I get that
So think of a way you can completely jump out of the code after a check becomes true?
Ahh
And skip straight to the else clause
I see
See what I mean by addAction basically being a loop
I've experienced this same problem with eventHandlers
If you set a condition when ever they fire.
and it runs again it will just reset it back to that conditioon
and effectively be a never-ending loop
What if
Next time I run it it won't change it back to false then. But should still be able to access it since I set it as a global variable?```
Global variables don't mean "public"
If this is an MP mission you've got to consider public vs global
Global is accessible to the machine that "has the code" / variable
even if it's run from the init.sqf
It doesn't necessarily mean it will be public
You sure that won't work?
You can easily see if yoour variable is or is not public
In the watch fields of the debug console?
You know the debug console?
You saying it would work for me as host, but not my friends playing with me?
Yeah
I'm checking
Okay 4 boxes below the main console window "Are watch fields"
type your "teamLeader"
var into the box
If it is undefined it will show nothing
if it is defined it will show the variable
4 watch boxes 4 outputs
Yes he is a variable
Still a variable.
so you can check him
if he is a "global"
so in the first watch box type teamLeader
If it returns nothing you've got a locality issue
or the box flashes orange.
intel1IsAdded is thye importent one though
And adding intel1IsAdded = false in init.sqf shows me false when I write it in watch
teamLeader also shows me
So that works too
After running my script it shows trye
true
So yeah fixed
But new question
When I use <this> createDiaryRecord does it add only for the object i write instead of this?
Or the group of that object?
If this is used
cant use this
It has to be passed through the addAction
Yeah
Not hard.
I have already been tehre
there
In this script
But does createDiaryRecord add only for that unit?
Yes
Like my group cannot se the same diary record?
createDiaryRecord is local to that unit only
Local to the unit
I'm not deeply familiar with locality @little eagle is much more.
you don't have to iterate through all units
This:
is local to that unit only
is badly worded. A command can have local effects on a machine. It has nothing to do with single units / objects
{_x createDiarySubject ["intelligence", "Intelligence"];} forEach [teamLeader, marksman1, rifleman1, breacher1];
nope, that is wrong
See:
A command can have local effects on a machine. It has nothing to do with single units / objects
createDiarySubject creates the diary entry on the machine where the command is executed
And in my case that is host/server?
nope
The statement code of addAction thingies is only executed on the machine where the action was used. Where a player clicked on it
So in reality all four players need to click?
for the entry to appear. yes
If you tried to createDiarySubject on teamLeader, from marksman1's machine, nothing would happen
but that is not what you want, right?
teamLeader needs to run it himself
Then I suggest you write a script, name the file something like "createDiaryEntry.sqf"
you precompile the script in init.sqf, in the same place where you use addAction
I have a script called fnc_intel1.sqf
And then you execute that precompiled function via remoteExec
ask away if you have any questions
remoteExec just makes it so that the function is executed on every machine
This is https://codeshare.io/5eKDKG
my init.sqf
And this is the init of the unit
this addAction ["Ask for intel", "fnc_intel1.sqf"];
yeah. currently intel1IsAdded will only be set to true on the machine where the action was clicked
because that whole script is only executed on one machine
I see
you could execute that via remoteExec
[teamLeader,["intelligence", "Intelligence"]] remoteExec ["createDiarySubject",0,false];
But you have to precompile it first
What if:
I use remoteExec in the units init?
No, sending every command is suboptimal
Okay.
I am getting confused
A good question though is, whether init.sqf or the JIP stack is executed first
I have no idea
- Don't know how to precompile.
- Never used remoteExec
?
It is easy, Cisco
Thank god
Interesting I might wrap my own function up using the create diary records
into 1 piece of code and use it as part of my framework
My_function = compile preprocessFileLineNumbers "myFunction.sqf";
Re-usable code ftw
And I put that in init.sqf?
If you use that line, you can remotely execute "My_function" everywhere using remoteExec
yes, it has to be precompiled everywhere
So not only init.sqf?
init.sqf is everywhere
Ahh
although again, I'm not sure if that is safe for JIP
That is Join in progress?
init.sqf is shitty scheduler wizardry. It works, and then one day it stops working
I do not believe I am gonna have people join in progressยจ
yes, JIP = join in prgress
Its a coop for me and three friends of mine
Ill have them join before i start the mission
intel1IsAdded = false;
add_intel1 = compile preprocessFileLineNumbers "fnc_intel1.sqf";
This is my init.sqf now
Okay. I wouldn't be content with that but w/e
Where to use remoteExec?
I want my scripts to work in savegames loading in local hosted MP^^
Inside the addAction
Im just starting with this scripting
It's further down the road for me
Three days ago I didnt know how to add virtual ammobox for objects
So Its fine for now
Well. Tbh, I would have to look that up too
The problem with Arma is that it has no sane standards on how to do things. Everyone just jumps straight into init.sqf
Yeah agree ๐
["AmmoboxInit",[ammobox,true,{true}]] spawn BIS_fnc_arsenal;
by the way if you do that
you should run on all connecting clients
["Preload"] call BIS_fnc_aresnal;
["Preload"] call BIS_fnc_aresnal;
Insanity
Why?
What I never ran the preload thing
Otherwise on our server we were experiencing extremely long delays with aresnal loading
And got no issues
Lol
Otherwise on our server we were experiencing extremely long delays with aresnal loading
Scheduled environment....
Is there anything wrong with using function-as-files to create vehicles?
scheduled isn't that slow
Say for example I wrapped a single function into itself to allow me to basically plug in any vehicle.
shouldnt be causing really long delays
Correct?
this addAction ["Change loadout", remoteExec["fnc_change_loadout.sqf"]];
no
Hang on.
scheduled isn't that slow
yes it is. pre rewrite the CBA keybinding menu took a minute to open on 10 fps
now it's 0.1 seconds
lol
-.-
@dusk sage what do you mean?
Was it 20k lines of code or what
It won't add the intel for all clients?
also
How can I get into @little eagle Using CBA for my mission development?
How you get into me? What?
this addAction ["Ask for intel", {remoteExec["fnc_intel1"]}];
Would this work?'
this addAction ["Change loadout", {remoteExec["fnc_change_loadout.sqf", -2]}...
No how can I use CBA_A3 for mission development?
What do I need to learn?
The macro library?
Not a file
-2 is all except server?`
Yep
Is there a wiki?
fnc_change_loadout.sqf needs to be a function
Ahh so the function I preloaded in init.sqf?
to use the macro librabry just include it
add_intel1 = compile preprocessFileLineNumbers "fnc_intel1.sqf";
This?
That's a different file now
which one are you trying to use?
Any function you wish to execute on a target with remoteExec, needs to be compiled into a variable (function)
such as
add_intel1 = compile preprocessFileLineNumbers "fnc_intel1.sqf";
yes
This is my fnc_intel1.sqf
https://codeshare.io/29jAX5
This my init.sqf
https://codeshare.io/5eKDKG
And this my units init
this addAction ["Ask for intel", {remoteExec["fnc_intel1"]}];
yeh, so that's the right idea
Perfct
Perfect
And now the variable i set in init.sqf line 1 doesn't cause any issues?
btw. Cisco. You can try out your mission by exporting it to MP and connecting to a LAN game with a second game instance
that is how I debug MP
(if I debug MP, yolo)
You obviously don't have to remotely execute every function you use, Cisco
For example the loadout function
The player keyword is your player object
No need to use the names anymore
All commands you use for loadout have usually "global effects"
Eventhough I play as teamLeaderยจ
๐
But I'm supposed to change teamLeader to player in my script?
In which?
And remoteExec then makes it run on all clients where player effectivly refers to theyre player?
fnc_intel1.sqf
this one
"global arguments" means, that the unit you try to dress up can be local to every machine
"local arguments" means, that the unit has to be local to the machine where you are executing the command
"global effects" means that the unit will be dressed on every machine
"local effects" means that the unit will be dressed only on the machine, where the command was executed (doesn't happen with many inventory commands, although there are a few obscure)
And remoteExec then makes it run on all clients where player effectivly refers to theyre player?
exactly
Very good
This sure comes in handy knowing
Thanks alot!
Have a quick question thought
Completely unrelated
If i define cfgMusic with a custom song, can I run that song on all players being gamemaster or adminLogged if I allow debug menu in my mission for host or adminLogged
With playMusic right?
I know how to play it with triggers, but not by scripting
Hmm let me check that on the wiki ๐
Big L on top
RemoteEcex is needed then right?
Like a function in init.sqf
yeah
And then call that function with remoteExec from debug menu?
that's what I'd do
Since it apparently is impossible (without modding game) to add it to Zeus
I think it's pretty much impossible
Shouldn't be though
I mean you could probably make something, but it'd be ugly
What's going on?
We're all making fun of you, Akryl
@little eagle Is it bad practice to put most things in functions?
I'd say that it's good practice to put things in functions
private ["_keyArray","_currentAO","_currentAOGrid","_targetPos","_targetString"];
_targetString = _this select 0;
_targetPos = _this select 1;
_targetMsg = _this select 2;
_markerType = _this select 3;
_markerColor = _this select 4;
_markerShape = _this select 5;
_getKey = [] call GG_fnc_markerKeyGenerator;
_currentAO = createMarker [(_targetString) + _getKey,_targetPos];
_currentAO setMarkerShape _markerShape;
_currentAO setMarkerType _markerType;
_currentAo setMarkerColor _markerColor;
_currentAO setMarkerText format [_targetMsg,_targetString];
_currentAO; ```
Then calling that from anything I like isn't bad practice?
Thats old code by the way @little eagle I wrote my code into a "generalised" function I could plug whatever into
delete line 4-9 an replace private wth params
Was going too
you can use private _currentAO = createMarker.... instead of initializing with private
If I try to create a subject that already exist
no idea. try what happens
Over-writes it I'm pretty sure.
Hmm well it doesn
doesn't create two of it
Or bugs out any way
Sooo maybe I'm good?
Or maybe I should just create the subject in init
@little eagle Thats from my I&A version
So that it aldready exist
And then add stuff to it
So I'm sure
Well thats it for today
Thanks for the help guys!ยจ
[["_targetString",""]],
[["_targetPos",[0,0,0]],
[["_targetMsg",""]],
[["_markerType",""]],
[["_markerColor",""]],
[["_markerShape",""]],
[["_getKey",0]],
[["_currentAO",""]]
];
_getKey = [] call GG_fnc_markerKeyGenerator;
_currentAO = createMarker [(_targetString) + _getKey,_targetPos];
_currentAO setMarkerShape _markerShape;
_currentAO setMarkerType _markerType;
_currentAo setMarkerColor _markerColor;
_currentAO setMarkerText format [_targetMsg,_targetString];
_currentAO;
better?
@little eagle
I don't think _getKey and _currentAO are arguments of that function
They are.
key generators to ensure markers have a unique key
Which it does exactly that
but you just overwrite them
Doesn't look like it
why would they be arguments, if the arguments do nothing?
I think you'd just put the private keyword before the variable when it's defined
private ["_target","_targetPos"];
_target = _this select 0;
_targetPos = _this select 1;
_AOMarkerIDs = [
_target,_targetPos,
"Take %1","o_inf",
"colorOPFOR","ICON"] call GG_fnc_createMarkerIcon;
_AOMarkerGridIDs = [
_target,_targetPos,
"","",
"colorOPFOR","ELLIPSE",
750,750,
"FDiagonal",1] call GG_fnc_createMarkerEllipse;
_ret = [_AOMarkerIDs,_AOMarkerGridIDs];
_ret;
Thats the code that calls the other code
params [
[["_targetString",""]],
[["_targetPos",[0,0,0]],
[["_targetMsg",""]],
[["_markerType",""]],
[["_markerColor",""]],
[["_markerShape",""]]
];
private _getKey = [] call GG_fnc_markerKeyGenerator;
private _currentAO = createMarker [(_targetString) + _getKey,_targetPos];
_currentAO setMarkerShape _markerShape;
_currentAO setMarkerType _markerType;
_currentAo setMarkerColor _markerColor;
_currentAO setMarkerText format [_targetMsg,_targetString];
_currentAO
This is all old legacy code.
Ohh so
only use params?
If you expect args to be passed?
use private otherwise?
params is only for arguments the function is called with
so is private _var
private keyword, yes
yeah
And you don't have to write the variable name twice
And you'll never forgot one variable
it's great
True
Definitely time saver
See why I did the above was because I've systematically been replacing I&A's guts
Completely.
params ["_target", "_targetPos"];
private _AOMarkerIDs = [
_target,_targetPos,
"Take %1","o_inf",
"colorOPFOR","ICON"
] call GG_fnc_createMarkerIcon;
private _AOMarkerGridIDs = [
_target,_targetPos,
"","",
"colorOPFOR","ELLIPSE",
750,750,
"FDiagonal",1
] call GG_fnc_createMarkerEllipse;
[_AOMarkerIDs, _AOMarkerGridIDs]
The I&A creates it's vehicles is like this
_staticsArray = [_enemiesArray] call GG_fnc_createStatics;
sleep 1;
tickInStatic = diag_tickTime;
if (_x == PARAMS_StaticMG) exitWith {};
}; ```
for "_x" from 1 to PARAMS_VehPatrols do {
_randomNum = floor(random 3);
_MRAPPatrolArray = [_randomNum,_enemiesArray] call GG_fnc_createVehicles;
sleep 1;
tickInMrap = diag_tickTime;
if (_x == PARAMS_VehPatrols) exitWith {};
};
It uses for-loops to create vehicles
The biggest issue with this particular code
is it runs within the scheduled environment
and depending on how many clients are connected can blockade the servers startup
not to mention severely slowing itself down with those sleeps
Particularly if I remove the sleep 1;
No remove the sleeps it makes the entire code literally lock up
This is where commy2 steps in and starts preaching unscheduled
Actually I just thought of a smarter way to create the vehicles
Hard not to
I use an event handler on the tower and link the vehicle creation to that.
place them with the editor /s
and unhide them as needed! Brilliant!
I want to be a veteran, where do I sign @little eagle ? ๐
scheduled wont block anything
maybe another script is waiting for the completion for this particular spawn script?
Idk. I got my blue name one day.
Oh, well, let's see if I can get that, I like blue
maybe another script is waiting for the completion for this particular spawn script?
He explicitly said scheduled -> blockade startup
Where is X39
I want that GUI editor
Yes, maybe another script wait's for the completion of the scheduled spawn script
who knows
enInfantryArray =[currentAO] call GG_fnc_setupEnemyInfantry;
enVehicleArray = [currentAO] call GG_fnc_setupEnemyVehs;
And thats run from a spawn'd piece of code
We can hope
well, good night ppl
If there are enough spawned threads running, everything will bog down as each script waits its turn
_loopTimeout = 20;
while { true } do {
// _mission = _missionList call BIS_fnc_selectRandom;
// _missionList
_AO = compile "GG_fnc_regionManager";
_SelectRand = floor(random(count(_missionList)));
_currentMission = [] spawn (MissionNameSpace getVariable "GG_fnc_regionManager");
diag_log format ["Mission Selected %1",_AO];
waitUntil {
sleep 5;
scriptDone _currentMission
};
sleep _loopTimeout;
};
You just have to have a slow enough machine and the switching between all the virtual threads eats up the 3 ms^^
Thats the issue?
It's a function name
BoGuu, the difference might be that you use a desktop pc, while i'm using my notebook from 2011
I ran a completely exponentially recursive function to grind myself to a halt ๐
obfuscation?
ohno
I am obfuscated
It still uses english words. Not obfuscated enough.
AO is english?
Assume AO is the area of ops, but more importantly, regionManager is rather descriptive
Means nothing to us ๐
Unless that's actually your obfusctated name for....oh, very sneaky
This was a rushed design @little eagle
Region manger did exactly that
Manage the entire "region" of the map
but
It was never commented because I didn't have time.
why the compile ๐ค