Class ScriptBuilder

java.lang.Object
net.botwithus.rs3.game.cs2.ScriptBuilder

public final class ScriptBuilder extends Object
ScriptBuilder allows you to create a handle or a descriptor representing a Jagex Client Script (CS2)
See Also:
  • Method Details

    • id

      public ScriptBuilder id(int id)
      Sets the script id
      Parameters:
      id - the ID of the script
      Returns:
      the builder
    • args

      public ScriptBuilder args(Layout... args)
      Sets the arguments the script takes
      Parameters:
      args - the arguments for the script
      Returns:
      the builder
      See Also:
    • returns

      public ScriptBuilder returns(Layout... returns)
      Sets the returned values of the script
      Parameters:
      returns - the return values of the script
      Returns:
      the builder
      See Also:
    • invokeExact

      public List<ReturnValue> invokeExact(Object... args)
      Invokes the Jagex CS2 Script.

      Note: This function will throw a LayoutMismatchException if any of the layout do not match the passed arguments

      Parameters:
      args - the arguments excepted by the CS2 Script
      Returns:
      the values returned by the CS2 script
    • invoke

      public List<ReturnValue> invoke(Object... args)
      Invokes a Jagex CS2 Script

      Note: If any arguments are passed that mismatch the layout, then the argument will try and be converted to the layout, if for whatever reason it cannot be converted it will throw a LayoutMismatchException

      Parameters:
      args - the arguments excepted by the CS2 Script
      Returns:
      the values returned by the CS2 script
    • ofVoid

      public static ScriptHandle ofVoid(int id)
      Creates a script handle with no arguments and returns
      Parameters:
      id - the ID of the script
      Returns:
      the newly created ScriptHandle
    • of

      public static ScriptBuilder of(int id)
      Creates a new ScriptBuilder with the given id
      Parameters:
      id - the id of the script
      Returns:
      the ScriptBuilder