Jump to content
Sign in to follow this  
infiltrator_2k

How Did You Learn To Script?

Recommended Posts

I'm interested how individual people have learnt to script, how long it took them, the resources they used, the best way method of learning and if they have any tips, advice to pass on to others like myself. I've grasped the logic, but looking at the code along with all the different characters and spacing appears daunting to merely look at. Is it through memory that you remember where and what goes where, or is it setting out the algorithm in orderly fashion that guides you to what goes where. Is the code forgiving? Will throw an error is a character isn't spaced exactly in the right position for example?

Please share your unique experiences with learning how to script with dos and don'ts and any information that you think will help potential scripters.

  • Like 1

Share this post


Link to post
Share on other sites

I started in late Arma1 (didn't touch the editor in OFP). No outside coding experience what so ever. I picked up Mr. Murray's editing guide and it went from there. Been learning every since. Ofcourse it's always good to look at others scripts to see how they did/do things. Also, I find that, after many months of prolonged scripting, it's good to take a few months break. When you come back, all of the things you've learned (or thought you learned) sink in really well. Things that you maybe didn't previously understand or could get your head around... seem to fall right into place :)

Share this post


Link to post
Share on other sites

Arma 2 Started on. Now arma 3 feels alot easier, as mentioned above a long absence works well.

Now also doing an Open University Java Course which Arma is actually really helping with because I can visualize all of the concepts with Arma examples :)

I find Doing something then studying about it is always better because you engage with the concepts because you have previously searched for that answer or attempted to contextualize something that you then learn the definition to.

  • Like 1

Share this post


Link to post
Share on other sites

Got an interest in making missions. At first I didn't dare to touch scripting and I tried to keep everything in the editor window. Now I just lurk around here and always consult community.bistudio.com/wiki/Category:Scripting_Commands_Arma_3

And remember google is the collective knowledge of the internet, always ask!

Share this post


Link to post
Share on other sites

I started with an intrest in learning java and etc for applications. I then got into the whole arma scene around 7 Months ago. Started with a server that hosted the TCG Island Life mod. I asked if I could do the mission. I had a very interest in coding. I learned how to code the sqf's I thought it was a lot funnier then coding Java for Phones :D. I learn quite fast so I consider myself pretty advanced now just lacking the memory part of coding :P

Share this post


Link to post
Share on other sites

I learned to script roughly same time, I joined this forum. Started with old SQS, here is some details, why.

Anyway, without any real programming knowledge, first step was most difficult. Possibility - as much time, as I wanted. Base - mostly other scripts, BIKI, this forum... Method - practicing by changing/improving others work and mostly by coding own ideas starting from simpliest. Motivation - frustration and boredom. My video card died, and with secondary I was able just to run only A2 (I returned to it after long break) and only on minimal settings and very poor resolution. Enough to script, not enough to enjoy the game. That's boredom source. Frustration - some features was for me badly lacking in A2. Especially AI unable to use artillery. I dug through Armaholic searching for solution, found some scripts and tried to apply them without real knowledge, how to (such very basic knowledge about script usage, I was lacking, is usually assumed, so frankly I was unable to find any explantion, was forced to understand this by analyzing ready scripts).

I really do not remember moment, when I grasped that, but probably first script, I was working with and learning most basic things was Nice_Boat's Tank Damage System written in SQS. After that I was able to write own SQS scripts continually expand the knowledge about possible commands and logic structures. Whole September that year I sacrificed to my first own serious project - Rusty Sands mission. Then I jumped to the SQF (under above link), after that - this was simply avalanche. I finally was ready to make AI artillery handler, FAW, a month later in few weeks made first HAC version (from the scripting side it was total crap, full of bugs, wrongly used code and badly designed, I think, still very challenging and rewarding work for me that time, and people liked it), after few next HAC versions I made Rincewinder to master functions concept etc., and so on...

