Jump to content

Steve's Al-Kharid Warriors (progressive)


scriptersteve

Recommended Posts

Making an Al-Kharid warriors script at the moment -> currently supports banking, potting, killing al kharid warriors. Aimed at f2p only (detects normal str pots)

Just select your food type from the gui and hit play.

Has basic paint

Currently supports magic (must be autocast spell selected), ranged and melee. If using melee it pots, if using ranged it loots arrows (stacks > 5 in size)

If training attack it will upgrade your scimitar if it is present in inventory i.e if your attack is 4 then levels to 5 if u have steel scim in inv it will equip it for better exp rates

If training range will upgrade your bow if it is present in inventory

hops worlds if too many players (2 > lvl 30 in your area -> hop)

Script automatically stops if:- you run out of arrows, you run out of runes, you have no food in bank, you die (untested as never died)

Bans: not been banned so far in all testing of script which is a fair amount.

First Version download here: https://www.dropbox.com/s/rip93cyyb356g5k/Goblins.jar?dl=0

Ignore fact it's called goblins, was going to make a goblin banking script at the goblins near edge but changed my mind XD.

2nd version here:

https://www.dropbox.com/s/vtr4cs0jirviam4/Goblins.jar?dl=0

3rd version here:

https://www.dropbox.com/s/qc7y16mjn2zakks/Goblins.jar?dl=0

4th version here:

https://www.dropbox.com/s/bwcl5fs3tll9702/Goblins.jar?dl=0

5th and probably final version here unless anything breaks:

https://www.dropbox.com/s/bwcl5fs3tll9702/Goblins.jar?dl=0

 

Edited by scriptersteve
  • Like 1
Link to comment
Share on other sites

The code isn't malicious and the script looks like it would work - good job :) 

 

A few recommendations:

    1. I'd recommend using a State structure for this type of script; it makes the code a lot cleaner.

    2. You're effectively making the same check multiple times to progressively switch weapons in every onLoop(). I'd try to (at least) use else ifs for this.

    3. The script assumes that the player will have infinite food - maybe add a condition to log out?

 

There's more than that, but those are good things to start on :) 

Edited by Team Cape
Link to comment
Share on other sites

Thanks will keep those in mind and add extra bits to do that- will keep updating link as i go: quick question do you know the code for turning run on when run % greater than set amount and when you say logout, do you just mean script.stop()?

41 minutes ago, Team Cape said:

The code isn't malicious and the script looks like it would work - good job :) 

 

A few recommendations:

    1. I'd recommend using a State structure for this type of script; it makes the code a lot cleaner.

    2. You're effectively making the same check multiple times to progressively switch weapons in every onLoop(). I'd try to (at least) use else ifs for this.

    3. The script assumes that the player will have infinite food - maybe add a condition to log out?

 

There's more than that, but those are good things to start on :) 

 

43 minutes ago, Team Cape said:

The code isn't malicious and the script looks like it would work - good job :) 

 

A few recommendations:

    1. I'd recommend using a State structure for this type of script; it makes the code a lot cleaner.

    2. You're effectively making the same check multiple times to progressively switch weapons in every onLoop(). I'd try to (at least) use else ifs for this.

    3. The script assumes that the player will have infinite food - maybe add a condition to log out?

 

There's more than that, but those are good things to start on :) 

Also when you say state structure, you mean like a banking state, killing state or what exactly?

  • Like 1
Link to comment
Share on other sites

15 minutes ago, scriptersteve said:

Thanks will keep those in mind and add extra bits to do that- will keep updating link as i go: quick question do you know the code for turning run on when run % greater than set amount and when you say logout, do you just mean script.stop()?

 

Also when you say state structure, you mean like a banking state, killing state or what exactly?

stop() would work - states are really just a framework of if statements that help you structure the script, like this:

private enum State {
    COMBAT, WALK_TO_FIGHT_AREA, WALK_TO_BANK, OPEN_BANK, BANK, LOG_OUT
};



