Page 1 of 3
Extracting 'scores'
Posted: Mon Feb 24, 2014 5:50 pm
by ZZZZZ
How do I extract a score or level from a score board sorta like AndorTraining? I noticed it looks for a buff to get the score, but I don't see any buff, so is it invisible or is there a certain way to get the scores?
Re: Extracting 'scores'
Posted: Mon Feb 24, 2014 6:39 pm
by lisa
andor training, from memory, has a buff which shows the score and is visible, so this may not help you.
Code: Select all
buffed = player:getBuff(622402)
--buffed.Level is the current score.
Are you talking about the flower throwing thing on varanas bridge people are talking about?
I might have a look at it later today, if I get a chance.
Re: Extracting 'scores'
Posted: Mon Feb 24, 2014 6:54 pm
by ZZZZZ
hmm, thought Andor's buff was just the AoE lol.
The score im looking for is the one from within dreamland. Every round that you do, it increases another level. It has 2 scores, lives left and round level. I have made a waypoint to farm it, but I just need to figure out how to detect if the round has changed, and if so load closest waypoint. I could try using waitForLoadingScreen though, but sometimes it doesnt appear (just instantly moves to next area) and dont really want to use waitForLoadingScreen(x) if I can avoid it. This way I'll also be able to print the score at the end as well.
Re: Extracting 'scores'
Posted: Mon Feb 24, 2014 10:13 pm
by lisa
If it is moving you then detect coords changing?
Not sure I can do any testing in dreamland, so yeah just able to give ideas and such.
Re: Extracting 'scores'
Posted: Tue Feb 25, 2014 12:49 am
by ZZZZZ
When I get home i'll have a look at it. It does move you so it should work. The other idea a friend of mine had was to constantly check for the debuff that appears on you at the end of a round, it lasts for 2-3 seconds and it removes unbridled >.<. But I can see it not working due to it appearing about the same time as the loading screen.
Re: Extracting 'scores'
Posted: Tue Feb 25, 2014 1:01 am
by lisa
When you get the loading screen does it always send you to the same spot each time?
If so you could check if you are on that spot but yeah distance check aswell.
I would probably look at doing all 3, check loading, check distance move and check in the new coords.
All 3 are just memory reads and so not a huge strain on the PC.
Re: Extracting 'scores'
Posted: Tue Feb 25, 2014 7:09 pm
by ZZZZZ
Can't believe i have to ask this....but how do I detect position change?
Code: Select all
ocal playerX, playerY, playerZ = player.X, player.Y, player.Z
repeat
yrest(100);
player:update();
until playerX, playerY, playerZ ~= player.X, player.Y, player.Z or memoryReadBytePtr(getProc(),addresses.loadingScreenPtr, addresses.loadingScreen_offset) ~= 0
gives the error
Code: Select all
Installing userfunctions. 10:33am - scripts\rom/bot.lua:86: ...omacro/scripts/ro
m/userfunctions/userfunction_ZZZZZZ.lua:627: unexpected symbol near ','
also tried
Code: Select all
currentwp = __WPL:getNearestWaypoint(player.X, player.Z);
repeat
__WPL:getNearestWaypoint(player.X, player.Z);
yrest(100);
player:update();
until currentwp ~= __WPL:getNearestWaypoint(player.X, player.Z) or memoryReadBytePtr(getProc(),addresses.loadingScreenPtr, addresses.loadingScreen_offset) ~= 0
But that doesn't work either. ^.^
Re: Extracting 'scores'
Posted: Tue Feb 25, 2014 7:41 pm
by lisa
you would need to "record" your coords and then compare those recorded values to current ones.
Code: Select all
-- at start up do this
prevcoords = player
-- then in your code somewhere you need to check if you got moved
player:update()
if distance(player,prevcoords) >= 200 or not isInGame() then
-- you got moved more than 200 distance
end
prevcoords = player
You could set it up as a timer, up to you really.
isInGame() checks for loading screen, so easier to just use that.
Re: Extracting 'scores'
Posted: Tue Feb 25, 2014 7:55 pm
by rock5
wont work because they will be the same table. When player coords get updated prevcoords will change too. This will work
Code: Select all
prevcoords = {X=player.X, Z=player.Z, Y=player.Y}
Re: Extracting 'scores'
Posted: Tue Feb 25, 2014 8:03 pm
by ZZZZZ
I'll try using
Code: Select all
prevcoords = {X=player.X, Z=player.Z, Y=player.Y}
repeat
player:update()
yrest(200);
until distance({X=player.X, Z=player.Z, Y=player.Y},prevcoords) >= 200 or not isInGame()
Basically there are 4 rooms that you get transported into, sometimes with a loading screen, sometimes without. After all mobs in the current room are looted it will send you into the next room.
After trying
Code: Select all
currentwp = __WPL:getNearestWaypoint(player.X, player.Z);
repeat
__WPL:getNearestWaypoint(player.X, player.Z);
yrest(100);
player:update();
until currentwp ~= __WPL:getNearestWaypoint(player.X, player.Z)
a bit more I found that it does work but only sometimes...not sure if that is due to how my function is set up or what, but i'll keep trying both ways to see if it works.
The other issue I have is also the bosses found every 5 levels. They have strats assuming you don't kill them fast enough...so somehow im going to have to either come up with a function for my rogue to do correct rotation or somehow use PartyHeals() function to aid in some of the strats (including 1 that freezes a random player in party).
There is only 1 that actually 100% needs a strat, and that is where the boss spawns 2 'shadow' adds of itself. Both need to be killed before the boss can be damaged again. I guess I can make a function that keeps checking how many enemies are within 300 range and attack those that are not the boss if enemy > 1? Will give it a shot anyway.
Re: Extracting 'scores'
Posted: Tue Feb 25, 2014 11:14 pm
by rock5
ZZZZZ wrote:until distance({X=player.X, Z=player.Z, Y=player.Y},prevcoords) >= 200 or not isInGame()
Even though this should work there is no need to create another table in the function. 'distance' looks for X, Z, Y values in the object so this should work and is easier.
Code: Select all
until distance(player,prevcoords) >= 200 or not isInGame()
Code: Select all
currentwp = __WPL:getNearestWaypoint(player.X, player.Z);
repeat
__WPL:getNearestWaypoint(player.X, player.Z);
yrest(100);
player:update();
until currentwp ~= __WPL:getNearestWaypoint(player.X, player.Z)
Just so you know, in the above code this line does nothing. Just remove it.
Code: Select all
__WPL:getNearestWaypoint(player.X, player.Z);
ZZZZZ wrote:There is only 1 that actually 100% needs a strat, and that is where the boss spawns 2 'shadow' adds of itself. Both need to be killed before the boss can be damaged again. I guess I can make a function that keeps checking how many enemies are within 300 range and attack those that are not the boss if enemy > 1? Will give it a shot anyway.
My guess is the 'shadow' versions will have a different Id.
Re: Extracting 'scores'
Posted: Wed Feb 26, 2014 8:42 am
by ZZZZZ
Ok....quite a few questions.
1: When running this function at the waypoints I have specified (within 100 range of 5-6 mobs):
Code: Select all
function KillMobs()
__WPL:setForcedWaypointType("NORMAL");
yrest(10)
player:update()
if player:findEnemy(nil,nil,evalTargetDefault) then
enemy = player:findEnemy(nil,nil,evalTargetDefault)
if enemy == "Hlethfir Deliriumscribe" then
useGoodie(critp);
RogueBoss(true);
Hlethfir();
elseif enemy == "Kaleks Nightmareclaw" or enemy == "Herugrim Dreamlava" or enemy == "Mayvel Nightmaremuse" then
useGoodie(critp);
RogueBoss(true);
end
while enemy do
player:target(enemy)
player:fight()
enemy = player:findEnemy(nil,nil,evalTargetDefault)
end
RogueBoss();
end
player:updateBattling()
if (not player.Battling) then
if player:findEnemy(nil, nil, evalTargetLootable) then
local Lootable = player:findEnemy(nil, nil, evalTargetLootable)
while Lootable do
player:target(Lootable)
if player.TargetPtr ~= 0 then
player:lootAll()
end
Lootable = player:findEnemy(nil, nil, evalTargetLootable)
end
end
end
__WPL:setForcedWaypointType("TRAVEL");
prevcoords = {X=player.X, Z=player.Z, Y=player.Y}
repeat
player:update()
yrest(1000);
until distance(player,prevcoords) >= 200
yrest(2000);
if isInGame() then
DLApplyPots()
player:update()
__WPL:setWaypointIndex(__WPL:getNearestWaypoint(player.X,player.Z,player.Y))
end
end
I simply get this
Code: Select all
Moving to waypoint #4, (6715, 2935)
Forced waypoint type 'NORMAL' set by user.
Forced waypoint type 'TRAVEL' set by user.
It doesn't attack the mobs unless they have me targeted and are actually attacking me. So ends up sitting there while the mobs beat on my healer until either time runs out or healer dies 3 times (part of the dreamland restrictions, 3 lives until you fail).
2: Another issue is actually to do with fighting, how do I fight a set mob/boss until mobs of a certain ID have appeared, then kill them off before returning to fighting the boss? I tried the following:
Code: Select all
function Hlethfir(); -- add ID = 104924
repeat
player:target(enemy)
repeat
player:fight();
until player:findEnemy(nil, 104924, evalTargetDefault);
player:breakFight();
ghostadd = player:findEnemy(nil, 104924, evalTargetDefault);
while ghostadd do
player:target(ghostadd)
player:fight()
ghostadd = player:findEnemy(nil, 104924, evalTargetDefault);
end
until enemy == false
end
But it just keeps fighting until the max fight time, at which time it breaksfight then retargets and repeats. It can kill the adds around it by using AoE's, but they are high cd and half the time my character doesnt have enough energy to cast it anyway.
Last question is also to do with fights, but with skill casts, I get
Code: Select all
Use MACRO: ROGUE_SHADOWSTAB => Hlethfir Deliriumscribe (9554723/10019151)
Use MACRO: ROGUE_LOW_BLOW => * Failed to cast *
Use MACRO: ROGUE_WOUND_ATTACK => * Failed to cast *
Use MACRO: ROGUE_THROW => * Failed to cast *
a lot, where shadowstab is hitting and the rest are not being cast successfully. I have anywhere between 200-400 ping, so im assuming its simply trying to cast them too fast or something, but is there any way to avoid that and make it cast more reliable or something? Throw itself shouldn't be failing though because it doesnt actually have a GCD like most skills, so im not sure what is going on.
Re: Extracting 'scores'
Posted: Wed Feb 26, 2014 9:25 am
by rock5
Lisa could probably answer number 1 best.
Number 2, player:fight() doesn't end until the fight ends so doing player:breakfight() after it is pointless. What you want to do is check for the adds during the fight. The only way to do this is use the onskillcast section of the profile.
Last question, I'm not sure. I have been noticing recently that sometimes it starts saying that it failed to cast when it actually does cast and just restarting the waypoint file fixes it. Could that be what's happening to you? Does it actually fail to cast or only just say that it fails to cast?
Re: Extracting 'scores'
Posted: Wed Feb 26, 2014 9:40 am
by ZZZZZ
I wish :/ It's actually failing. Watched it for a bit and only ShadowStab bleed was appearing on the boss. I'll try your suggestion with the onSkillCast and give that a shot and while im doing it i'll test cast fail issue as well, see if I can change/figure out what is going on.
~~ Also, how do you add an 'onSkillCast' section into your profile through the onload of a waypoint?
Re: Extracting 'scores'
Posted: Wed Feb 26, 2014 10:03 am
by rock5
Actually, I believe in the current version of the bot player.LastHitTime is not working so that might be cause issues. You'll have to wait for the next commit.
The event is saved in settings.profile.events.onSkillCast. You can just create a new function like this.
Code: Select all
function settings.profile.events.onSkillCast(arg1)
...
end
Or if you want to also execute what's in the profile,
Code: Select all
oldOnSkillCast = settings.profile.events.onSkillCast
function settings.profile.events.onSkillCast(arg1)
if type(oldOnSkillCast) == "function" then
oldOnSkillCast(arg1)
end
...
end
Re: Extracting 'scores'
Posted: Wed Feb 26, 2014 6:15 pm
by ZZZZZ
So
Code: Select all
function settings.profile.events.onSkillCast(arg1)
ghostadd = player:findEnemy(nil, 104924, evalTargetDefault);
if ghostadd then
player:breakfight()
while ghostadd do
player:target(ghostadd)
player:fight()
ghostadd = player:findEnemy(nil, 104924, evalTargetDefault);
end
end
end
Should work? Assuming player.LastHitTime is working.
Re: Extracting 'scores'
Posted: Wed Feb 26, 2014 6:54 pm
by lisa
rock5 wrote:Lisa could probably answer number 1 best.
I would probably add in prints all over that code to see what lines are being executed and what isn't, prints are your best friend when trying to work out issues.
At a guess though, you may need to set the main characters party options to true so that it actually tries to defend party members, either that or set antiKS to false.
ZZZZZ wrote:Should work? Assuming player.LastHitTime is working.
I could be wrong but you might be causing a never ending loop because you break the fight and then tell it to attack that specific mob, then you tell it to player:fight() which then does that code again and it finds the mob specified and so breaks fight and finds mob again and so on.
Maybe in this bit
if ghostadd then
add in a check if the mob is already target.
Code: Select all
local target = player:getTarget()
if ghostadd and target.Id ~= 104924 then
So if you are already attacking that specific mob it won't break the fight.
Not sure if there was any other issues I missed.
Re: Extracting 'scores'
Posted: Wed Feb 26, 2014 7:06 pm
by rock5
Well if you think about it, you only want to do the check if you are fighting the boss, right? So maybe check to see if target is boss instead? Also, you might try retargeting the boss at the end. It might work and speed things up.
Code: Select all
function settings.profile.events.onSkillCast(arg1)
local target = player:getTarget()
if target.Name == "Boss name" then
local ghostadd = player:findEnemy(nil, 104924, evalTargetDefault);
if ghostadd then
player:breakfight()
while ghostadd do
player:target(ghostadd)
player:fight()
ghostadd = player:findEnemy(nil, 104924, evalTargetDefault);
end
end
player:target(target)
end
end
Re: Extracting 'scores'
Posted: Thu Feb 27, 2014 12:52 am
by lisa
Finally found it, it is actually in player:moveTo()
Remove this from your profile, for now.
The issue as I see it is the moveto only checks if the variable has a value and so if it is actually "false" and not false then it has a string and has a value, so maybe in the profiles the "false" isn't getting changed to a boolean like I thought it should be.
So player:moveto has this
Code: Select all
if settings.profile.options.PARTYLEADER_WAIT and GetPartyMemberName(1) then
if not checkparty(150) then
releaseKeys()
repeat yrest(500) self:updateBattling() until checkparty(150) or self.Battling
end
end
So it is passing the first if statement as being PARTYLEADER_WAIT and in a party, then it does the checkparty function which checks the party members, which is where that print is coming from about party member 1 has name of ***.
So yeah remove the PARTYLEADER_WAIT or make sure to change it to false before you load the new path, of maybe have the new WP change it to false.
Re: Extracting 'scores'
Posted: Thu Feb 27, 2014 1:33 am
by ZZZZZ
Added some prints in for now to tell me what its doing, and currently im getting this:
Code: Select all
Waiting for next area2
Waiting for next area2
Area changed
Used pdam75.
Used grass.
Waiting for next area1
Waiting for next area2
Function that manages this:
Code: Select all
function KillMobs()
yrest(10)
player:update()
if player:findEnemy(nil,nil,evalTargetDefault) then
enemy = player:findEnemy(nil,nil,evalTargetDefault)
printf(""..enemy.Name.."");
if enemy.Name == "Hlethfir Deliriumscribe" or enemy.Name == "Kaleks Nightmareclaw" or enemy.Name == "Herugrim Dreamlava" or enemy.Name == "Mayvel Nightmaremuse" then
useGoodie("critp");
RogueBoss(true);
printf("Boss settings updated");
end
while enemy do
player:target(enemy)
player:fight()
enemy = player:findEnemy(nil,nil,evalTargetDefault)
end
RogueBoss();
end
player:updateBattling()
if (not player.Battling) then
if player:findEnemy(nil, nil, evalTargetLootable) then
local Lootable = player:findEnemy(nil, nil, evalTargetLootable)
while Lootable do
player:target(Lootable)
if player.TargetPtr ~= 0 then
player:lootAll()
end
Lootable = player:findEnemy(nil, nil, evalTargetLootable)
end
end
else
KillMobs();
end
cprintf(cli.yellow,"\nWaiting for next area1\n")
prevcoords = {X=player.X, Z=player.Z, Y=player.Y}
repeat
player:update()
yrest(1000);
cprintf(cli.yellow,"\nWaiting for next area2\n")
until distance(player,prevcoords) >= 200
yrest(2000);
cprintf(cli.yellow,"\nArea changed\n")
if isInGame() then
DLApplyPots()
yrest(1000);
player:update()
__WPL:setWaypointIndex(__WPL:getNearestWaypoint(player.X,player.Z,player.Y))
end
end
Since changing PARTY to "true" and Anti-KS to "false" its now targeting the mobs correctly and successfully clearing/looting each round at least, but its not always loading the NearestWaypoint. (It does sometimes....but I cannot see any difference between when it works and when it does not).
The other issue is when a boss is detected it'll set 'changeProfileOption("PRIORITY_CASTING", true)' but if its true the bot will just spam shadowstab until out of energy, at which point it'll use throw until enough energy again.
Code: Select all
Use MACRO: ROGUE_SHADOWSTAB => Hlethfir Deliriumscribe (9688732/10019151)
Use MACRO: ROGUE_SHADOWSTAB => Hlethfir Deliriumscribe (9285241/10019151)
Use MACRO: ROGUE_SHADOWSTAB => Hlethfir Deliriumscribe (8720098/10019151)
Use MACRO: ROGUE_SHADOWSTAB => Hlethfir Deliriumscribe (8127202/10019151)
Code: Select all
<skills_rogue>
<skill name="ROGUE_ILLUSION_BLADE_DANCE" hotkey="MACRO" priority="100" autouse="false" />
<skill name="ROGUE_ENCHANTED_THROW" hotkey="MACRO" priority="50" />
<skill name="ROGUE_DAY_OF_RAIN" hotkey="MACRO" priority="60" />
<skill name="ROGUE_ENLIVENED_BLADE" hotkey="MACRO" priority="60" />
<skill name="ROGUE_WOUND_ATTACK" hotkey="MACRO" priority="80" />
<skill name="ROGUE_THROW" hotkey="MACRO" priority="70" />
<skill name="ROGUE_LOW_BLOW" hotkey="MACRO" priority="90" />
<skill name="ROGUE_HIDE" hotkey="MACRO" priority="10" autouse="false" />
<skill name="ROGUE_COMBAT_MASTER" hotkey="MACRO" priority="50"/>
<skill name="ROGUE_SHADOWSTAB" hotkey="MACRO" priority="100" />
<skill name="MAGE_FIREBALL" hotkey="MACRO" priority="10" autouse="false" />
<skill name="MAGE_LIGHTNING" hotkey="MACRO" priority="20" />
</skills_rogue>
Never really bothered with adding options and such into profile before so im not sure what to do.
lisa wrote:
Remove this from your profile, for now.
None of my profiles have that option in them.