My advices - step by step. Have an idea to script, then seek solution, how to script it. Start with simpliest, do not try to grasp everything at once. Enhance your knowledge base according to current needs. Every problem try to solve on your own. When attempts fail - do some break, try to rethink approach, try again. Only when your progress is stuck beyond any doubt, you did all, you could without effect - ask for help, but then ask boldly. Just avoid a trap of lazy thinking "Do not know, how to, script is not working, so I'll ask people, let they do it for me". No. Never give up so easily. When you don't know, there begins real learning, so learn yourself, such way posessed knowledge is grasped optimally and ready to use, while knowledge provided by others must be digested and matched before would serve well. Learning (by doing) is best way to learn. If all constantly fails despite efforts, or you don't like this occupation - just know, that probably, as all things, scripting isn't for all... Or be stubborn. :) Is needed time, patience, determination and some inclination, I think.

Edited by Rydygier

Share this post


Link to post
Share on other sites

I just got started about a week or two ago. Picking apart missions to change stuff and whatnot.

Share this post


Link to post
Share on other sites

The main chore with scripting is the testing and working out why things don't work as they should/ at all.

The main thing you need is a test template mission setup with a player, AI, a few vehicles, triggers, markers, lots and lots of traffic cones, init.sqf, description.ext, blank .sqf files with handy bits of code for debugging already in them eg:

//hint str

//diag_log

//player sidechat str

//onMapSingleClick "player SetPos _pos; true;";

Every time you need to test a new idea you can copy the contents of your template folder into the mission folder, it saves hours of time setting up new missions and testing.

You can also have a basic function library too, setup ready to go.

Edited by Mattar_Tharkari

Share this post


Link to post
Share on other sites

about a year ago, started first just googling what i wanted to do and working from there.

eventually moved onto looking at said scripts I found when googling and learning from them to the point I was rewriting them for my own purposes.

no guides just learning as I went and reverse engineering (even though it seems a lot of people frown upon this, I wouldn't have gotten to the point I am now without doing it)

Share this post


Link to post
Share on other sites

It seems everyone has their own unique method of learning and there are no formal rules other than analyse other scripts and write your own, and if the script fails, find out what made it fail and correct it whilst learning from your mistakes and things will inevitably and naturally progress from there.

With the above in mind BIS' Wiki is of course a valuable resource for any budding scripter as it has all the commands indexed - what they're used for and more importantly examples of how they are applied.

Share this post


Link to post
Share on other sites

I learned by having a look at some other missions but mainly by going and having a look over at the Biki as that's an absolute gold mine. I also had some help from [EVO] Curry, but we both help each other out nowadays.

Currently I am writing my own logistics script as a little technical exercise for a new mission I am making.

Share this post


Link to post
Share on other sites

I started goofing around with the editor back in OFP. But since I was a child back then and didn't have internet access at the time I didn't even know there were such things like scripts. I was just facinated by placing trucks and helos and let them drive around the island using waypoints. :D

Later, with Arma I build some very simple missions for playing with my friends. Still no scripts, not even proper endings or tasks and still no own internet access. A friend always downloaded mods and stuff for me but we both didn't really know how to use the editor.

Then, Arma 2 came (and finally my own internet access *yay*) so I started to learn scripting with Mr. Murrays editing guide. Great ressource btw. At first I didn't really know what I was doing but eventually things started to work; after a lot of failing... I started many projects, missions and two campaigns that I sadly never finished but still released.

I took a few years of break, barely touching Arma until Arma 3. Now, I released one SP-Mission and I'm working on the last mission for a small campaign.

When I compare my code today with what crap I produced in Arma 2 times... It's got a lot better now, though it's not anywhere near the professionality that BIS or other members here show. Anyway, trying and failing, guides and of course the forums have been the best teachers for me so far. Also useful was that I studied (and still do for my masters) Computer Science and worked as a student for a small development company. That tought me many handy things you won't see in any guide but that are quite useful. Like how to organise your work, systematic testing, code structuring; backround knowledge that can be applied on any programming or scripting language.

So, keep on trying and don't forget to take some breakes from time to time. I think I've been an Armaholic for nearly eight to ten years now, though not continiously. :)

