XenoBot Forums - Powered by vBulletin

User Tag List

Results 1 to 9 of 9

Thread: HowTo execute/kill a lua script triggered by wpt label/main lua file?

  1. #1
    Senior Member
    Join Date
    Jun 2012
    Location
    Glasgow
    Posts
    903
    Mentioned
    78 Post(s)
    Tagged
    0 Thread(s)

    Question HowTo execute/kill a lua script triggered by wpt label/main lua file?

    I'm searching for a way to execute or kill a lua script based on label. For example I'm exping at drefia wyrms and for this place you need to pass the quest room. I want to execute a exevo mas san script only for this room and disable it/kill it afterwards cuz its waste on wyrms. And on leaving the same: before questroom label which executes the mas san and after the room another label which kills the script. Is that possible?

  2. #2
    Kush's Avatar
    Join Date
    Jul 2012
    Posts
    365
    Mentioned
    57 Post(s)
    Tagged
    0 Thread(s)
    Make a module, and then when pass in label you activate / deactivate.

    lua code:
    local statusMasSan = false

    if (label == "Active") then
    statusMasSan = true
    elseif (label == "Desactive") then
    statusMasSan = false
    end

    Module.New("Exevo mas san", function(module)
    if (statusMasSan) then
    -- body
    end

    module:Delay(500)
    end)

  3. #3
    Senior Member
    Join Date
    Jun 2012
    Location
    Glasgow
    Posts
    903
    Mentioned
    78 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Kush View Post
    Make a module, and then when pass in label you activate / deactivate.

    lua code:
    local statusMasSan = false

    if (label == "Active") then
    statusMasSan = true
    elseif (label == "Desactive") then
    statusMasSan = false
    end

    Module.New("Exevo mas san", function(module)
    if (statusMasSan) then
    -- body
    end
    module:Delay(500)
    end)
    how do i make the exevo mas san module? and where do i place it into my main lua?

  4. #4
    Kush's Avatar
    Join Date
    Jul 2012
    Posts
    365
    Mentioned
    57 Post(s)
    Tagged
    0 Thread(s)
    Pass me the file that you use for exevo mas san.

  5. #5
    Senior Member
    Join Date
    Jun 2012
    Location
    Glasgow
    Posts
    903
    Mentioned
    78 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Kush View Post
    Pass me the file that you use for exevo mas san.
    http://pastebin.com/bcHeYzBW


    lua code:

    --[[
    Instructions:
    Attacks are prioritized least to greatest.

    Required parameters:
    words = spell words or rune id
    min = minimum monster amount to trigger spell/rune
    distance = the max range of the attack

    Optional parameters:
    max = the max monsters the spell will attack
    mana = the minimum mana you want to have before casting
    padding = the extra sqm's to check for players PAST the attack distance (default is 0)
    needsTarget = the attack needs a target (exori hur, etc)
    needsDirection = spells most effective when facing target (exori min)
    multiFloor = check for players above/below (stairhop skulling)
    ignoreParty = ignore player checks for party members
    whiteList = table of players to ignore
    targetList = table of monsters to attack, to attack all do not specify this option

    ]]


    attack = {}
    attack[1] = {words="exevo mas san", min = 3, distance = 2, padding = 4, multiFloor = true}



    function getTargetCount(distance, padding, multiFloor, ignoreParty, whiteList, targetList)
    local n = 0
    padding = padding or 0
    whiteList = whiteList or {}
    targetList = targetList or {}
    for i = CREATURES_LOW, CREATURES_HIGH do
    local cid = Creature.GetFromIndex(i)
    local checkPad = cid:isPlayer() and padding or 0
    if(cid:isValid() and cid:isVisible() and cid:isAlive() and cid:DistanceFromSelf() <= (distance + checkPad) and not cid:isSelf())then
    if(getSelfPosition().z == cid:Position().z or (multiFloor and cid:isPlayer()))then
    if(cid:isPlayer() and (not cid:isPartyMember() or not ignoreParty) and not table.find(whiteList, cid:Name(), false))then
    return 0
    elseif(cid:isMonster() and (table.find(targetList, cid:Name(), false) or #targetList<1))then
    n = n + 1
    end
    end
    end
    end
    return n
    end

    function main()
    for i = 1, #attack do
    local atk = attack[i]
    local count = getTargetCount(atk.distance, atk.padding, atk.multiFloor, atk.ignoreParty, atk.whiteList, atk.targetList)
    if(count > 0)then
    if(count >= atk.min and count <= ((atk.max == nil) and count or atk.max))then
    if(type(atk.words) == 'number')then
    Self.UseItemWithMe(atk.words)
    wait(900, 1200)
    elseif(Self.CanCastSpell(atk.words) and (not atk.mana or Self.Mana() >= atk.mana))then
    local target = Creature.GetByID(Self.TargetID())
    if(atk.needsTarget or atk.needsDirection)then
    if(target:isOnScreen() and target:isVisible() and target:isAlive())then
    if(target:DistanceFromSelf() <= atk.distance)then
    if(atk.needsDirection)then
    local pos, toPos = getSelfPosition(), target:Position()
    local dir = pos.x > toPos.x and WEST or pos.x < toPos.x and EAST or pos.y > toPos.y and NORTH or SOUTH
    Self.Turn(dir)
    wait(100, 200)
    else
    Self.Say(atk.words)
    end
    end
    end
    end
    if(not atk.needsTarget)then
    Self.Say(atk.words)
    end
    wait(600, 1000)
    end
    end
    end
    end
    end

    print([[
    Name: Auto Area Attack
    Description: Shoots area spells/rune on certain conditions
    Author: Cavitt Glover (Syntax)
    Version: 5.0.00 (updated 11.26.2012)]])
    wait(2000)

    registerEventListener(TIMER_TICK, "main")

  6. #6
    Kush's Avatar
    Join Date
    Jul 2012
    Posts
    365
    Mentioned
    57 Post(s)
    Tagged
    0 Thread(s)

  7. #7
    Senior Member
    Join Date
    Jun 2012
    Location
    Glasgow
    Posts
    903
    Mentioned
    78 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Kush View Post
    yo thanks works fine

  8. #8
    Odemis's Avatar
    Join Date
    Oct 2013
    Posts
    239
    Mentioned
    42 Post(s)
    Tagged
    0 Thread(s)
    @Kush I sent you a script via PM, could you help me like you did up /\ Thanks, or @NeeP?
    Last edited by Odemis; 01-03-2015 at 04:56 PM.

  9. #9
    Senior Member
    Join Date
    Jun 2012
    Location
    Glasgow
    Posts
    903
    Mentioned
    78 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Odemis View Post
    @Kush I sent you a script via PM, could you help me like you did up /\ Thanks, or @NeeP?
    I can eventually, mind posting here or send me.

Tags for this Thread

Posting Permissions

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