Ingolf 10 Posted June 30, 2009 Hi all! Before I shoot my question i just want to make clear that I really did search through the threads for an answer (and the excellent guides available). Did not find it. That - to me - indicates that my coming question is of such basic level that it should not even be asked :) However, I can not call my scripts properly from, for example, a trigger. I planned to make my first script to show some text across the ingame screen. Just to make sure I got the method right. Simple huh? First I tried without using a script: In the "Edit trigger" pop-up window, I simply added: titleText ["Show this text", "PLAIN"] And with the Activation set to my unit, Present, Once and so on. Right! Works beautifully! Then I placed titleText ["Show this text", "PLAIN"] in a text file, named it "showthistext.sqs" and saved it as a SQS-file under d:\spel\Arma2\Missions\scripts\showthistext.sqs (my game folder). In the On Act. (Edit trigger) I try to execute my script with: [] exec "d:\spel\Arma2\Missions\scripts\showthistext.sqs" At first when I did not use the full path to my script, I got an error telling me that the script could not be found as I entered the area defined by the trigger. So, the trigger actually triggers. Make sense. But with the above command (full path) nothing happens when I enter the (trigger)area. It obviously finds my script (showthistext.sqs) but will not execute it (or at least no text is shown on the screen). I seem to have missed something fundamentally? Do I need to add "Exit" or use ";" in my script. Tried both - no change. I have tried to save the mission as both "User mission" and "Export to single missions". No difference if I run my mission from the "Preview" in the editor or as an actual Scenario from the main menu. Still my "showthistext" will not show up! I am not new to programming, so I guess my misstake is of another kind. Grateful for any help, so that I can get started with scripting and functions!! PS: Thanks for all other useful threads, got really inspired as I went through the forum! DS Share this post Link to post Share on other sites
Mc Speedfreak 10 Posted June 30, 2009 (edited) when you are building a mission it will NOT be in your ARMA directort. it will be in C:\Users\your profile\Documents\ArmA 2 (Other Profiles)\your arma profile\Missions [under win vista] C:\Documents and Settings\your profile\Documents\ArmA 2 (Other Profiles)\your arma profile\Missions [under win XP] put the script into the mission folder and call from there when you are done make sure to pbo that folder Edited June 30, 2009 by Mc Speedfreak Share this post Link to post Share on other sites
Big Dawg KS 6 Posted June 30, 2009 [] exec "d:\spel\Arma2\Missions\scripts\showthistext.s qs" Use only relative pathnames in the editor (where the mission folder is the root). You're also placing it in the wrong folder. When you save a mission in the editor a new folder will be created in your "<userprofile>\missions" folder (which is likely somewhere in My Documents or something) with the format missionname.island. Place your scripts folder in this folder. Then when executing it, you should have: [] exec "\scripts\showthistext.sqs" Share this post Link to post Share on other sites
TiGGa 0 Posted June 30, 2009 Wrong folder! :D Everytime you make a mission in the editor, the game will create a folder containing the mission.sqm, which contains all the information about units placement. The folder is located in your "My Documents" Folder or whatever it is called in your language. for example: \My documents\ArmA 2 Other Profiles\your username\missions\yourmission.chernarus You can add a subfolder if you like: \My documents\ArmA 2 Other Profiles\your username\missions\yourmission.chernarus\scripts Now place the script into that subfolder and do it like this: [] exec "scripts\showthistext.sqs" After that, you can save it as a SP or MP mission, which will create a PBO file, containing the mission.sqm AND the scripts inside it. The PBO file is just like a zip file, containing the missions folder. Share this post Link to post Share on other sites
Tajin 349 Posted June 30, 2009 Look unter your "MyDocuments" folder, there should be an ArmA2 directory there and subfolders for missions. That is where self-made missions are saved before you export them. Each mission has a folder there, that matches the missionname. Place the script in that folder and you shall be fine. [] exec "showthistext.sqs" this will find the scriptfile in two locations: 1. The mission folder. 2. Your ArmA2 folder. Ofcourse placing it in the arma2 folder won't make much sense in this case because if you export the mission and send it to someone, he would not have the script. Also since you're just starting to script... learn SQF, not SQS. SQS is older than SQF, has less features and is not as comfortable to work with. Also if you plan to use other scripts as examples or to edit them, they will most likely be written in sqf. Heed my words ;) Only difference in this very case would be the way you execute it: nul=[] execVM "showthistext.sqf" And here's another little example use this in the trigger: nul=["Hello hello !"] execVM "showthistext.sqf" and this would be the script: showthistext.sqf _text = _this select 0; titleText [_text, "PLAIN"]; Needless to say that this is not very practical for an script as simple as that, writing it into the trigger would be way easier. Share this post Link to post Share on other sites
doford 10 Posted June 30, 2009 I'm a complete noob at this too. I had this problem and found that renaming the file ".sqf" in vista doesn't change the file type unless you disable *hide extension for known file types" in folder options. Share this post Link to post Share on other sites
Ingolf 10 Posted June 30, 2009 @: [ORC] Mc Speedfreak, Big Dawg KS, TiGGa, Tajin, Thanks for your answer! It made my day (and night)! ;) I knew it was something like that so I actually checked "My Documents" on the C drive but did not look carefully enough! How stupid I feel :p Also since you're just starting to script... learn SQF, not SQS.SQS is older than SQF, has less features and is not as comfortable to work with. Also if you plan to use other scripts as examples or to edit them, they will most likely be written in sqf. @Tajin: Regarding the SQF, yeah, that feels more like me. I was really pleased to see the move towards that kind of functions. Since I'm used to work with Matlab, that feels more like my backyard... :) ...and @doford; yes, Vista may cause these kind of anoying detours.... :D Guys, you are great! Looking forward to ask more stupid questions in the very near future! Hopefully, I can contribute with some useful input too, later on. Cheers! Share this post Link to post Share on other sites