Welcome to TRiBot Forums

Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more! This message will be removed once you have signed in.

Sign in to follow this  
Followers 0
TRiLeZ

Scripting Knowledge Requirements

1 post in this topic

To ensure a high quality of scripts, we are requiring a demonstration of specific knowledge about scripting when applying for the scripter rank. Aspiring scripters must submit source code to a fully working script along with their application. If the submitted script doesn't demonstrate adequate knowledge in the below areas, the application will be instantly denied.

 

Null Checking

Scripts must properly check for null variables. Keep in mind that the returned value of one object is not always the same as the returned value of the same object (when the method is called twice).

RSObject tree = Objects.findNearest(40, "Tree");
if (tree.getDefinition() != null && tree.getDefinition().getName() != null) {
 final String name = tree.getDefinition().getName();
}

The above code is wrong and needs to be avoided. Three different instances of RSObjectDefinition are created. Any of those instances could be null, or none of them could be null. What you need to do is store the returned value in a variable, then null check that variable. If the variable is not null, then perform actions upon that variable.

 

Check section 6 of my tutorial for more info: https://tribot.org/forums/topic/30185-trilezs-scripting-tutorial/

 

Array Index Bounds Checking

Scripts must check that the index they are trying to pull from an array is not out of bounds. It's out of bounds if: index < 0 or index >= array.length.

Scripts should also only do array index bounds checking on variables, and not returned values from methods (unless no elements are being pulled from the array). The reason for this is the same as the reason listed above.

 

Check section 6 of my tutorial for more info: https://tribot.org/forums/topic/30185-trilezs-scripting-tutorial/

 

These are not the only coding knowledge requirements, but they are the most common problems created by scripters. Make sure to have adequate scripting knowledge before applying.

 

I'd also recommend reading sections 5, 6, and 7 of my scripting tutorial before applying: Check section 6 of my tutorial for more info: https://tribot.org/forums/topic/30185-trilezs-scripting-tutorial/

 

If a staff member closes your application and links to this thread without saying anything else, they are stating that you need to fix your scripts because they contain the above coding errors.

Edited by erickho123
Forum Software update made all lines one lined. Attempted to fix it.
1 person likes this

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.