Author: jshear95
Author Website: https://github.com/jshear95/ArmaTerminal

Requirements: No addons required

Version: 0.1.1

Short description: This allows mission makers to add virtual computers to the game complete with a command line, text editor, users and file structure

Date: 2015-06-05 03:14


Comments: (0)
Rating:



 



Arma Terminal

by
Joshua Shear


Description:
Arma Terminal allows a player to access a Linux inspired command line in game and manipulate virtual files created by the mission maker and/or other players in the game world. This can lead to lots of new game play mechanics including: delivering story in a different way, hacking to get enemy intel, or even just more in depth objectives.

Arma Terminal is not and should not be considered a fully fledged operating system or command line. It is still a work in progress and does not (and will not) contain all the commands necessary to support a full operating system. The commands that are implemented are designed to give players the tools to create, read, update, destroy, protect and hack the virtual files for mission game play. Anything beyond that hasn't been implemented and niche commands probably never will be implemented by myself.

Once release 1.0.0 happens, I will be opening up the code for anyone to modify so long as they give credit, before that point, unless I say otherwise, the only version out there should be my own. That said, slight modifications for specific missions are ok. (i.e. changing it so a user is already logged in) Be smart about it :)


Installation / Usage:
1. Extract the file to any folder you like.
2. Open the folder
3. Grab all the files except the mission.sqm file. (Readme.txt is optional)
3a.If you already have a description.ext in your mission, you can skip copying that as well, but you will need to copy its contents into your own description.ext
4. Copy all the files into your mission folder.
5. See usage details below.

Once installed:
1. Take the armaTerminal.sqf, functions folder, and description.ext and drag them into your mission folder.
1a. If your mission already has a description.ext, you can just copy all the code in my description.ext into yours.
2. Place down a computer (any object in game will do, even a pile of bricks or player, but a computer will add to the authenticity) and add the code from section 8 in this readme to the init field of the object.
3. Go in game and open up Arma Terminal. Use the in game commands to create the users and file structure that you want.
4. Once you have the computer in the state you want it, type 'ctc' into the command line and hit enter. This will copy all the data you need to your clip board. This is only possible from dev mode. When you copy the code to your clipboard, it will set the boolean for dev mode false so that players cannot do this in the mission.
5. With the code copied go into your mission and take out all the code you added in step 2 to its init field. Paste in the code that you got from in game.
6. Test your mission and the computer to make sure they are working properly.
7. If you need to make any more modifications to the terminal, just go into the init field and change the last boolean in the add action from false to true. Then you can continue to edit your terminal until its the way you want it.


Included files:
-Mission.sqm - the test mission I use for testing the script. You can delete this file when you download it. Alternatively, you can place it inside of a mission folder titled armaTerminal.stratis to see my testing environment.
-ArmaTerminal.sqf - The file called from the game, contains calls to open and close the terminal along with the logic loop.
-Functions - Contains several folders with all of the functions for Arma Terminal. The functions contain all the logic.
- Command Line - Contains the command line logic.
-fn_alphaToAlpha.sqf - converts input arrays to all caps
-fn_executeLine.sqf - A known god class. Takes in input and the computer and returns the new state of the computer. Does all the operational command line logic.
-fn_getCommand.sqf - compares input array with known commands and returns a string representing the command.
-fn_getCurrentDir.sqf - Probably should have been in file. Gets the current directory that the user is in.
-fn_newCommandLine.sqf - 'Creates' a new commandLine. In reality it composes an array with all of the fields for commandLine and returns it.
-fn_processUserInput.sqf - Handles the logic when a key is pressed in the commandLine.
- Computer - Contains the logic for low level operations in the terminal.
-fn_close.sqf - Closes the computer and returns the user to the normal game.
-fn_getUserInput.sqf - Processes which key(s) are being pressed.
-fn_open.sqf - 'Creates' a new computer. In reality it composes an array with all of the fields for computer and returns it.
-fn_print.sqf - Prints the proper text to the screen so the user can see what's going on.
- File - Contains the logic for dealing with files.
-fn_getFile.sqf - Takes a directory and file name and returns the file with the matching file name.
-fn_getFileIndex.sqf - Rarely used, but crucial. Takes a directory and file name and returns the index of the file with the matching name.
-fn_getType.sqf - Rarely used, but crucial. Takes a file and returns weather it is a document or directory.
- Line - Contains the logic for the individual lines that compose the command line.
-fn_inputToString.sqf - Takes in an input array and returns it in string form.
-fn_newLine.sqf - Creates a new line for the command line.
-fn_parseFilePath.sqf - Takes in the file path, parses it and returns an array with each file in the path.
-fn_parseSpaceDeliniation.sqf - Takes in an input array and parses it for spaces with backslash ('\') as the escape character.
-fn_pop.sqf - Takes in a stack and returns the top element and pops it.
-fn_push.sqf - Takes a stack and an element and pushes the element to the top of the stack.
- Steed - Contains the logic for the built in text editor
-fn_newSteed.sqf - Creates a new STEED.
-fn_processUserInput.sqf - Handles the logic when a key is pressed in STEED
-Description.ext - The declarations for all of the 'classes' and functions. SQF is not an OO language hence the quotes.
-README.txt - The README file. Recommended to look at before use.


Notes:
If you encounter any bugs, please let me know by posting a comment here.
As of version 0.1.0 this has not yet been tested in a multiplayer environment. If you are able to use it in a multiplayer environment, I would greatly appreciate feedback. I do want it to work in multi player.

A test mission can be found here: https://drive.google.com/folderview?id=0B28QZ82odk6kfjVvM0VfWURxTGlhd1ducWFRTjlJR1dLVUtJeml4QngxY3NUcnlwUFpLdG8&usp=sharing
It is a full fledged mission, uncompressed so you can see how it works. This should also give you an idea how to use the script in game.


Credits & Thanks:
Pierre MGI (Answering forum posts)
JShock (Answering forum posts)
F2kSel (Answering forum posts)
Tajin (Answering forum posts)
Craig (Awesome SQF command search site ( http://commandsearch.craigvg.com/ ))
KillZoneKid (Lots of tutorials ( http://killzonekid.com/ ))
BigWilk (Lots of tutorials ( https://www.youtube.com/channel/UCTACxBY48txEvFOPm6eJONw ))
Lots of others I have forgotten
Last but not least the team behind armaholic for the awesome site


Change log:
v0.1.1
File Permission Update
Permissions Edit Command Added
Change Owner Command Added
Change Password Command Added
Admin User Added
Readme Got Some Love
General Error Fixing (Arma updates caused several non critical errors that were fixed)

v0.1.0
-Command Line Implemented
-Help Command Added
-Quit Command Added
-Time Command Added
-Display User Command Added
-Text Color Command Added
-List Files Command Added
-Open File Command Added
-Rename File Command Added
-Make Directory Command Added
-Delete Directory Command Added
-Open Text Editor Command Added
-Text Editor Help Command Added
-Add User Command Added
-Login Command Added
-Logout Command Added
-Permission Modification Command Added
-User Delete Command Added
-Dev Command Added
-Clear Text Command Added
-Text Editor Implemented
-Can Exit Text Editor
-Can Save File in Text Editor
-Can Move Cursor in Text Editor
-Can Copy Text from Text Editor
-Can Paste Text into Text Editor (overwrites file)
-Can Delete Characters
-State based printing added
-Scrolling added
-Directory File Type Added
-Text Document File Type Added
-Multi-Line Command Support Added
-Line parsing Added




Enable javascript to be able to download from Armaholic please!