[help] diag_logs, arrays, and strings. Serverside vs client side scripting?

mmmyum

Valued Member!
Two things guys, just a little unsure about.

Some people are having trouble with some scripts of mine, and I'm trying to get them working for everyone.

I'm unclear as to the difference in executing scripts or commands server vs client side - as in if I call in the mission.sqm or init.sqf of the mission.pbo, will these be executed server or client side? I'm creating vehicles to play sounds/cause exploisions, and there may be some sync issues.

So I am debugging, adding new diag_logs and whatnot to make the RPT log show exactly what is happening - in creating a variable to hold the position data of the vehicles as they are created - ie _pos = position _sound; (where _sound is the vehicle creating a siren). Then I am showing them in the diag_logs to make sure they match their intended target (no dual bombings, or inaccurate, or whatver).
----This works beautifully for the target, the siren sound vehicle, but when I try to get it for the _espl (explosion vehicle) it returns only 'array' and none of the location data.
--------I tried putting str(_pos2) to convert the array into a string, no luck there

Here is the code I'm talking about.
_pos2 = position _espl;////////////////////////this is returning array...why not any of the others
diag_log format ["AIRRAID: BOMB: %1 | TARGET: %2 | SHOULD MATCH APPROX",str(_pos2),_targetpos];

I'm still working on this, but I'm just experimenting at this point - I guess I can do a _pos2 select 0; etc, but why would that not work when my other _pos and _pos1 are working perfectly?

See posts in my airraid thread near the bottom for more info.
 
Oh, and does any one know of syntax highlighting for notepad++, and lastly, how do you have your testing server set up? Is there a way to make changes while the server is live/execute new code while the server is live?

Forgive my ignorance, I am still learning.
 
Oh, and does any one know of syntax highlighting for notepad++, and lastly, how do you have your testing server set up? Is there a way to make changes while the server is live/execute new code while the server is live?

Forgive my ignorance, I am still learning.

search for Arma script recoded - this one requires an older notepad++ version, but has some huge advantages over the general syntax only highlighters.

additional features:

- searches in pbos
- full highlightning
- folding of code (you can fold function, if statements etc.
- direct function reference via popups

testing server: no way, you need to restart, all files are locked while the pbo is active.
 
search for Arma script recoded - this one requires an older notepad++ version, but has some huge advantages over the general syntax only highlighters.

additional features:

- searches in pbos
- full highlightning
- folding of code (you can fold function, if statements etc.
- direct function reference via popups

testing server: no way, you need to restart, all files are locked while the pbo is active.
Sarge, this is exactly what I wanted. Thank you. Here's a link!

I guess I'll just install a local server so I don't have to ftp upload every time I miss a semicolon, at least that will shorten my process.

Thanks again Sarge!
 
Two things guys, just a little unsure about.

Some people are having trouble with some scripts of mine, and I'm trying to get them working for everyone.

I'm unclear as to the difference in executing scripts or commands server vs client side - as in if I call in the mission.sqm or init.sqf of the mission.pbo, will these be executed server or client side? I'm creating vehicles to play sounds/cause exploisions, and there may be some sync issues.

So I am debugging, adding new diag_logs and whatnot to make the RPT log show exactly what is happening - in creating a variable to hold the position data of the vehicles as they are created - ie _pos = position _sound; (where _sound is the vehicle creating a siren). Then I am showing them in the diag_logs to make sure they match their intended target (no dual bombings, or inaccurate, or whatver).
----This works beautifully for the target, the siren sound vehicle, but when I try to get it for the _espl (explosion vehicle) it returns only 'array' and none of the location data.
--------I tried putting str(_pos2) to convert the array into a string, no luck there

Here is the code I'm talking about.
_pos2 = position _espl;////////////////////////this is returning array...why not any of the others
diag_log format ["AIRRAID: BOMB: %1 | TARGET: %2 | SHOULD MATCH APPROX",str(_pos2),_targetpos];

I'm still working on this, but I'm just experimenting at this point - I guess I can do a _pos2 select 0; etc, but why would that not work when my other _pos and _pos1 are working perfectly?

See posts in my airraid thread near the bottom for more info.

I really recommend to read up on locality on the Arma 2 forums / biki. There are major differences if executing code server or clientside or both, and very deep pitfalls in regards of functionality and performance.

a) use getPosASL if you dont care about the height (which i assume). This one is way faster than position or getpos.

b) if unsure, do a count _pos2 -> if that delivers 0, there simply is nothing in the array.

c) str is never needed, format converts the array to a string already

cheers, Sarge
 
Sarge, this is exactly what I wanted. Thank you. Here's a link!

I guess I'll just install a local server so I don't have to ftp upload every time I miss a semicolon, at least that will shorten my process.

Thanks again Sarge!

I run my testserver in a VMware VM ... even had that thing running a fully blown 50 slot wasteland server that made it to #30 in the rankings -), while playing on the same comp :)
 
Sarge, this is exactly what I wanted. Thank you. Here's a link!

I guess I'll just install a local server so I don't have to ftp upload every time I miss a semicolon, at least that will shorten my process.

Thanks again Sarge!

Well, i am in a good mood today and will give you the archangel of hints ....

Google for "squint".

this is a parser for sqf files, which finds all that nice stuff like missing brackets, missing semicolons, generates your private [""] declaration and so on.

That one is a real timesaver.
 
@Sarge once again, you are a hero! Thank you!

I will continue to read more into locality, thanks, and yes I've been reading through other scripts - they all seem to use getPosASL as you suggested, I will change these.
b) Didn't think of this last night, excellent plan. Maybe because the createvehicle is just an explosion, it gets deleted as soon as it is made so I can't get it's position, or something.
c) Makes sense, I will remove it.

I'll throw a VM up for my test server, I used to have a local instance just running on the same pc, no VM at all (ages ago though), but pwnzors wouldn't load sql for me when I just tried that. What package are you using for your tester? Reality?

Lastly, Squint -- honestly, Sarge, I think I love you. You are just my best friend today, thank you so much.
 
;-)

I am not using a specific pack. The basis of my server install is a Crosire pack, and that got heavily modded ;-)
 
;-)

I am not using a specific pack. The basis of my server install is a Crosire pack, and that got heavily modded ;-)
Sarge, one more time I must thank you. Squint is my favourite new tool. It is saving my code.

I'm running into this issue (thanks to you, solved all my others!) where I'm getting my pilot killed - I'm learning from some AI code and the animated heli crashes code, and yet for some reason even with your variable set to 1 like in the animated heli crash code, she gets killed every time, no matter what I do.

I'm probably just doing something wrong, not sure where though. Hate to bug you for so much help, but if you've got a minute I'd appreciate you looking at my code.

pasebin of the code I'm using, called via mission.sqm

http://pastebin.com/YMKDSpYJ

Here's the RPT excerpt: see 12:57:11
Code:
12:57:03 "RANDOM WORLDSPACE: Vyshnoye | [6590.32,6029.11,1.5]"
12:57:05 Warning: z\addons\dayz_communityassets\models\razor.p3d:0 Error while trying to generate ST for points: 214, 349, 208
12:57:06 "RANDOM WORLDSPACE SELECTED: 48 | City: Vyshnoye | Coords: 6590.32  6029.11 |||Try 30"
12:57:06 "AIRRAID: SEL: [6590.32,6029.11,1.5] | TARGET: [6590.32,6029.11,1.5] | SHOULD MATCH APPROX"
12:57:08 "AIRRAID: BOMBER: UH-1H | Lift Off at [6993.7,173.053,300] | with Backup WP [7492.67,15263]"
12:57:08 "AIRRAID: BOMBER: UH-1H | TYPE: UH1H_DZ |"
12:57:08 "AIRRAID: BOMBER: UH-1H started flying from [6993.7,173.053,300] to [6783.29,5831.23] NOW!(TIME:4|)"
12:57:08 "AIRRAID: BOMBER: LANDINGZONE: [6783.29,5831.23,0] | BOMBER POS: [6993.7,173.053,193.816] | POS LAND: [6783.29,5831.23]"
12:57:11 "CLEANUP: KILLING A HACKER Haley Smith C 1-1-B:1 REMOTE IN UH1H_DZ"
12:57:12 Client: Object 3:28 (type Type_69) not found.
12:57:12 Client: Object 3:28 (type Type_70) not found.
12:57:24 "Deleting object UH1H_DZ with invalid ID at pos [1629.89,225.72,74.3035]"
....
12:58:55 "AIRRAID: INCOMING ATTACK: Sounding Siren at: any any | Repeat: 30| Type: 1 | Duration: 60"
12:58:55 "AIRRAID: POS: [6590.32,6029.11,1.5] | TARGET: [6590.32,6029.11,1.5] | SHOULD MATCH"
12:59:06 "DISABLED SIMULATION FOR 0 ZOMBIES IN 0 SECONDS"

PS, in process of changing random worldspace code to array or arrays, but it's working nicely right now, so I'm focused elsewhere.
 
Code:
//Spawn the AI-Heli flying in the air
                _startTime = time;
                _bomber = createVehicle [_heliModel,_heliStart, [], 0, "FLY"];
 
                //Make sure its not destroyed by the Hacker-Killing-Cleanup (Thanks to Sarge for the hint)
                _bomber setVariable["Sarge",1,true];                //I'm unsure what do to here, so I'm leaving it

use this one, the setvariable needs to be transferred to all comps, including the server.

The one you have further down for the helipad is not needed.
 
Code:
//Spawn the AI-Heli flying in the air
                _startTime = time;
                _bomber = createVehicle [_heliModel,_heliStart, [], 0, "FLY"];
 
                //Make sure its not destroyed by the Hacker-Killing-Cleanup (Thanks to Sarge for the hint)
                _bomber setVariable["Sarge",1,true];                //I'm unsure what do to here, so I'm leaving it

use this one, the setvariable needs to be transferred to all comps, including the server.

The one you have further down for the helipad is not needed.
How would I go about making it transfer to all groups? Is it just that ',true' you've added to the setVariable? Trying this now.
Thanks!

EDIT: seems to have worked! Thanks! Further testing the script now.
 
@Sarge - Script seems to be working now, though I haven't seen it in game. Lots of diag_logs to see what's going on.

Check it out if you want, here's a pastebin. http://pastebin.com/Uny13N9b

I'm calling it in a new way, in the dayz_server.pbo as well - though I'm not sure what effect this will have (hoping it fixes my issues with sirens only playing for one person, or at different times).
Added to precompiles the same way sever_spawncrashes is added
added to servermonitor same call as server_spawncrashes

I'm seeing output that looks good in my logs.

Still learning locality, I understand the different types of variables, but I can't grasp the differences between ways of calling the script (ie mission.pbo vs dayz_server.pbo, in mission pbo init.sqf vs mission.sqm)
 
@Anyone who knows about calling sounds
Having issues with the say command not playing for everyone/at the right time. Not entirely sure as I can't consistently reproduce it.

Anyway, I'm looking into different ways to call sounds - I want to call them from my script (executed via server_monitor in dayz_server.pbo) and have them play for everyone within range.

Here's what I posted as to what I'm trying right now.

So there looks like a problem with the say command maybe, I have not been able to test with more than one player to confirm, but it may cause multiple sounds to play for each player connected, or only leave one for the first player who connects.

I've been looking at two other ways to call it
Code:
_playNum = 50
while (_playNum > 0) do {
    if (isPlayer _x AND (_x distance _siren) < 1500) then {
_nul = [nil, _siren, rSAY, ["nam", 1500]] call RE; // This is a RPC sound call for the sound
} foreach playableUnits;
sleep 10;
10 fadeSound 1; // Fades sound in over time
};

this uses the rSAY to play the sound, with call RE to execute on remote clients.

also using this
Code:
_sirenSound = createSoundSource ["HeliHEmpty", position _target, [], 5];
But I'm not quite sure how it works, or if it will work for my purpose. Don't know where to tell it what sound to play.

1:16:05 Warning Message: No entry 'bin\config.bin/CfgVehicles/HeliHEmpty.sound'.
1:16:05 Warning Message: '/' is not a value
1:16:05 Warning Message: SFX not found

Getting these from the createSoundSource - so it's clearly not working. Trying to find the sound in HeliHEmpty.sound. Can I call "puk" or another of my custom sounds from CfgSounds?
 
Code:
//Spawn the AI-Heli flying in the air
                _startTime = time;
                _bomber = createVehicle [_heliModel,_heliStart, [], 0, "FLY"];
 
                //Make sure its not destroyed by the Hacker-Killing-Cleanup (Thanks to Sarge for the hint)
                _bomber setVariable["Sarge",1,true];                //I'm unsure what do to here, so I'm leaving it

use this one, the setvariable needs to be transferred to all comps, including the server.

The one you have further down for the helipad is not needed.
Fixed it, it seems!! Here's the post with the most up to date code. I just need to test it more in MP, cause I've only tested with one client connected.
http://opendayz.net/threads/air-raid-bombing-and-siren.9464/page-8#post-39038

Sarge, you don't know anything about sounds do you? or specifically, rSAY and call RE

I'm using these with success with one client connected - in two manners, one with a foreach playableUnit and one without. Works both times for me as the only client connected. No sync problems if I disconnect/reconnect either.

I'm continuing to test to see if it does make a difference, but I have to wait until some people come online to join my server and test with me, cause it's just me -- so I thought I'd ask to pick your brain one more time Sarge.

Thanks again for everything you've done, I don't think I would have got this working without you - you will get a special thanks when I release for real!
 
Back
Top