Jump to content

Script Development Setup


Token

Recommended Posts

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
tB48LNo.png

3.2. Make sure the selected JDK is version 8 and click next
nh7KnSy.png

3.3. No project template will be required, click next
fodABnW.png

3.4. Give the project a name (eg: scripts), then click finish
MSDmTXN.png
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"
gtt4wyQ.png

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"
g9r5sbF.png

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\
nCW6vN2.png
 
5. Test the settings
5.1. Right side, under Project, expand the directories and right click src to create a new class file
kuJ7ozJ.png

5.2. Give it some name, make sure it's a Class file and click ok
nDAJmyF.png

5.3. Write some test code
fCrZ0Ct.png

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.
MfDRqlE.png

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)
8SYd3wa.png

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"
db22coS.png

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
ESK42Vi.png
That is GIT_USERNAME:GIT_PASSWORD (there is a : in there)

8. Push changes :doge: , 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
 
Edited by Token
  • Like 16
  • Heart 7
Link to comment
Share on other sites

  • Token featured this topic
  • 4 months later...
  • 2 months later...
5 minutes ago, matthew2112 said:

Hi i am trying to follow the guide as i am a noob and i have the script seccesfully built and it is saved in the OSBot>Scripts folder as "scripts_jar"  but when i load the client and refresh the script does not show up.  Any help would be greatly appreciated.  Thanks in Advance.

Normally it's because you didn't compile it with java 8 or you're missing script manifest

Link to comment
Share on other sites

11 hours ago, matthew2112 said:

Would the file jre 1.8.0_241 have the java 8 in it? that is what it made me download.  or do i need to download an older version.  This is the message i have from compiling the build "Information:  javac 14 was used to compile java sources"

Delete all versions of jre/jdk and install jdk 8 AFTER they are deleted

Link to comment
Share on other sites

  • 3 weeks later...
  • Maldesto unfeatured this topic
  • Token featured this topic

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...