XenoBot Forums - Powered by vBulletin

User Tag List

Page 2 of 2 FirstFirst 12
Results 11 to 18 of 18

Thread: Open door with key.

  1. #11

    Join Date
    May 2015
    Posts
    92
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    its doesnt work

  2. #12

    Join Date
    Feb 2012
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Aristeus View Post
    You also need to put in the coordinates for the door (x, y, z) in the appropriate places but don't touch anything in the function "useKeyOnDoor"

    Also, you don't need to have this in a separate script just put it in the same script you're using to hunt.
    Paste the second section at the end of the file and the first under the lablename that you've chosen to open the door with.

    Hello there! im having some trouble getting this script to work, what am I doing wrong? didnt really understand what to do just paste it into my "hunting script"?

    Walker.Stop()
    wait(800,1600)
    if Map.GetTopUseItem(32190, 32432, 8).id == 1632 then --- checks the id of the locked door
    useKeyOnDoor(2968, 32190, 32432, 8) --- opens if locked.
    wait(400,600)
    Walker.Start()
    else
    if not Map.IsTileWalkable(32190, 32432, 8) then Self.UseDoor(32190, 32432, 8) --- opens door if unlocked
    Walker.Start()
    end
    Walker.Start() ---- If door is neither locked or closed it'll just go to the next node and walk through it
    end
    function useKeyOnDoor(keyID, x, y, z) --- from forgee's library
    local Cont = Container.New(0) -- check in main backpack (index is 0)
    if Cont:CountItemsOfID(keyID) > 0 then
    for s = 0, Cont:ItemCount() do --find specific itemid spot
    local item = Cont:GetItemData(s)
    if item.id == keyID then
    Cont:UseItemWithGround(s, x, y, z)
    end
    end
    end
    end

  3. #13
    Senior Member Aristeus's Avatar
    Join Date
    Jun 2013
    Location
    Sweden
    Posts
    600
    Mentioned
    28 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by artichunter123 View Post
    Hello there! im having some trouble getting this script to work, what am I doing wrong? didnt really understand what to do just paste it into my "hunting script"?

    Walker.Stop()
    wait(800,1600)
    if Map.GetTopUseItem(32190, 32432, 8).id == 1632 then --- checks the id of the locked door
    useKeyOnDoor(2968, 32190, 32432, 8) --- opens if locked.
    wait(400,600)
    Walker.Start()
    else
    if not Map.IsTileWalkable(32190, 32432, 8) then Self.UseDoor(32190, 32432, 8) --- opens door if unlocked
    Walker.Start()
    end
    Walker.Start() ---- If door is neither locked or closed it'll just go to the next node and walk through it
    end
    function useKeyOnDoor(keyID, x, y, z) --- from forgee's library
    local Cont = Container.New(0) -- check in main backpack (index is 0)
    if Cont:CountItemsOfID(keyID) > 0 then
    for s = 0, Cont:ItemCount() do --find specific itemid spot
    local item = Cont:GetItemData(s)
    if item.id == keyID then
    Cont:UseItemWithGround(s, x, y, z)
    end
    end
    end
    end
    Impossible for me to say what you're doing wrong with so little information. You'll have to describe what's not working.

    The function should be pasted in the same script but not in the same label. Just put it at the end of the script. Only the first part should trigger at a specific label.

  4. #14

    Join Date
    Feb 2012
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Aristeus View Post
    Impossible for me to say what you're doing wrong with so little information. You'll have to describe what's not working.

    The function should be pasted in the same script but not in the same label. Just put it at the end of the script. Only the first part should trigger at a specific label.


    I just get a error message when im trying to make a label in the script, (Error: '<eof>' expected near 'elseif') dont know what im doing wrong, could you help me out? haha

    KeyId=2968
    x=32190
    y=32432
    z=8


    elseif (labelName == "OpenDoor") then
    Walker.Stop()
    wait(800,1600)
    if Map.GetTopUseItem(32190, 32432, 8).id == LockedID then --- checks the id of the locked door
    useKeyOnDoor(2968, 32190, 32432, 8) --- opens if locked.
    wait(400,600)
    Walker.Start()
    else
    if not Map.IsTileWalkable(32190, 32432, 8) then Self.UseDoor(32190, 32432, 8) --- opens door if unlocked
    Walker.Start()
    end
    Walker.Start() ---- If door is neither locked or closed it'll just go to the next node and walk through it
    end

    function useKeyOnDoor(keyID, x, y, z) --- from forgee's library
    local Cont = Container.New(0) -- check in main backpack (index is 0)
    if Cont:CountItemsOfID(keyID) > 0 then
    for s = 0, Cont:ItemCount() do --find specific itemid spot
    local item = Cont:GetItemData(s)
    if item.id == keyID then
    Cont:UseItemWithGround(s, x, y, z)
    end
    end
    end
    end

    this is what I pasted in my hunting script..

  5. #15
    Senior Member Aristeus's Avatar
    Join Date
    Jun 2013
    Location
    Sweden
    Posts
    600
    Mentioned
    28 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by artichunter123 View Post
    I just get a error message when im trying to make a label in the script, (Error: '<eof>' expected near 'elseif') dont know what im doing wrong, could you help me out? haha

    KeyId=2968
    x=32190
    y=32432
    z=8


    elseif (labelName == "OpenDoor") then
    Walker.Stop()
    wait(800,1600)
    if Map.GetTopUseItem(32190, 32432, 8).id == LockedID then --- checks the id of the locked door
    useKeyOnDoor(2968, 32190, 32432, 8) --- opens if locked.
    wait(400,600)
    Walker.Start()
    else
    if not Map.IsTileWalkable(32190, 32432, 8) then Self.UseDoor(32190, 32432, 8) --- opens door if unlocked
    Walker.Start()
    end
    Walker.Start() ---- If door is neither locked or closed it'll just go to the next node and walk through it
    end

    function useKeyOnDoor(keyID, x, y, z) --- from forgee's library
    local Cont = Container.New(0) -- check in main backpack (index is 0)
    if Cont:CountItemsOfID(keyID) > 0 then
    for s = 0, Cont:ItemCount() do --find specific itemid spot
    local item = Cont:GetItemData(s)
    if item.id == keyID then
    Cont:UseItemWithGround(s, x, y, z)
    end
    end
    end
    end

    this is what I pasted in my hunting script..
    I'm still having trouble understanding what you're pasting where. You shouldn't even be getting that bug if you followed the instructions correctly. Can't really help you with it either since it might be in some other part of the script (eof = end of function).

    I'd suggest you read some basic guides on scripting first. None of this is particularly hard if you have the basics under control.

    Good guide to start with: http://forums.xenobot.net/showthread...-Script-Making

  6. #16

    Join Date
    Feb 2012
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Aristeus View Post
    I'm still having trouble understanding what you're pasting where. You shouldn't even be getting that bug if you followed the instructions correctly. Can't really help you with it either since it might be in some other part of the script (eof = end of function).

    I'd suggest you read some basic guides on scripting first. None of this is particularly hard if you have the basics under control.

    Good guide to start with: http://forums.xenobot.net/showthread...-Script-Making
    Okey, thanks

  7. #17
    Lifetime Subscriber
    Join Date
    Aug 2012
    Location
    Stockholm, Sweden
    Posts
    428
    Mentioned
    15 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by artichunter123 View Post
    Okey, thanks
    I think you are copying scripts into wrong place, I think your putting function inside the function and I think that won't work, unsure tho, but what you really are missing is an "end" somewhere...

    Post your WHOLE lua here and I can try help you, or if you wish, in private...
    Belden's Free Scripts
    Belden's Quest Scripts

    Bought Lifetime Subscription from Fractal
    Bought TeamSpeak 3 Service from Sikkness
    Bought Leveling Service from Y2Quakepc2

  8. #18

    Join Date
    Feb 2012
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by krille09 View Post
    I think you are copying scripts into wrong place, I think your putting function inside the function and I think that won't work, unsure tho, but what you really are missing is an "end" somewhere...

    Post your WHOLE lua here and I can try help you, or if you wish, in private...
    Oh, thats very nice of you. I checked some other scripts and found out exactly what you said haha, I put the function in the wrong place. Got it working now

Posting Permissions

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