Jump to content
×
×
  • Create New...

@ScriptConfiguration - Allow your scripts to be configured from CLI/Remote bot management panel


Recommended Posts

  • Administrators

Note: This feature is not fully live yet, there's no way to currently set the configuration. That work is in progress but we want to have as many scripts supporting it on launch.

 

A new annotation has been added which will allow users configure your script from the CLI/Remote bot management panel without the need for a GUI. 

Example usage:

@Script.ScriptConfiguration( name = "Npc Names", description = "A comma seperated list of npc names to attack",
        optionType = ScriptConfigurationOption.OptionType.STRING, defaultValue = "")
@Script.ScriptConfiguration( name = "Attack Style", description = "The attack style to use",
        optionType = ScriptConfigurationOption.OptionType.STRING, defaultValue = "Stab", allowedValues={"Slash", "Stab"})
@Script.ScriptConfiguration( name = "Bury Bones", description = "Collect and bury bones?",
        optionType = ScriptConfigurationOption.OptionType.BOOLEAN, defaultValue = "false")
public class PowFighter extends PollingScript<ClientContext> {
  
  	@Override
  	public void start() {
          if (hasOptionsConfigred()) {
            getOptions()...
          } else {
            showGUI();
          }
	}
  }

 

To use the configuration options in your script two methods have been added to AbstractScript:

  • getOptions() - Get the a list of configuration options & values

  • hasOptionsConfigured() - Has the user provided options, if false you probably want to show a GUI to let the user configure a script

  • Like 1
  • Thanks 2
Link to post
Share on other sites
  • const_ pinned 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.

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.