XenoBot Forums - Powered by vBulletin

User Tag List

Results 1 to 8 of 8

Thread: Equip Looted Item

  1. #1

    Join Date
    Dec 2015
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Equip Looted Item

    Hello,

    The idea behind this script would be to verify items that are looted and to check if they have better characteristics than the equipment currently worn by my character. If they do have better stats, then I would like the bot to wear the new piece of equipment and throw the old one on the floor.

    The only way I could see myself doing this would be adding a label every waypoint called "CheckEQ" that looks at my inventory to check if I looted some sort of piece of equipment that would be better for my character. I would much rather have the bot decide all this after it loots a creature, but I don't think there are any methods of doing that.

    Any suggestions?

  2. #2

    Join Date
    Mar 2014
    Location
    Long Island
    Posts
    379
    Mentioned
    54 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by djnacht View Post
    Hello,

    The idea behind this script would be to verify items that are looted and to check if they have better characteristics than the equipment currently worn by my character. If they do have better stats, then I would like the bot to wear the new piece of equipment and throw the old one on the floor.

    The only way I could see myself doing this would be adding a label every waypoint called "CheckEQ" that looks at my inventory to check if I looted some sort of piece of equipment that would be better for my character. I would much rather have the bot decide all this after it loots a creature, but I don't think there are any methods of doing that.

    Any suggestions?
    Hi there! This is very possible, easiest if you expect something to be looted. I actually use this in my rook script (I made a rook script to get from 1-20 during which time to save supplies and level faster, I have it loot better gear/weapons then equip them if they exist)

    I don't use lables to do this though since you'll be carrying the gear around for a while then (I have my script drop the unused gear since it has no value though). They way I do it is by using modules, a constant scan to see what gear you've looted and by using Self.Weapon().id,Self.Armor().id etc. you can see if its what you'd prefer

    My name is Proteus!
    This is my Signature.
    Thanks.

  3. #3

    Join Date
    Dec 2015
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That sounds about right. I have no idea what modules are though, I'll see if I can figure it out.

    Just found this http://forums.xenobot.net/showthread...a-little/page2

    It explains it all perfectly.
    Last edited by djnacht; 01-02-2016 at 06:43 PM.

  4. #4
    Senior Member xux's Avatar
    Join Date
    Apr 2013
    Posts
    713
    Mentioned
    33 Post(s)
    Tagged
    0 Thread(s)
    Yea i got such thing in my own dawnport script as well its like this
    lua code:

    local longsword = false
    Checker = Module.New('longsword checker', function(mod)
    if (Self.ItemCount(3285) >0 and longsword ==false) then
    Cavebot.Stop()
    print("Holy cow!! It is the longsword!!")
    Self.Equip(3285, "weapon", 1)
    wait(1500)
    Self.DropItems(Self.Position().x, Self.Position().y, Self.Position().z, 3273)
    wait(1500)
    longsword = true
    Cavebot.Start()
    Checker:Stop()
    mod:Delay(20000)
    end
    mod:Delay(19000)
    end
    )


    Module.New('sword dropper', function(module)
    if (Self.ItemCount(3285) > 1) then
    delayWalker(1000)
    print("Dropping longsword.")
    Self.DropItem(Self.Position().x, Self.Position().y, Self.Position().z, 3285, 1)
    else


    end
    module:Delay(2000,10000)
    end)

    Need a private build script? PM me.

  5. #5

    Join Date
    Dec 2015
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    xux:

    I'm confused about this line here: Checker = Module.New('longsword checker', function(mod)

    What does function(mod) mean and what are these lines of code found a bit later on : mod: Delay(20000)?

  6. #6
    Senior Member xux's Avatar
    Join Date
    Apr 2013
    Posts
    713
    Mentioned
    33 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by djnacht View Post
    xux:

    I'm confused about this line here: Checker = Module.New('longsword checker', function(mod)

    What does function(mod) mean and what are these lines of code found a bit later on : mod: Delay(20000)?
    It just means that the module get's delayed for 20 seconds before starting again.

    Need a private build script? PM me.

  7. #7

    Join Date
    Dec 2015
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by xux View Post
    It just means that the module get's delayed for 20 seconds before starting again.
    Ok, so the script picks up all Longswords and then checks every 20 seconds if there is a longsword in the backpack.

    The : really throws me off, I'm new to all this and I haven't seen the colon used anywhere yet.

    Why is the parameter "Mod" passed to the function when you create a new module? I don't see that function declared anywhere.

  8. #8

    Join Date
    Dec 2015
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, so I've made a bit of progress on my own.

    function(mod) is what is called a anonymous function, so that makes sense to me now.

    "An important note is that in order to utilize the Module: Delay() function, you need to pass the module object to the function that you are calling."

    I still don't understand the parameter "mod" though and when and how it is being passed into the function. It is supposedly a module object, but how did it get there?

    I'm also confused as to what is being assigned to "Checker", because if I check its type it says its a table.

    Checker:Stop() doesn't seem to do anything, or nothing that I notice.

    Could someone help me with these questions, please?
    I know they are not really related to Xenobot, and more related to Lua, but I would still love for some help, or someone to tell me what to Google would be fine.
    Last edited by djnacht; 01-19-2016 at 04:21 AM.

Posting Permissions

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