Share this post


Link to post
Share on other sites

Started scripting properly when ArmA 3 Alpha was released. Although i had some experience with sqf format with ArmA.

Share this post


Link to post
Share on other sites

I started back with OFP in around 2002. For the longest time I managed to get by with typing stuff into the init or on activation fields in the editor. Every time I wanted to do something that I didn't know about, I would head over to the community wiki and look up the relevant commands.

One day I decided that I wanted to make a mission in which a group of 8 randomly selected opfor units would spawn and then repeatedly patrol around the perimeter of a trigger. I realised this would be too much to practically put into the editor so I wrote a simple script that randomly selected the units, spawned them, and gave them a set of waypoints whose location was calculated based on the size and orientation of the trigger. Although this script was quite simple, it was a watershed moment for me because suddenly I realised that I could do anything! A small amount of tweaking and my simple little script would create an amphibious invasion in which 20 boats full of opfor hit the beach--all without having to place anything in the editor.

If I were to come up with some advice, it would be to try a little project in which you forget about building a mission for just a second and focus purely on wrting a script to do something cool. Spawn a group that patrols some random waypoints, write a script that has a jet fly overhead at random intervals, write a script so that when one group of defenders dies it is automatically replaced by another. Once you've had the awesome feeling of watching a whole bunch of stuff happen according to your script, you'll want to script everything.

One last point: note that all of the scripts above are general purpose. This is something really great about writing stand alone scripts rather than doing everything in the editor. Once I have written my patrol script I can use it in every mission just by copying the script into the mission's folder. Before long you will have a personal library of scripts that will help you to develop complicated missions much more quickly than would otherwise be possible.

Share this post


Link to post
Share on other sites

Also if you can understand this but learn Big-O notation with regard to programming. This will help you make efficient scripts if you ever get to that level.

Share this post


Link to post
Share on other sites

Hmm where did it all start HERE is the earliest memory i have with Compaq Basic, quickly followed by IBM XT and GWBasic (man those things were built like tanks) that my father would borrow from work.

I was lucky enough that my father was also on the board of the local education committee so every school break our house would acquire a PC or BBC, purely to keep them safe during the school break you understand ;) .

From there my first ever computer was a ZX Spectrum for christmas where i, over several years, went from learning how to make a ZX Basic invaders game to Z80 assembly language and some C. Even made my own IDE for it taking my cruedly written assembly and poking it into memory, are they were the days ;) .

Since then ive been to college and done a course in C/C++, modded for numerous games using LUA LISP C C++ QuakeC :D (big ID fan)(and several other game specific API's) messed around with javascript and PHP for some basic website designs. Although funnily enough ive never touched java or python which seem to be a stable for alot of people i talk to.

As for ARMA i have played the series since OFP but after taking one look at sqs i though @!~# that and never touched it again till IronFront.

Having spent the last 8 years with my head burried in the DOOM3 SDK and scripting language, with the imminent release of ARMA3 and with much moaning and hinting from a friend that he wanted my help I started my foray into ARMA scripting at the begining of ALPHA.

As for where to start, get a nice decent format to your code and stick as close to it as possible, something you find easy to read, good clean readable well documented code , I really cant stress how important this part is. Trying to learn from messy code or going back to code youve recently written to help you remember, does you absolutely no good if you cant read it or tell at a glance what it was meant to be doing.

HERE is a good starting point. Follow all the further reading links.

Think the others have covered most things , a link to ARMA 3 Command List is a must.

Start small, take regular breaks and I don't mean script in the morning take a 3 hour beak, but as other have mentioned, If you find yourself hitting a wall dont be affraid to take a week or month out then come back its amazing what sinks in.

A Decent text editor with syntax highlighting and even some kind of auto code completion is a great help.

Most of all have fun, if it aint fun whats the point.

And of course not to forget this forum, their are some great members here always willing to help out even if it is the 1000th helicopter reinforcement thread :D props to the guys here.

Then when you have surpassed us all dont forget to come back and share your knowledge.

Edited by Larrow

Share this post


Link to post
Share on other sites
Hmm where did it all start HERE is the earliest memory i have with Compaq Basic, quickly followed by IBM XT and GWBasic (man those things were built like tanks) that my father would borrow from work.

I was lucky enough that my father was also on the board of the local education committee so every school break our house would acquire a PC or BBC, purely to keep them safe during the school break you understand ;) .

