Jump to content
Joe98

Write scripts within the game.

Recommended Posts

Currently to create a script we do this:

 

Connect to Steam.

 

Open the game.

 

Create the mission.

 

Close the game.

 

Write a script with a text editor.

 

Save the text file to the mission folder.

 

Open the game.

 

Complete the mission.

 

 

Suggestion:   In the editor there be a button “click here to create a scriptâ€. 

 

Of course you name the script as you save it but you cannot choose the folder in which it is saved. It automatically saves in the mission folder.

 

There would be an option to view the list of scripts currently in the mission folder.

 

There would be another option to edit any script in the mission folder.

 

However this would not be compulsory. You could still copy your text files to the mission folder if you wish. These too could be edited from within the editor if you wish.

  • Like 4

Share this post


Link to post
Share on other sites

Why don't you just alt-tab between the text file and the game? I do all the things you say without closing the game.

  • Like 1

Share this post


Link to post
Share on other sites

Currently to create a script we do this:

 

Connect to Steam.

 

Open the game.

 

Create the mission.

 

Close the game.

 

Write a script with a text editor.

 

Save the text file to the mission folder.

 

Open the game.

 

Complete the mission.

 

 

Suggestion:   In the editor there be a button “click here to create a scriptâ€. 

 

Of course you name the script as you save it but you cannot choose the folder in which it is saved. It automatically saves in the mission folder.

 

There would be an option to view the list of scripts currently in the mission folder.

 

There would be another option to edit any script in the mission folder.

 

However this would not be compulsory. You could still copy your text files to the mission folder if you wish. These too could be edited from within the editor if you wish.

I personally don't close the game, just alt tab :)

  • Like 1

Share this post


Link to post
Share on other sites

Well also good choice is have 2 monitors ... But it would be cool to have some kinda script editor were you dont need to restart the mission over .. Kinda code as you go...

Share this post


Link to post
Share on other sites

like others have said why close the game? and you don't even have to exit your mission in SP. just hit restart to reload your current scripts.

Share this post


Link to post
Share on other sites

Yes guys don't be lazy! I play in Fullscreen Windowed mode which is the best in my opinion for scripting, alt tabbing is very quick, just write your script, alt back into the game press restart in your mission and boom, done. Don't be lazy! Seriously!

Share this post


Link to post
Share on other sites

The newcomers to the series usually don't know first thing about where to put the script or how, when and where it would execute. So saying "don't be lazy" is not what it is all about. Bottom line is, if such feature is added, this would in no way affect people's ability to make life more complicated for themselves if they wish to do so.

Share this post


Link to post
Share on other sites

killzone_kid I want to ask 1 thing. How in the world did you get the rank Sergeant Sergeant Master Sergeant Shooter Person :D

Share this post


Link to post
Share on other sites

killzone_kid I want to ask 1 thing. How in the world did you get the rank Sergeant Sergeant Master Sergeant Shooter Person :D

 

Years of service!

Share this post


Link to post
Share on other sites

Years of service!

Come on it can't be that there is not such rank.

Share this post


Link to post
Share on other sites

Alt-tab is quick, windowed is also beneficial. Scripting on the go would be fun but I can't see how that would work.

 

@alex150201: you'll get the rank you deserve, my service goes back before 2003 when ofpec was the place for me.

Share this post


Link to post
Share on other sites

Alt-tab is quick, windowed is also beneficial. Scripting on the go would be fun but I can't see how that would work.

 

@alex150201: you'll get the rank you deserve, my service goes back before 2003 when ofpec was the place for me.

And such ranks like the other one and I'm a Llama exist? Really?

Share this post


Link to post
Share on other sites

Why don't you just alt-tab between the text file and the game?

 

 

Alt Tab works fine in Arma2.

 

It does not work in Arma 3.  I assumed it had been removed.

 

As of tonight it works again - so it must have been put back in the game  :)

.

Share this post


Link to post
Share on other sites

The scripting workflow is still terrible. Like most others I've found my own little workflow that works well but the fact that you need to manually navigate to your mission folder, create an *.sqf file, open that with an editor that ideally has some sqf highlighting... that's not a great process. The description.ext has been moved "in-game" with 3DEN, so why not try to move scripting in-game, too? (As long as it doesn't break our current workflows). I don't expect to be able to create PatrolOps like mission from within the editor, but it would be nice if I could at least interact with the mission event scripts (init.sqf, initServer.sqf, etc) from inside the editor :)

Share this post


Link to post
Share on other sites

Alt Tab works fine in Arma2.

 

It does not work in Arma 3.  I assumed it had been removed.

 

As of tonight it works again - so it must have been put back in the game  :)

.

 

It always worked for me...

Share this post


Link to post
Share on other sites

I found that once you actually locate the mission folder, the rest is easy :)  Just keep the scripts open in Notepad++, one in each tab. Probably miles better for overview of mission code as any in-game editor would be able to provide.

 

If BI will not spend time on this, at least they could make a functionality to have the path to the mission folder put on the clipboard. The rest is a matter of Alt-Tab

 

-OP

Share this post


Link to post
Share on other sites

I know notepad++ and atom with sqf support exist but I think the game needs some kind of it's own IDE, maybe even standalone as part of tools. So you can write your code and IDE will show you missing variables, auto-correct existing commands, show you syntax for the command, etc etc, all the usual IDE stuff. Like in Visual Studio or say phpstorm for php.

Share this post


Link to post
Share on other sites

I am using notepad++ since 3 1/2 years now, 2 of these with arma 2-3 with sqf support.

 

