Welcome to the Achaea Forums! Please be sure to read the Forum Rules.

Mudlet Help

LigeroLigero Posts: 2Member
So I am making an auto target script, all it does is track targets in the room, I hit my attack alias, it attacks the target. However, the issue I am having is that it changes targets each time... I can't figure out why or how to fix it. I'm new to coding and using a basic script that I found on a youtube video. I was wondering if anyone has any advice on how to get it to stick with one target until it is dead and then switch to the next one? This is the script I am using so far.

valid_target = { ["a large rabbit with one black ear"] = true, ["a brown floppy-eared rabbit"] = true, ["a creamy white goat"] = true, } function autoTarget() sendGMCP("Char.Items.Room") if gmcp.Char.Items.List.location == "room" then for k,v in ipairs(gmcp.Char.Items.List.items) do if valid_target[v.name] then tar = v.id end--if end--For end--If end--autoTarget function autoAssault() if tar then send("doublewhirl " .. tar) end--if end--autoAssault()

Thank you in advance.

Comments

  • RyzethRyzeth Posts: 1,105Member ✭✭✭✭✭ - Grand Achaean
    edited May 14
    if valid_target[v.name] then
       tar = v.id
       break
    end--if

    Should fix it. You'll want to make it so it only runs autoTarget on entry or when the mob dies, though. Otherwise it'll just be constantly setting. Alternatively make it not search the room table if your target's still in the room.
    Utianima
  • LigeroLigero Posts: 2Member
    Ryzeth said:
    if valid_target[v.name] then
       tar = v.id
       break
    end--if

    Should fix it. You'll want to make it so it only runs autoTarget on entry or when the mob dies, though. Otherwise it'll just be constantly setting. Alternatively make it not search the room table if your target's still in the room.

    @Ryzeth thanks wasn't aware I could do something like that. I'll add it in.
  • KelesKeles Posts: 8Member
    So I'm using the same setup, and having some issues with tracking things...

    function autoAssault() if tonumber(string.match(gmcp.Char.Vitals.charstats[2], "%d+")) >= 17 and rage_backfist then send("sbp " .. tar) end--if if tar and gmcp.Char.Vitals.charstats[4] == "willow" then send("combo " .. tar .. " flashheel left hiraku dart head") elseif tonumber(kata_chain) == 12 and gmcp.Char.Vitals.charstats[4] == "willow" then send("transition to rain form") send("combo " .. tar .. " frontkick left kuro right ruku torso") end--if end--autoAssault()

    For some reason, it isn't doing anything and I can't figure out what I am doing wrong with the code. Anyone that can take a look and help me resolve it by explaining where I screwed up, would be greatly appreciated. Thanks.

  • RyzethRyzeth Posts: 1,105Member ✭✭✭✭✭ - Grand Achaean
    edited May 28
    If you're in anything but willow form, that script isn't gonna do anything.

    Also does Shikudo stance save just with the name? Or is the table value listed as 'Stance: willow' etc?

  • AhmetAhmet Wherever I wanna bePosts: 3,244Member @@ - Legendary Achaean
    @Ryzeth "Form: Willow"
    Huh. Neat.
  • KelesKeles Posts: 8Member
    @Ryzeth when I do gmcp.Char.Vitals.charstats[4] it shows "Form: Willow".

    Even when I am in willow form it still won't do anything.

  • RyzethRyzeth Posts: 1,105Member ✭✭✭✭✭ - Grand Achaean
    edited May 28
    Keles said:
    @Ryzeth when I do gmcp.Char.Vitals.charstats[4] it shows "Form: Willow".

    Even when I am in willow form it still won't do anything.

    Try this.
    function autoAssault()
    	local rage = tonumber(string.match(gmcp.Char.Vitals.charstats[2], "Rage: (%d+)"))
    	local form = string.match(gmcp.Char.Vitals.charstats[4], "Form: (%w+)")
    
    	if rage >= 17 and rage_backfist then
    		send("sbp "..tar)
    	end
    
    	if tar and (form == "willow") then
    		send("combo "..tar.." flashheel left hiraku dart head")
    	elseif tonumber(kata_chain) >= 12 form =="willow" then
    		send("transition to rain form")
    		send("combo "..tar.." frontkick left kuro right ruku torso")
    	end
    end

    You'll still have to build on that for when you're not in willow form, though.
  • RyzethRyzeth Posts: 1,105Member ✭✭✭✭✭ - Grand Achaean
    Also oops, should be == "Willow" 

    Capitalisation matters, folks.
  • KelesKeles Posts: 8Member
    @Ryzeth It works! Thank you very much! I can work on building off it now that I have a better idea how it is supposed to be done. You rock.

  • RyzethRyzeth Posts: 1,105Member ✭✭✭✭✭ - Grand Achaean
    edited May 28
    Also because I didn't proofread it (literally just wrote it on the spot)
    elseif tonumber(kata_chain) >= 12 form =="Willow" then
    Should be
    elseif tonumber(kata_chain) >= 12 and form =="Willow" then
  • KelesKeles Posts: 8Member
    function autoAssault() local rage = tonumber(string.match(gmcp.Char.Vitals.charstats[2], "Rage: (%d+)")) local form = string.match(gmcp.Char.Vitals.charstats[4], "Form: (%w+)") if rage >= 17 and rage_backfist then send("sbp " .. tar) end if tar and tonumber(kata_chain) <= 10 and(form == "Willow") then send("combo " .. tar .. " flashheel left hiraku dart head") elseif tonumber(kata_chain) >= 10 and form =="Willow" then send("transition to rain form") send("combo " .. tar .. " frontkick left kuro right ruku torso") end if tar and tonumber(kata_chain) <= 23 and (form == "Rain") then send("combo " .. tar .. " frontkick left kuro right ruku torso") elseif tonumber(kata_chain) >= 24 and (form == "Rain") then send("transition to oak form") send("combo " .. tar .. " livestrike ruku torso risingkick head") end if tar and tonumber(kata_chain) <= 12 and (form == "Oak") then send("combo " .. tar .. " livestrike livestrike risingkick head") elseif tonumber(kata_chain) >= 12 and (form == "Oak") then send("transition to willow form") send("combo " .. tar .. " flashheel left hiraku dart head") end end

    This is the script so far. I am posting it here in case anyone else wants is messing with Shikudo and wants or needs a basic hunting setup. Feel free to build off it, post improvements, etc etc. Thanks goes to @Ryzeth for getting it started!

  • JonathinJonathin A deep pit of hunger and despairPosts: 3,154Member @@ - Legendary Achaean
    @Ryzeth

    Doesn't matter if you just lower() like you should.

    (Mudlet Clan): Nylian says, "Mosr's on the case. Fix incoming."

    Tutorials and scripts  The Repository

    Ahmet
Sign In to Comment.