From there my first ever computer was a ZX Spectrum for christmas where i, over several years, went from learning how to make a ZX Basic invaders game to Z80 assembly language and some C. Even made my own IDE for it taking my cruedly written assembly and poking it into memory, are they were the days ;) .

Since then ive been to college and done a course in C/C++, modded for numerous games using LUA LISP C C++ QuakeC :D (big ID fan)(and several other game specific API's) messed around with javascript and PHP for some basic website designs. Although funnily enough ive never touched java or python which seem to be a stable for alot of people i talk to.

As for ARMA i have played the series since OFP but after taking one look at sqs i though @!~# that and never touched it again till IronFront.

Having spent the last 8 years with my head burried in the DOOM3 SDK and scripting language, with the imminent release of ARMA3 and with much moaning and hinting from a friend that he wanted my help I started my foray into ARMA scripting at the begining of ALPHA.

As for where to start, get a nice decent format to your code and stick as close to it as possible, something you find easy to read, good clean readable well documented code , I really cant stress how important this part is. Trying to learn from messy code or going back to code youve recently written to help you remember, does you absolutely no good if you cant read it or tell at a glance what it was meant to be doing.

HERE is a good starting point. Follow all the further reading links.

Think the others have covered most things , a link to ARMA 3 Command List is a must.

Start small, take regular breaks and I don't mean script in the morning take a 3 hour beak, but as other have mentioned, If you find yourself hitting a wall dont be affraid to take a week or month out then come back its amazing what sinks in.

A Decent text editor with syntax highlighting and even some kind of auto code completion is a great help.

Most of all have fun, if it aint fun whats the point.

And of course not to forget this forum, their are some great members here always willing to help out even if it is the 1000th helicopter reinforcement thread :D props to the guys here.

Then when you have surpassed us all dont forget to come back and share your knowledge.

Great advice Larrow. I'm astonished at your wealth of experience at coding. I think it's fair to say you've been coding a while :) From people's posts I've discovered that poorly coded scripts will still run (albeit poorly), so attention must be focused on making clean and clear scripting. I suppose you could liken scripting to writing literature in the sense that a sentence could contain dribble that takes 500 words to describe something that should have taken 50 letters in a single line.

So cleaning up a script would be a screenwriter's equivalent to what's known as 'trimming the fat' from the screenplay. I've studied writing screenplays in the past, so if I apply the same principles I'm sure I should do fine with some help a long the way.

Your point of learning from well written code is a good one and makes sense. It could after all take you a long time to discover having made that mistake. If I can give any fellow budding scripter a point from where to start it will be definitely be by starting from HERE

I think I'm going to start small by putting a few command lines in a player's initialization and activation fields. I've created a mission that's taken me many hours to create on and off, and the only thing it's lacking is small but important tasks - tasks that add depth to a mission, and something that's more than just killing the enemy, i.e. retrieving documents from a downed aircraft lying in the deepest part of the ocean that requires you to kit out for the task etc...

Share this post


Link to post
Share on other sites
Great advice Larrow. I'm astonished at your wealth of experience at coding. I think it's fair to say you've been coding a while

There are people lurking here with way more programming knowledge than me :d: , ask me about windows API or .NET and ill generally be at a loss. I mainly consider myself a hobbyist game scripter at heart, way to many years messing around in game engines.

From people's posts I've discovered that poorly coded scripts will still run (albeit poorly), so attention must be focused on making clean and clear scripting. I suppose you could liken scripting to writing literature in the sense that a sentence could contain dribble that takes 500 words to describe something that should have taken 50 letters in a single line.
When starting out just concentrate on clean and clear, dont worry if its 500 lines of dribble as long as it does what its meant to and you can read it when you go back to it in a months time.

Finesse and optimization come later. You will regularly notice these times when you go back to look at old code and say to yourself 'What the !%*& was i thinking there, I could of done that in 10 lines'.

Dont be afraid to set yourself small task to get familiar with syntax, does not even have to be ARMA related. Start with an array of [1,2,3,4,5,6,7,8,9] and just do simple things like ordering them highest to lowest using only basic syntax and commands (e.g dont use BIS fnc's) or placing helper arrows down in the editor and moving them around via small scripts in the debug console.. Hell i spend more time sat with just a player in a map and doing stuff from the debug console than i do anything else.

Share this post


Link to post
Share on other sites
There are people lurking here with way more programming knowledge than me :d: , ask me about windows API or .NET and ill generally be at a loss. I mainly consider myself a hobbyist game scripter at heart, way to many years messing around in game engines.

When starting out just concentrate on clean and clear, dont worry if its 500 lines of dribble as long as it does what its meant to and you can read it when you go back to it in a months time.

Finesse and optimization come later. You will regularly notice these times when you go back to look at old code and say to yourself 'What the !%*& was i thinking there, I could of done that in 10 lines'.

Dont be afraid to set yourself small task to get familiar with syntax, does not even have to be ARMA related. Start with an array of [1,2,3,4,5,6,7,8,9] and just do simple things like ordering them highest to lowest using only basic syntax and commands (e.g dont use BIS fnc's) or placing helper arrows down in the editor and moving them around via small scripts in the debug console.. Hell i spend more time sat with just a player in a map and doing stuff from the debug console than i do anything else.

ATM I'm just analysing the mortar script you rewrote and cross referencing what's been written with Biki. It's definitely not a script for newbies :)

Share this post


Link to post
Share on other sites

I started scripting when i bought ArmA 3(Yes, couple o' months, don't criticise please) and when i discovered the power of the editor i started watching videos and then noticed how every alternate video had this cool 'code' in it. I headed over to the wiki to find about how this code can be used in different situations. I was amazed and then looked into writing scripts. Now i can try to write scripts with a 50/50 chance of it actually working(Calm down, i suck at it but please be patient)I referred to the wiki, here:

https://community.bistudio.com/wiki/Category:Scripting_Topics

(You can too!)

I found that to be a great tool

Obviously, the helpful community is always here to post and help on your thread(You must have observed all the people on this post)

To conclude, i would like to suggest a small guide i started.

http://steamcommunity.com/sharedfiles/filedetails/?id=180166308

Share this post


Link to post
Share on other sites

Anyone reading this thread should take away two things. Try it yourself! And lots of practice. Those two things are enough to get you well into scripting.

The community in this site will fill in any missing gaps. Some of the most helpful people on the internet.

Finally. Whatever skill and knowledge you gain, pass it on and keep this game moving forward.

Share this post


Link to post
Share on other sites

Started in OFP, learned by trial and error way, and looking/using/editing other peoples' scripts.

Advice part Rydygier already summed up quite nicely.

Share this post


Link to post
Share on other sites

By copying from what others did and reading these forums.

Didn't even have computers at school so was all new to me.

Share this post


Link to post
Share on other sites

I had some past experience with programming so that helped with the basics of coding loops and ect. I started scripting in Arma 2 and just had some simple things that I needed to do with scripts so I started just with a simple tasks of spawning some units at a marker location in the editor for a counter attack. From there I moved on to other things.

kylania's website was a great help with examples when I was new. He had a bunch of scripts that a person could use as examples and then get used to scripting. kylania's Web Site

Another site was Killzonekid's it is a little more useful to Arma 3 and covers some more advanced topics but you could find some good examples on there as well. KK's Web Site

Be patient and persistent and learn from your mistakes. You will always learn new ways of doing things.

Also document and comment your code and keep a library of scripts that you write so you can use them at a later date instead of rewriting them later on.

Good Luck

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  

×