I have got syntax highlightning and autocomplete, for a few commands, but a IDE made for arma, which gets updated with all new commands, and a description of that is doing what and stuff would be sooo great.

 

Arma 3 features some of that, but only in the debug console ...

 

Just for those of you, who are notepad++ fanboys like me: https://forums.bistudio.com/topic/138891-arma-3-notepad-syntax-highlighting/

 

 

Regards Arkensor

Share this post


Link to post
Share on other sites

I know notepad++ and atom with sqf support exist but I think the game needs some kind of it's own IDE, maybe even standalone as part of tools. So you can write your code and IDE will show you missing variables, auto-correct existing commands, show you syntax for the command, etc etc, all the usual IDE stuff. Like in Visual Studio or say phpstorm for php.

 

There is ArmaDev for Eclipse, which Alwarren and me started ages ago. It's not as complete as I wanted it to be, though. We're actively thinking of making it an open source project

  • Like 2

Share this post


Link to post
Share on other sites

To be honest, I think any implementation would be a waste of time for BIS, they could work on other stuff for all the time it would take to code, implement and debug this. I doubt the end result would prove to have any advantages than any external code editor. If they should do anything it should be to make it easier to work with external tools, like adding a button that opens the mission directory.

  • Like 1

Share this post


Link to post
Share on other sites

How about a dialog that asks you a couple of severely important questions on the first launch?

Like, what are you gonna focus (mission making, playing SP/MP, modding, etc.) and then directs a to the best currently available workflows for your selected answer(s).

 

Fe., a workflow for scripting. Clearly, OP author would find a walkthrough of the most effective methods in scripting your mission useful.

You just need to integrate it seamlessly into the base game, just like any decent tutorial.

Share this post


Link to post
Share on other sites
 

Well also good choice is have 2 monitors ... But it would be cool to have some kinda script editor were you dont need to restart the mission over .. Kinda code as you go...

 

We developed a system to easily write scripts while in a (multiplayer) game without having to restart the mission anymore. Simply make a folder in the A3 directory called MissionScripts and setup the Files array as described below. Make sure filePatching is enable aswell (-FilePatching on arma3.exe). You can edit SetupFiles as described below if you would like to use a mission folder directory

 

RUN THIS SCRIPT BELOW ONLY ON THE SERVER (just put it inside initServer.sqf inside mission dir, or call it from another place)

Files = [
	['Functions', 'Functions1'], //A3 main directory should look like ArmA 3\MissionScripts\Functions\Functions1.sqf
	['Functions', 'Functions2'] // and we define another file here ArmA 3\MissionScripts\Functions\Functions2.sqf
];

CompileFiles = {
	private ['_name', '_code', '_forServer', '_compile'];

	_name = [_this, 0, '', ['']] call BIS_fnc_param;
	_code = [_this, 1] call BIS_fnc_param;
	_forServer = [_this, 2, false, [false]] call BIS_fnc_param;
	_compile = formatText ['%1 = %2;', _name, _code];

	call compile str(_compile);

	if(_forServer isEqualTo false) then {
		publicVariable _name;
	};
};

SetupFiles = {
	private ['_folder', '_name'];
	
	{
		_folder = _x select 0;
		_name = _x select 1;
			
		call compile preprocessFile format ['\MissionScripts\%1\%2.sqf', _folder, _name]; // or do: call compile preprocessFile format ['MissionScripts\%1\%2.sqf', _folder, _name]; if you want to use mission folder instead of A3 dir
	} forEach Files;
};

call SetupFiles;

You have to setup your files like this (I always use *filename*_functionname so I instantly know where the function that is causing an error is located)

You would name this file Functions1.sqf inside ArmA 3\MissionScripts\Functions as we defined it above

['Functions1_SomeFunction', {
    hint "this is my function";
},false] call CompileFiles; //change false to true if this function should only exist on the server

['Functions1_AnotherFunction', {
    hint "this is another function";
},true] call CompileFiles; //since the second paramater is now true this function will not be publicvariable'd and will only exist on the server

You would just use '[] call Functions1_SomeFunction' as example in any script to use your function. In this case the function 'Functions1_AnotherFunction' will only be available on the server.

 

Now in order to recompile all your files simply use the following code (client-side) anywhere: You can add functions and new script files (make sure to add them to the Files array)

if (isServer) then 
{
	call SetupFiles;
} else 
{
	[[],"SetupFiles",false,false,true] call BIS_FNC_MP;
}; 
player globalChat "Files Recompiled.";

Doing it like this basically allowed us to develop 10x faster, being able to change your scripts, and add things on the fly is so much more productive. It sucks having to restart your mission for every small edit, also this works for in multiplayer (functions are broadcasted using PublicVariable). You can change whether certain functions should only be available to the server by changing the second param calling to CompileFiles.

 

If you want to host a mission now you can move the file to A3 directory on your server. And run the top script on initServer.sqf (inside mission folder) for example and you can upload your edits to the server and instantly recompile them using the above script. Besides that nobody can unpack your mission.pbo and access your files and steal them...

 

Maybe someone can make a mission with the above scripts already setup, can't be bothered to do that atm :)

 

- Kane (arma3projectlife.com)

Share this post


Link to post
Share on other sites

It would be pretty handy to have it in game but I don't think it's is essential. The devs have more important things to do

Share this post


Link to post
Share on other sites

There is ArmaDev for Eclipse, which Alwarren and me started ages ago. It's not as complete as I wanted it to be, though. We're actively thinking of making it an open source project

 

That would be awesome!

 

-OP

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

×