Home   Help Search Login Register  

Author Topic: Initializing scripts?  (Read 1929 times)

0 Members and 1 Guest are viewing this topic.

Offline Agent JB

  • Members
  • *
Initializing scripts?
« on: 27 Feb 2008, 20:44:27 »
Ok, because nobody replied to my first post, I decided to go out and dig through the internet. I found myself a few scripts, but them in the folder my mission files were put, but now I'm stuck. I cannot find a way to run the scripts. The chopper insertion script I had, I typed this exec "chopperinsertion.sqs"; and nothing worked. I deleted "this" and got an error, so I put it back and the game ran... but there wasn't any indication the script was running.
Any ideas on getting it to work?

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Initializing scripts?
« Reply #1 on: 27 Feb 2008, 20:54:39 »
Again, without any more info about what scripts are you using, dont expect any clear answers for your problems. It is almost like, hey guys, I made a mission and it doesnt work, what might be wrong there???

Offline Agent JB

  • Members
  • *
Re: Initializing scripts?
« Reply #2 on: 27 Feb 2008, 21:07:28 »
Madoble... I actually tried your script... but nothing worked with that either.  >:(
If you read my post, I mentioned that I couldn't find out how to run the scripts. The ones I downloaded were all to do with chopper extraction, but how do I make them work? But, as you asked for the types I'm using...
Airlift v1.644 (TJ72)
Copper Pickup (also by TJ72)
Mando Heliroute ArmA, (by Mandoble)  :whistle:

All those arn't working with the whole "this exec scriptfolder/scriptname.sqs" And I pasted them all in the folder of my mission.

I can't think of any other information to tell you.  :confused:

Offline Denz

  • Former Staff
  • ****
Re: Initializing scripts?
« Reply #3 on: 27 Feb 2008, 21:23:57 »
are you putting "this" in square brackets?
so
Code: [Select]
[this] exec "Scriptfolder\scriptname.sqs"note the quotation marks around the script.sqs and use a backslash not a forward slash for a script folder

Mandoble's scripts are in sqf format so need to be executed slightly differently.
I quote from the Mando_heliroute script header
Code: [Select]
[chopper, route positions array, flying height, landing true/fasle] execVM "mando_heliroute_arma.sqf"
« Last Edit: 27 Feb 2008, 21:29:04 by Denz »
I've got 'em right where I want 'em - surrounded from the inside!
Jerry "Mad Dog" Shriver, SOG Recon One-Zero
24/09/41 - 24/04/69

Offline Agent JB

  • Members
  • *
Re: Initializing scripts?
« Reply #4 on: 27 Feb 2008, 21:33:43 »
I wast putting the square brackets around "this" but ok...
I must confess that I'm a complete scripting n00b... so...
What does all that array, flying height and all that have to do with the script? How would I edit that?

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Initializing scripts?
« Reply #5 on: 27 Feb 2008, 21:37:22 »
Have you read the header of the mando_heliroute_arma.sqf and the rest of the scripts? In most cases script usage and examples are explained there.

Offline Agent JB

  • Members
  • *
Re: Initializing scripts?
« Reply #6 on: 27 Feb 2008, 21:51:59 »
I have scanned over them but it all looks like a jumble of words to me.
I'll dig into it and see what I can get out of it all.

Does all this script usage involve alot of command issuing? (i.e this exec or whatever)

Offline Denz

  • Former Staff
  • ****
Re: Initializing scripts?
« Reply #7 on: 27 Feb 2008, 21:52:33 »
no problem mate we were all new at some point ;)
Code: [Select]
[chopper, route positions array, flying height, landing true/fasle] execVM "mando_heliroute_arma.sqf"ok, the "chopper" I take it is the name of the helicopter.
route array - you place an empty marker on the map and name it something like "dest1" (or whatever) to indicate where you want the helo to go to
flying height - obviously what height the helo will fly at
landing true/false - put either true of false if you want the helo to land

so the whole thing would be - for example
Code: [Select]
[choppername, [getPos dest1], 20, true] execVM "mando_heliroute_arma.sqf"and so on
Code: [Select]
[choppername,[getPos dest3], 50, true] execVM "mando_heliroute_arma.sqf"
I think that's it. Any other questions just ask

edit:
well yes Mandoble is right, all that was gleaned from the script header itself and a peek at the insides of the demo mission.

edit 2:
forgot a comma - the syntax is very important when writing or running scripts
« Last Edit: 27 Feb 2008, 21:58:12 by Denz »
I've got 'em right where I want 'em - surrounded from the inside!
Jerry "Mad Dog" Shriver, SOG Recon One-Zero
24/09/41 - 24/04/69

Offline Agent JB

  • Members
  • *
Re: Initializing scripts?
« Reply #8 on: 27 Feb 2008, 22:24:58 »
Thanks Denz, thats what I wanted to know. Is there any complete n00bs tutorial on the codes? and where to put them? I know the mian site here has the codes, but it doesn't tell me where to put them (I.E.. init.sqf or in the init in the ingame editor and so on).
Yes/No?

And I suppose intros are all about as interesting to make as the mission itself?

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Initializing scripts?
« Reply #9 on: 27 Feb 2008, 22:35:01 »
To start with, a script is a plain text file with lots of commands, comparisons and operations. Everything you may add to a script is here, and that is the best starting point to begin to understand how and why to script something.

Offline Agent JB

  • Members
  • *
Re: Initializing scripts?
« Reply #10 on: 27 Feb 2008, 22:50:47 »
Thats the tutorial thing I was talking about mandoble... it doesn't tell me where I can put all this stuff.

Offline Denz

  • Former Staff
  • ****
Re: Initializing scripts?
« Reply #11 on: 27 Feb 2008, 22:57:07 »
Have a browse through the tutorial section of the Editor's Depot
More so the OFP section. You'll find tutorials on scripting and Intro making in there.
What was written for OFP still has 99% relevance to ArmA. We just have some new commands to play with ;)
I've got 'em right where I want 'em - surrounded from the inside!
Jerry "Mad Dog" Shriver, SOG Recon One-Zero
24/09/41 - 24/04/69

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Initializing scripts?
« Reply #12 on: 27 Feb 2008, 23:33:37 »
Ok, example of script:

Code: [Select]
// This text file should be named myscript.sqf

// Parameters are retrieved from _this, which is an array
// We are passing a single one, a simple text which we store into _mytext local variable
_mytext = _this select 0;

// Now we'll use a command from the COMREF
titleText[_mytext, "PLAIN"];

Now, to execute your script from the init.sqf (script, that, if exists, is executed automatically by ArmA on mission startup
Code: [Select]
// This script is named init.sqf

// From here we'll execute your script using execVM command (check COMREF).
res = ["Hello world"]execVM"myscript.sqf";