Problems on targeting :/

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
dr-nuker
Posts: 145
Joined: Sun Oct 09, 2011 7:33 am

Problems on targeting :/

#1 Post by dr-nuker »

Hello honeypuffs!

Here is what i have:

Code: Select all

        <!-- #  1 --><waypoint x="-3905" z="6153" y="55" tag="notfinished">
        -- the point at which we wait until pumpkin spawn

        local queststate = getQuestStatus("Pumpkin Pranksters")
        if queststate == "complete" then
                __WPL:setDirection(WPT_BACKWARD);
        else
                -- questing starts here
                cprintf(cli.yellow,"We park here and wait for Spooky pumpkin...\n")
                settings.profile.options.HARVEST_DISTANCE=300
                player:update();
                while (true) do
                        yrest(50)
                        --player:target_Object("Spooky Pumpkin");
                        player:findTarget("Spooky Pumpkin"); -- spooky or empty one
                        local target = player:getTarget();
                        target:update();
                        if ((target.id == 116032) or (target.id == 115349)) then -- spooky pumpkin
                        -- found at least one so we can start the farm
                                player:clearTarget();
                                settings.profile.options.HARVEST_DISTANCE=50
                                player:update();
                                yrest(100)
                                break
                        end
                end
                checkdebuff(-3905,6153,55)
                prankster()
        end
        </waypoint>
basically the waypoint lets us stay a a spot in a resting mode. Once a pumpkin spawns it should detect it and go on with all the following waypoints.
But basically it doesnt do it.

The problem is:
There are false pumpkins and real ones. No matter which kind spawns the bot should start but has to target the pumpkin at the correct waypoint not anotherone because then it will crash into walls and look very bottish...

The function checkdebuff() is a dirty code to check if we have panic debuff. If so it will teleport the char abck to the coords as long as panic runs.
Prankster is a small function to click the pumpkins and all. this works... but im lacking the right method to start the script...


any ideas?

br,
nuker
User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Problems on targeting :/

#2 Post by lisa »

you don't want finTarget()

Code: Select all

function CPlayer:findTarget()
firstly it doesn't use an argument so adding the name to it would do nothing.
secondly that function just basically does a tab keypress and then checks if it targeted anything.

The function you want is

Code: Select all

function CPlayer:findNearestNameOrId(_objtable, ignore, evalFunc)
So you will be looking at something like this

Code: Select all

                        spooky = player:findNearestNameOrId("Spooky Pumpkin")
                        if spooky then
                               player:clearTarget();
                                settings.profile.options.HARVEST_DISTANCE=50
                                player:update();
                                yrest(100)
                                break
                        end

Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
dr-nuker
Posts: 145
Joined: Sun Oct 09, 2011 7:33 am

Re: Problems on targeting :/

#3 Post by dr-nuker »

I'll give that a try ;)
Post Reply