Script Development Setup
Part 1: Local scripting environment
1. Download & install Java SE Development Kit 8
2. Download & install IntelliJ IDEA
3. Creating the project
3.1. Open IntelliJ IDEA & create a new project
3.2. Make sure the selected JDK is version 8 and click next
3.3. No project template will be required, click next
3.4. Give the project a name (eg: scripts), then click finish
4. Configuring the project
4.1. Press CTRL + ALT + SHIFT + S (or File -> Project Structure...) and go to Modules, open the Dependencies tab and click the + button and select "Library..." and "Java"
4.2. Locate the OSBot jar file and select it, select "Project library" and click next
4.3. Go to Artifacts (on the same window, under Modules) and click the + button, select "JAR" then "Empty"
4.4. Give the artifact some name(eg: scripts_jar), select include in project build, right click "scripts" (or whatever the project name you chose) compile output on the right side and select "Put into Output Root". Output directory should be the OSBot scripts directory: $USER_HOME$\OSBot\Scripts\
5. Test the settings
5.1. Right side, under Project, expand the directories and right click src to create a new class file
5.2. Give it some name, make sure it's a Class file and click ok
5.3. Write some test code
5.4. Press CTRL + F9 (or Build -> Build Project) 5.5. Open the OSBot client and refresh the script list, the "Example Script" should appear on the list
Part 2: SDN scripting environment
1. Request GIT access
2. Create a local repository VCS -> Import into Version Control -> Create Git Repository... and select the project directory (scripts in the example)
3. Adjust project structure to meet SDN script project structure guidelines. In this case I'll create a directory for the script and move the src directory under it.
4. Press CTRL + K (or VCS -> Commit...), add some commit message and select only the required files (java classes, resources), no IDE generated configuration files, then click commit (and if prompted to review warnings, just click commit again on the dialog that appears)
5. Press CTRL + SHIFT + K (or VCS -> Git -> Push...)
6. First time doing this you will have to define the remote branch to push to, so click on "Define remote"
7. You will need to fill in the URL to your GIT repository then click ok
The GIT_USERNAME and GIT_REPOSITORY are usually the same, the GIT details will be obtained once your GIT access request is approved
That is GIT_USERNAME:GIT_PASSWORD (there is a : in there)
8. Push changes , they will appear on your gitweb repository page
Useful Hotkey Summary
CTRL + F9: export script jar to the client directory
CTRL + K: commit
CTRL + SHIFT + K: push
CTRL + ALT + S: open IDE settings
CTRL + ALT + SHIFT + S: open project settings
CTRL + ALT + INSERT: create new file in current directory
CTRL + ALT + L: autoformat code
CTRL + ALT + ENTER: autocomplete statement at caret position
CTRL + F: search
CTRL + R: replace
CTRL + P: paramter info for method at caret position