Jump to content

New SDN Scripter Guide

This announcement is no longer active

Zach

Please note that the SDN runs on Java 8, not Java 7. Write your scripts accordingly.

 

 

 

 

 

Part 1 - Getting Access


Step 1. If it is your first time adding your script to the SDN, you will need to request an account to log into our system. Once you are supplied with a username and password, go here:

 


http://osbot.org/gitweb/

 

To request a new account visit:
http://osbot.org/forum/forum-181/announcement-22-new-osbot-git-account/

 

This area is how you (the scripter) will be able to submit script updates and add new scripts, and how we (the admins) can take those updates/additions and distribute them to the rest of the users.

 

Step 2. In order submit your updates, you will need to download a program called SmartGit, which will interact with our system. If you wish, you may use any other system for interacting with Git.

 

http://www.syntevo.com/smartgithg/

 

Step 3. Log into the OSBot Git (link above), and navigate until you find your "repo url".
repourl.jpg

 

Step 4. Open up SmartGit and navigate to Project > Clone...

 

A new pop-up box will appear. Enter your repo url which you found in the previous step as such:
repourl2.jpg

 

Click next and you will be prompted for a password. The password will be the same as the one provided to you in Step 1. REMEMBER TO STORE/SAVE YOUR PASSWORD.

 

Click Next a few times (the auto-filled options are correct) and finally click Finish. Most likely, you "cloned" your repository onto your Desktop.

 

Step 5. You will need to organize your package so both our system and your system is the same.
layout2.jpg

 

Take a look at the above screenshot. This is how you will organize your script for SmartGit.

 

1. The first folder will be the same as your username for git (aka repository name, the username we provided for you in step 1). This should have been auto-generated from the clone we did previously.

 

2. The second folder will be your module name, aka script name. Do not have any spaces or special characters in your module name.

 

3. The third folder will always be "src". DO NOT INCLUDE ANYTHING ELSE HERE!

 

4. After the src folder is your java files and however you decided to package your project. For simplistic sake, I showed just java files without complex packaging. Do not put jars or class files here, you need your java file(s).

 

So for instance if we wanted to add a new script called "SuperMoney", the layout would be (in this example):

 

ericthecmh\SuperMoney\src\java files

 

Step 6. Whenever you want to update your script on OSBot's end, you need to update your local files first. Navigate to your local folders (from above) and put the new files in. When you do this, SmartGit will detect that the new files locally are different from the files you have on our server.

 

The affected files will appear in red, in SmartGit as such:

 

update1.jpg

 

From here, right click on your branch (root folder, in this case... ericthecmh (master)) and click Commit. Make sure all the red files (changed files) are selected and you must type in a Commit Message. (Just type "update" for instance). After that, click "Commit and Push". Do not select just "Commit".

 

An administrator will review all the changes made every 24 hours or so, and scan it for any malicious code. If all is well, your commit will be accepted and the changes will be processed.

 

 

Advanced user notes:
Folder structure
username/dependencies/[java files for all scripts]
username/resources/[any files that should be copied to all scripts' jar]
username/scriptname/src/[java files for scriptname]
username/scriptname/resources/[any files that should be copied to scriptname's jar]

 

"dependencies" is for any .java file that you would like compiled with each and every script. Note that they must be in source format, so .jar files will not work. See this question.
"resources" is for anything that should be copied exactly into your jar. An example of this is an image. They are compiled and placed into a "resources" folder inside the jar file. Note that ClassLoader.getResource() will return an error (NPE) because it is not implemented. Example method to access the resource is:

public static BufferedImage getImage(String resourcePath) throws IOException {    return ImageIO.read(ThisClassName.class.getResourceAsStream("/resources/" + resourcePath));}
 
×
×
  • Create New...