Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: needing help with 2 actions.

  1. #1
    iBot User ronnblad's Avatar
    Join Date
    Aug 2012
    Location
    Sweden
    Posts
    121
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    3 Post(s)
    Reputation
    11
    Rep Power
    5

    needing help with 2 actions.

    Hello i need help to get this 2 actions:

    this one is ment to be for ppl who forgets to change the healing for mana potions when they change the setup:
    PHP Code:
    if MPname "mana potion" thensetsettings("Settings\\Healer\\Rules\\MP\\HealMethod","Mana Potion"wait(500)else MPname "strong mana potion" thensetsettings("Settings\\Healer\\Rules\\MP\\HealMethod","Strong Mana Potion"wait(500)elseMPname "great mana potion" thensetsettings("Settings\\Healer\\Rules\\MP\\HealMethod","Great Mana Potion"wait(500)end 
    and this one is ment to change the attack spell from exori vis to sudden death rune when x monsters on screen and then when under x monsters change it back:
    PHP Code:
    local creaturesToHit = {"Worker Golem"local minimumAround 5
    if (maround(5unpack(creaturesToHit)) >= minimumAround)) then     setsettings("Settings\\Targeting\\Monsters\\Worker Golem\\ListSettings\\Setting0\\ListSpell\\Spell0\\Energy Strike")     wait(500)else     setsettings("Settings\\Targeting\\Monsters\\Worker Golem\\ListSettings\\Setting0\\ListSpell\\Spell0\\Sudden Death Rune")     wait(500end 
    im not the best scripter so thats why im asking someone who knows alittle more about this
    Ronnblads Free Script Thread. - Gentlemen start your Ibots <-- OLD

  2. #2
    iBot User pink_panther's Avatar
    Join Date
    May 2012
    Location
    Australia
    Posts
    4,075
    Mentioned
    49 Post(s)
    Tagged
    1 Thread(s)
    Quoted
    178 Post(s)
    Reputation
    309
    Rep Power
    10
    Why over complicate it?
    PHP Code:
    setsettings("Settings\\Healer\\Rules\\MP\\HealMethod",MPname
    The problem with compating a variable to a string is that if the person makes it "Mana potion" instead of "mana potion" it wont work. Doing it is way makes it so no matter what they type, if it is a valid option, it will change.

    I do this in all of my scropts for mana potions and health potions

    Here you go:
    PHP Code:
    local creaturesToHit = {"Worker Golem"}
    local minimumAround 5

    if maround(5unpack(creaturesToHit)) >= minimumAround then
        setsettings
    ("Settings\\Targeting\\Monsters\\Worker Golem\\ListSettings\\Setting0\\ListSpell\\Spell0""Energy Strike")
    else
        
    setsettings("Settings\\Targeting\\Monsters\\Worker Golem\\ListSettings\\Setting0\\ListSpell\\Spell0""Sudden Death Rune")
    end 
    Last edited by pink_panther; 02-06-2013 at 06:42 PM.

  3. #3
    Normal User
    Join Date
    May 2012
    Location
    England
    Posts
    160
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    16
    Rep Power
    5
    You could also use string.lower, as in Lua documentation, for comparing the strings.

  4. #4
    iBot User pink_panther's Avatar
    Join Date
    May 2012
    Location
    Australia
    Posts
    4,075
    Mentioned
    49 Post(s)
    Tagged
    1 Thread(s)
    Quoted
    178 Post(s)
    Reputation
    309
    Rep Power
    10
    Quote Originally Posted by XtrmJosh View Post
    You could also use string.lower, as in Lua documentation, for comparing the strings.
    Or you could be a better scripter, and not over complicate things.

    Why go through all the effort when you could do exactly what he needs in 1, short, line

    Technically it would work, but it's just adding points of failure. There are hundreds of ways to achieve the same outcome.
    Last edited by pink_panther; 02-06-2013 at 06:56 PM.

  5. #5
    Normal User
    Join Date
    May 2012
    Location
    England
    Posts
    160
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    16
    Rep Power
    5
    Quote Originally Posted by pink_panther View Post
    Or you could be a better scripter, and not over complicate things.

    Why go through all the effort when you could do exactly what he needs in 1, short, line
    Or you could do things properly and handle the exception that the user input something badly, e.g if you do:

    PHP Code:
    if MPName:lower "mana potion" then
        setsetting
    (~~~~)
    else
        
    handleException("MPName variable set incorrectly")
    end 
    You're not very well educated, are you?

  6. #6
    iBot User pink_panther's Avatar
    Join Date
    May 2012
    Location
    Australia
    Posts
    4,075
    Mentioned
    49 Post(s)
    Tagged
    1 Thread(s)
    Quoted
    178 Post(s)
    Reputation
    309
    Rep Power
    10
    Quote Originally Posted by XtrmJosh View Post
    Or you could do things properly and handle the exception that the user input something badly, e.g if you do:

    PHP Code:
    if MPName:lower "mana potion" then
        setsetting
    (~~~~)
    else
        
    handleException("MPName variable set incorrectly")
    end 
    You're not very well educated, are you?
    Mate if you want to write a hundred lines of shit just to update a healing option, be my guest.

    I'm talking about not over complicating things.
    Quote Originally Posted by pink_panther View Post
    Technically it would work, but it's just adding points of failure. There are hundreds of ways to achieve the same outcome.
    Last edited by pink_panther; 02-06-2013 at 07:03 PM.

  7. #7
    Normal User
    Join Date
    May 2012
    Location
    England
    Posts
    160
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    16
    Rep Power
    5
    Quote Originally Posted by pink_panther View Post
    Mate if you want to write a hundred lines of shit just to update a healing option, be my guest.
    No, I'd just rather shit always worked how it should. I mean, if your scripts are gonna walk into a spawn without a properly configured healer, you're gonna die, and which customer will be happy with that shit? A couple of extra lines in the setup where configuration of string based variables is required is nothing compared to the hundred line emails you'll end up sending out to customers to apologise for their deaths and explain that if they spell something wrong they are gonna die.

  8. #8
    iBot User pink_panther's Avatar
    Join Date
    May 2012
    Location
    Australia
    Posts
    4,075
    Mentioned
    49 Post(s)
    Tagged
    1 Thread(s)
    Quoted
    178 Post(s)
    Reputation
    309
    Rep Power
    10
    Quote Originally Posted by XtrmJosh View Post
    No, I'd just rather shit always worked how it should. I mean, if your scripts are gonna walk into a spawn without a properly configured healer, you're gonna die, and which customer will be happy with that shit? A couple of extra lines in the setup where configuration of string based variables is required is nothing compared to the hundred line emails you'll end up sending out to customers to apologise for their deaths and explain that if they spell something wrong they are gonna die.
    No it wont, because if the user spells the name of a potion wrong, its going to fail before it even buys the potions, isn't it.

    Then they'll be like "Oh shit, better stop being a stupid arsehole and fix that up".

    EG:

    Have 2 lines to update MP and HP

    then an action before it leavs saying: if itemcount(nameMp) < minMp or itemcount(nameHp) minHp then gotolabel("Start") end

    With those 3 lines combined, its still shorter than your action, that would need to be copy, pasted and edited at least 7 more times to apply for every kind of mana and health potion.
    Last edited by pink_panther; 02-06-2013 at 07:10 PM.

  9. #9
    Normal User
    Join Date
    May 2012
    Location
    England
    Posts
    160
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    16
    Rep Power
    5
    Quote Originally Posted by pink_panther View Post
    No it wont, because if the user spells the name of a potion wrong, its going to fail before it even buys the potions, isn't it.

    Then they'll be like "Oh shit, better stop being a stupid arsehole and fix that up".
    Depends on how good your script is, and from my experience most scripts do at least 1 circuit of the spawn which they are intending to hunt before checking if they have enough manas etc. Also depends where the user starts the script, and under what conditions. It might even just outright fail to buy the items, and to the best of my knowledge if the bot doesn't buy items, it doesn't simply stop. It all depends on the way the script is made, and the best way to make it is properly. The proper way to make it is to use some sophistication, be slightly wasteful with hard disk space (which is readily available in this world), and write fully functional actions and hotkeys which handle exceptions properly, according to any programmers handbook. I mean, noone is gonna miss the 1kb it will take up to write an extra few lines of code, but people will miss the pain in the ass they get when they think they have a bug, can't run the script, or just die because they misspelt something.

  10. #10
    iBot User pink_panther's Avatar
    Join Date
    May 2012
    Location
    Australia
    Posts
    4,075
    Mentioned
    49 Post(s)
    Tagged
    1 Thread(s)
    Quoted
    178 Post(s)
    Reputation
    309
    Rep Power
    10
    Quote Originally Posted by XtrmJosh View Post
    Depends on how good your script is, and from my experience most scripts do at least 1 circuit of the spawn which they are intending to hunt before checking if they have enough manas etc. Also depends where the user starts the script, and under what conditions. It might even just outright fail to buy the items, and to the best of my knowledge if the bot doesn't buy items, it doesn't simply stop. It all depends on the way the script is made, and the best way to make it is properly. The proper way to make it is to use some sophistication, be slightly wasteful with hard disk space (which is readily available in this world), and write fully functional actions and hotkeys which handle exceptions properly, according to any programmers handbook. I mean, noone is gonna miss the 1kb it will take up to write an extra few lines of code, but people will miss the pain in the ass they get when they think they have a bug, can't run the script, or just die because they misspelt something.
    And now we come back to my initial statement of : Or you could be a better scripter, and not over complicate things

    I'm done.
    Last edited by pink_panther; 02-06-2013 at 07:24 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •