Signup Now
Results 1 to 10 of 10

Thread: Remote Info

  1. #1
    Free User Rukasu's Avatar
    Join Date
    Apr 2014
    Location
    Brazil, SC
    Posts
    57
    Reputation
    20
    Rep Power
    21

    Remote Info

    Remote Info

    Description

    You can remotely get information about your character and/or your bot status (like profit/waste).
    Simply PM your character with any command (which you can modify to any word) and the bot will PM you back with the information you want.

    Currently it does have 3 commands: !Info, !supply, !profit.

    1. The !info command will PM your character's level, balance, stamina, played time, exp/h and time to next level.
    2. The !supply command will PM how much of each supply item has been used.
    3. The !profit command will PM the current profit/waste of your hunt.



    Configuration

    Set up the safe list with the names of your characters and the words to the commands.

    Code


    init start

    -- --
    -- Remote Info for WindBot --
    -- Author: Rukasu --
    -- Created on 26/05/2014 --
    -- Script Version: 1.1.0 --
    -- --
    -- if you have any suggestions --
    -- or if you found any bug --
    -- contact me at WindBot forums --
    -- --


    local safelist = { "Character Name 1", "Character Name 2", "Character Name 3..." } -- Insert as many names as you want.
    local commands = { "!info", "!supply", "!profit"} -- change to any word you want or just leave as it is.

    ------------------------------------------------------------------
    -- DON'T TOUCH ANYTHING BELOW UNLESS YOU KNOW WHAT YOU'RE DOING --
    ------------------------------------------------------------------

    local info = {
    function() return "Level: ".. $level end,
    function() return "Balance: " .. num($balance) end,
    function() return "Stamina: ".. time($stamina) end,
    function() return "Played time: ".. time(math.floor($charactertime / 1000)) end,
    function() return "Exp/h: ".. num($exphour) end,
    function() return "Time to next level: " .. time(timetolevel()) end
    } -- Thanks Leonardo

    local drop_profit, supply_waste = 0, 0

    local old_type = getsetting('Settings/TypeWaitTime')
    local old_press = getsetting('Settings/PressWaitTime')

    init end

    auto(100)
    foreach newmessage m do
    if m.type == MSG_PVT then

    -- set type/press wait time --
    setsetting('Settings/TypeWaitTime', '10 to 20 ms')
    setsetting('Settings/PressWaitTime', '10 to 20 ms')

    -- general info --
    for i = 1, #safelist do
    if m.content:lower() == commands[1]:lower() and (m.sender == safelist[i] and maround(7) == 0) then
    for c = 1, #info do
    say("Local Chat", string.format("*%s* %s", m.sender, info[c]()))
    end
    end
    end

    -- supplies used --
    -- kinda useless command tho --
    for i = 1, #safelist do
    if m.content:lower() == commands[2]:lower() and (m.sender == safelist[i] and maround(7) == 0) then
    foreach supplyitem n do
    say("Local Chat", string.format("*%s* %s: %s. %s: %s gps", m.sender, n.name .. " used", n.amountused, "Total spent", num(n.buyprice * n.amountused)))
    end
    end
    end

    -- profit --
    for i = 1, #safelist do
    if m.content:lower() == commands[3]:lower() and (m.sender == safelist[i] and maround(7) == 0) then
    drop_profit = 0
    supply_waste = 0
    foreach lootingitem drops do
    drop_profit = drops.sellprice * drops.amountlooted + drop_profit
    end
    foreach supplyitem supply do
    supply_waste = supply.buyprice * supply.amountused + supply_waste
    end
    say("Local Chat", string.format("*%s* %s: %s gps", m.sender, "Total profit", num(drop_profit - supply_waste)))
    end
    end

    -- go back to the original type/press wait time --
    setsetting('Settings/PressWaitTime', old_press)
    setsetting('Settings/TypeWaitTime', old_type)
    end
    end


    Changelog
    Code:
    - 1.0.0 Release
    - 1.1.0 Made some changes to make it safer (thanks to Leonardo and Orexx)
    - Added a gist link to the thread
    Gist
    Last edited by Rukasu; 07-01-2014 at 02:03 AM. Reason: Updated to V 1.1.0

  2. #2
    Free User Orexx's Avatar
    Join Date
    Dec 2013
    Posts
    760
    Reputation
    21
    Rep Power
    22
    It works, however, I suggest to make it type when no monsters are on screen, as if its hunting a hardcore script with a lot of actions, it could potentially, kill the character while trying to PM.


    Nice work.

  3. #3
    Free User Rukasu's Avatar
    Join Date
    Apr 2014
    Location
    Brazil, SC
    Posts
    57
    Reputation
    20
    Rep Power
    21
    Yeah, I thought about it. But I think it won't kill the character since it won't overwrite the bot actions. If the bot needs to heal, it'll heal and will forget abou the PM. (it actually happenned lots of times while I was testing the functions)

    But I'll add another check just for security purposes, thank you for your feedback

  4. #4
    Moderator Leonardo's Avatar
    Join Date
    Dec 2013
    Location
    Brazil
    Posts
    758
    Reputation
    77
    Rep Power
    22
    A nice piece of code, I'll just add a few tips.

    Probably you noticed when you say "!info" the information is frozen. It's because you store the info on a variable and then just read it.

    You can fix by putting them on functions. That will make it refresh each time it's called.

    local info = { 
    function() return "Level: ".. $level end,
    function() return "Balance: " .. num($balance) end,
    function() return "Stamina: ".. time($stamina) end,
    function() return "Played time: ".. time(math.floor($charactertime / 1000)) end,
    function() return "Exp/h: ".. num($exphour) end,
    function() return "Time to next level: " .. time(timetolevel()) end
    }


    and changing line 50 to:

    say("Local Chat", string.format("*%s* %s", m.sender, info[c]()))


    And you can make it non case sensitive, by changing "m.content" to "m.content:lower()". That will make "!INFO" works as well.

    And rep+ of course.

  5. #5
    Free User Rukasu's Avatar
    Join Date
    Apr 2014
    Location
    Brazil, SC
    Posts
    57
    Reputation
    20
    Rep Power
    21
    Thank you, @Leonardo!
    Made the changes you said.

    @Topic
    Updated the script to Version 1.1.0
    Now it will only PM if there's no monsters on the screen.

  6. #6
    Free User
    Join Date
    Apr 2014
    Posts
    22
    Reputation
    10
    Rep Power
    0
    Nice, can add a comand to got label "leave" or "depositer" or any i want ?
    is good for ppl send chars when near save server..

    PD: Sorry my sht english

  7. #7
    Free User
    Join Date
    Aug 2014
    Posts
    5
    Reputation
    10
    Rep Power
    0
    I tried it out and did not work.

  8. #8
    Free User Rukasu's Avatar
    Join Date
    Apr 2014
    Location
    Brazil, SC
    Posts
    57
    Reputation
    20
    Rep Power
    21
    Quote Originally Posted by yuricasbr View Post
    Nice, can add a comand to got label "leave" or "depositer" or any i want ?
    is good for ppl send chars when near save server..

    PD: Sorry my sht english
    Yeah, I was trying to figure out how to do that actually. When I do, I'll add that function.

    Quote Originally Posted by dobotao View Post
    I tried it out and did not work.
    Did you put the names of your characters on the safelist?
    Because it seems to work here.

  9. #9
    Free User EdwinYaire's Avatar
    Join Date
    Apr 2014
    Location
    U.S.A
    Posts
    512
    Reputation
    36
    Rep Power
    22
    works great it is usefull because i ever check my chars over remote desktop now you make it easy xd, should be fine add if there is another player on the screen

  10. #10
    Free User
    Join Date
    Sep 2015
    Posts
    3
    Reputation
    10
    Rep Power
    0
    Quote Originally Posted by Rukasu View Post
    Thank you, @Leonardo!
    Made the changes you said.

    @Topic
    Updated the script to Version 1.1.0
    Now it will only PM if there's no monsters on the screen.
    I need it to send messages even with monsters on the screen. how do I
    it?

    and I need it to show the skills too in PM
    Last edited by legzin; 02-25-2016 at 06: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
  •