Jump to content
Sign in to follow this  
fuerst_von_butz

Multiplayer scripting - lack of documentation

Recommended Posts

Hello,

I'm really disappointed by the documentation of the scripting language. I've read that Mr. Murray bible and scrolled endlessly through the Biki. I understand the basics but I can't find the right resources to understand the deeper and complex parts of the scripting language. The best approach to it seems to extract and explore missions of advanced mission creators and learning by doing.

All the commands like exec, execVM, spawn, compile, preprocessFileLineNumbers, preprocessFile, terminate, scriptDone... are badly documented and I can't find out what those do and which of them are (still) relevant.

Are there any decent resources for this? Can someone explain which of the commands I really need to start scripts?

Cheers

Share this post


Link to post
Share on other sites

Play around with other peoples scripts, that how most people get better.

Share this post


Link to post
Share on other sites

i do agree and Ive been to about every site u can think of for help. I think a big part of it is having a lot of code examples help not just 2 or 3. most of the examples on the wiki dont fit my criteria. of how im trying to do code something. for me it makes progression slow down.

Edited by falconx1

Share this post


Link to post
Share on other sites

I am in a similar situation as I am new to scripting, but I must agree looking at other scripts from various missions you can learn how to do certain things, like putting a lobby pic up to attract more people to your server and also adding a loading pic. But I have also found that some of the documentation on wiki, may be incomplete, some dont have examples or easy to understand explanations. But one thing I have found out that the Arma community are very helpful when you need help with finding scripts to help you with your mission design, I have called upon them to help me out on many occassions, and they have been a great help. The one suggestion that I would recommend is that when you do get help from the community take some notes of what they have shown you and told you as most of them have been designing mission for quite awhile. This way you build up a resource of coding and scripts and then one day you will be able to help others.

Share this post


Link to post
Share on other sites

The best way to learn is to hack apart people's creations, I've found.

Next time you need some functionality that's available using somebody else's script, download that script and then pick it apart, looking at what it does and how it works. From that, create your own script that's tailor-made to your situation. After doing that a few times you'll start to understand the basic concepts a little better and how the engine works and you can continue to improve your scripts and missions as you go.

Once you have a large project going (like Invade & Annex for me) you'll be learning horrendously fast; I've got code I've written one or two weeks ago that I'll look at again and think "What the hell was I thinking?! Why was I using that crazy method when I could do this instead?"

Honestly, I'd say it's the same situation here as it is with scripting/coding/programming in a multitude of languages; there's good documentation on functions and syntax but information on good practice and optimisation is hard to find. A lot of people will ask a question and get a script in return that they'll just throw into their mission. Don't do that! Learn and understand it first (ya know that whole "teach a man to fish" analogy, right?).

Dependant on your level, I've found Sickboy's MP Editing Guide to be rather handy when it comes to scripting for a multiplayer environment. 'tis a little out-dated in places, but they're good guidelines.

Share this post


Link to post
Share on other sites

About Multiplayer:

Locality is a big par of ARMA. One of the things I only found out like way to late was that all scripts on the WIKI have these icons on top of them.

For example this icon: effects_global.gif.

It means that the effect of this command is global, transferred to all clients. If a command does not have this image it means it executing the script will only work on the client where it is executed.

Some of the things I learned, which might help you.:

-Triggers placed on map are local to all clients, their conditions are checked on all clients, their onAct are executed on all clients. Watch out with this if you are creating vehicle's in triggers since every connected client could potentially create a vehicle. Use isServer command to prevent this from happening.

-Triggers created in scripts with createTrigger are LOCAL.

-Time & sleep are commands which are highly inaccurate. Sleep 1 could actually last 2 seconds if a lot of heavy scripts are running. Same with the difference of the time variable. reading the var 2 times with a real-life-second in between could actually result in only having passed 0.5 in the time variable.... I use diag_tickTime for a reliable way ot timechecking. Also serverTime, a supposedly synced time var is currently broken on dedicated servers.

-Your player is local to yourself, this means other players are local to themselves. Some commands may be global but (above icon) but can only be called on the client where the object is local. For example moveIndriver. I could for example call something like myOnlineFriend moveInDriver vehicle. This however would not work because myOnlineFriend is local to himself and I can therefor not use this command on him from my client. You can check if these variables need to be local in order for the command to work on them by this icon: arguments_global.gif

-There is a huge difference in "my script works in the editor" and "my script works in MP/ on a dedicated server". For example playableUnits should be used in a multiplayer game to get all playabale units where in a offline/singleplayer game you should use switchableUnits.

_allPlayersAndUnits = (if (isMultiplayer) then {playableUnits} else {switchableUnits});

. Always test your script/mission in singleplayer (editor) and in multiplayer. Preferably even in mp hosted as a dedicated server.

About the WIKI:

I for one would love to see BIS switch their WIKI to a real wiki where everyone could improve pages.

Now I see it as a sort-of-ok documentation with has a lot of wrong information and is lacking a lot...

I don't now how many times I've been testing hours with a command because it had wrong information on it written in the WIKI. Take for example the showMap command.

The documentation says:

Description: Enable Map (default true)

That's everything it says. The first question which pops up is: Does it enable (display) the map, or enables it for usage? Just 1 simple line would improve this documentation so much.

Then the note which is written in the bottom, it makes things even more fussy:

In ArmA 2 - This command no longer works. The map is now an inventory item. It is kept under the weapon class name "itemmap". Example: unitname removeweapon "itemmap". To add again use unitname addweapon "itemmap".

It suggests that this command does not do anything from arma2 and upward. This is however false information. The function still works, if the player has a map and you enableMap false he will get a "Satellite interruption" message if he opens the map.

I bet tons of decent scripters wouldn't mind editing the wiki and adding useful information. It would only take 1 BIS Software Engineer to approve/disapprove articles and I bet the whole documentation would get better within a couple of months!

The showMap command is just one, but I came across a lot more commands with just lack any kind of information or which have wrong information. Look at time. The first note states that it shouldn't be confused with _time, a supposedly local variable which holds the time elapsed since a script is running. Lolwut?

Same with functions, barely any are documented on the WIKI. It wouldn't be that big of an issue if you could at least debug your scripts but since you can't more information would mean less trial-error programming which is currently a big part of arma scripting/modding.

So if anyone from BIS is reading this please consider moving to a real WIKI where the community contributes in decent information. It would greatly improve documentation on known commands and functions and would therefor greatly benefit the scripting community and quality of scripts/mods.

Edited by mindstorm

Share this post


Link to post
Share on other sites

define real wiki ... BIKI has disabled account registration because of ongoing massive vandalism ... yet sometime in futue it's gunna be linked to your account via BIProfile

Share this post


Link to post
Share on other sites
define real wiki ... BIKI has disabled account registration because of ongoing massive vandalism ... yet sometime in futue it's gunna be linked to your account via BIProfile

I am not sure how it worked before the disabled account registration / vandalism but from my point of view it only allowed comments and "talk pages". A wiki allows users to edit the whole content of pages and add pages (not saying BIKI didn't, I just don't know if it did).

Also it allows for moderators to rollback changes made by individuals (or even some sort of an approving system?).

Anyway, my suggestion would indeed be to allow registration again. With an approval system and moderators you would prevent any kind of vandalism.

Share this post


Link to post
Share on other sites

Oh, this helps ALOT! Great Thread. Thanks. Been struggling myself.

The customization side of ArmA is a Hobby all-in-itself. Genius!

The BIKI needs more/better practical in-game in-use EXAMPLES.

Share this post


Link to post
Share on other sites

afaik all registered users were able edit nearly any page since always, except the protected keyones

Share this post


Link to post
Share on other sites

And eta on the re-introduction of this? I believe it would greatly benefit the community.

Share this post


Link to post
Share on other sites

no eta, there is quite lot of important things in all about webs queue so i can't promise when ;)

but ofcourse i would like to stick to soon

Share this post


Link to post
Share on other sites

Thanks a lot guys, especially mindstorm for the detailed answer :)

I jumped back into it and am doing some progress in the locality area, but a wiki overhaul would definitely be beneficial.

Share this post


Link to post
Share on other sites

Best thing for mp scripting I found was to break up all actions into their own missions and test thoroughly. Once stable add to your main mission and test again. Long winded but u will learn quickly. Opfec editing site has some good stuff on mp and locality also.

Share this post


Link to post
Share on other sites

upgrades of wiki are on long term queue too, after sites and forums ;) ETA again unknown

Share this post


Link to post
Share on other sites

What a shame. There would be a lot that could be added for new scripters in order to help them.

Share this post


Link to post
Share on other sites

Do you have specific things you wanted to add? Some of us can edit so if you need some example added reach out and let us know.

Share this post


Link to post
Share on other sites

Not at the moment, it's one of those things "oh this would be a good example for others" and then you forget about it :)

Share this post


Link to post
Share on other sites

I don't think I could ever edit the actual pages for scripting commands. Only the comments. Some commands just don't have any real description and either no example or a useless example, but there was no way to fix it.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×