private State getState() {    
	if(getInventory().contains("Salmon")) {
      if(!fightArea.contains(myPlayer())
         return State.WALK_TO_FIGHT_AREA;
      if(getCombat().isFighting())
        return State.COMBAT;
      return State.ATTACK_GUARD;
    }
  	if(!bankArea.contains(myPlayer()))
      return State.WALK_TO_BANK;
  	if(!getBank().isOpen())
      return State.OPEN_BANK;
  	if(getBank().contains("Salmon"))
      return State.BANK;
  	return State.LOG_OUT;
}

public int onLoop() {
  	switch(getState()) {
      case COMBAT:
        //combat with guard
        break;
      case ATTACK_GUARD:
        //attack guard
        break;
      case BANK:
        break;
      case WALK_TO_BANK:
        getWalking().webWalk(bankArea);
        break;
      //other states that you have go here, implement code into each one
    }
}

this is a simple example of how you might use a state system with this script - it helps to clean up the script, so it's a lot easier to debug

would also recommend looking at a few tutorials on starting scripting, like APAs tea stealing script. 

 

Link to comment
Share on other sites

1 hour ago, Team Cape said:

stop() would work - states are really just a framework of if statements that help you structure the script, like this:


private enum State {
    COMBAT, WALK_TO_FIGHT_AREA, WALK_TO_BANK, OPEN_BANK, BANK, LOG_OUT
};



private State getState() {    
	if(getInventory().contains("Salmon")) {
      if(!fightArea.contains(myPlayer())
         return State.WALK_TO_FIGHT_AREA;
      if(getCombat().isFighting())
        return State.COMBAT;
      return State.ATTACK_GUARD;
    }
  	if(!bankArea.contains(myPlayer()))
      return State.WALK_TO_BANK;
  	if(!getBank().isOpen())
      return State.OPEN_BANK;
  	if(getBank().contains("Salmon"))
      return State.BANK;
  	return State.LOG_OUT;
}

public int onLoop() {
  	switch(getState()) {
      case COMBAT:
        //combat with guard
        break;
      case ATTACK_GUARD:
        //attack guard
        break;
      case BANK:
        break;
      case WALK_TO_BANK:
        getWalking().webWalk(bankArea);
        break;
      //other states that you have go here, implement code into each one
    }
}

this is a simple example of how you might use a state system with this script - it helps to clean up the script, so it's a lot easier to debug

would also recommend looking at a few tutorials on starting scripting, like APAs tea stealing script. 

 

 

o_god_pls_no.jpg

all that code can be simplified to:

public int onLoop() {
    if(getInventory().contains("Salmon")) {
        if(!fightArea.contains(myPlayer())) {
            // walk to fight area
        } else if(getCombat().isFighting()) {
            // do nada
        } else {
            // attack guard
        }
    } else if(!bankArea.contains(myPlayer())) {
        // walk to bank
    } else if(!getBank().isOpen()) {
        // open bank
    } else if(getBank().contains("Salmon")) {
        //bank
    } else {
        //logout
    }
}

 

States add nothing, REEEEEEEEEEEEEEE

Edited by Explv
  • Like 1
Link to comment
Share on other sites

6 hours ago, Explv said:

 

o_god_pls_no.jpg

all that code can be simplified to:


public int onLoop() {
    if(getInventory().contains("Salmon")) {
        if(!fightArea.contains(myPlayer())) {
            // walk to fight area
        } else if(getCombat().isFighting()) {
            // do nada
        } else {
            // attack guard
        }
    } else if(!bankArea.contains(myPlayer())) {
        // walk to bank
    } else if(!getBank().isOpen()) {
        // open bank
    } else if(getBank().contains("Salmon")) {
        //bank
    } else {
        //logout
    }
}

 

States add nothing, REEEEEEEEEEEEEEE

muddies up the onLoop(). state system also increases readability and is perfect for a small script like this one. doesn't matter if you personally don't like it; it's a very good place to start because it forces you into good, structured habits.

  • Like 1
Link to comment
Share on other sites

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