Page 3 of 6
Re: Andor Trainig Range
Posted: Sat Nov 10, 2012 6:54 am
by dejfit
OK, here is what i made. It works great. Most of it is Lisa's code and rock's AT code. I want to make it log next char soon...
Code: Select all
<?xml version="1.0" encoding="utf-8"?><waypoints type="TRAVEL">
<onLoad>
--=== User Options ===--
When_Finished = "end"
-- "end" to end script, "relog" to log next character, "charlist" to log next in 'charlist' and "waypointfilename" to load that waypointfile.
CharList = {
}
-- Character list to use when using the "charlist" option above. Requires my "userfunction_LoginNextChar" userfunction.
-- Find it here. http://www.solarstrike.net/phpBB3/viewtopic.php?p=10350
-- eg.
-- CharList = {
-- {account=4,chars={}},
-- {account=8,chars={1}},
-- {account=7,chars={1,2,5}},
-- }
--====================--
local kate = GetIdName(121035) --Kate Wesker
local magelly = GetIdName(120687) --Magelly Basac
--== MINIGAME ==--
repeat
player:update()
if getZoneId() ~= 355 then
local empties = inventory:itemTotalCount(0)
if 5 > empties then
-- Wait for user to make some space in inventory.
cprintf(cli.yellow,"Not much space left in inventory. Are you sure you want to continue with only %d spaces left?\n",empties)
player:sleep()
end
if 30 > inventory:itemTotalCount(203038) then
print("Not enough Phirius Token Coins.")
logentry = "Not enough Phirius Token Coins."
-- checkRelog()
return
end
if player:target_NPC(kate) then
sendMacro("ChoiceOption(1);");
yrest(1000);
waitForLoadingScreen(10)
if getZoneId() ~= 360 then
print("Failed to teleport into Ancient Treasure. Maybe you already done it today.")
logentry = "Failed to teleport into Ancient Treasure. Maybe you already done it today."
end
-- checkRelog()
end
if player:target_NPC(magelly) then
yrest(2000);
sendMacro("ChoiceOption(2);"); --Make it 1 if you want Timed arena
yrest(2000);
sendMacro("ChoiceOption(1);");
yrest(2000);
sendMacro("ChoiceOption(1);");
yrest(12000);
-- checkRelog()
-- return
end
end
repeat
yrest(100)
until player:findNearestNameOrId(106881)
print("OK event has started")
repeat
tort()
player:update()
buffed = player:getBuff(622402)
yrest(100)
until buffed.Level >= 2800 or not player:hasBuff(622402)
print("Event finished, end score was "..buffed.Level)
error("Ending script")
until false
</onLoad>
</waypoints>
Re: Andor Trainig Range
Posted: Sat Nov 10, 2012 7:04 am
by lisa
looks like it should work,
I would suguest having the tort() function in that WP as opposed to a userfunction =)
At this stage don't be to worried about log next char, it will probably error once the evnt has ended anyway because of this bit
Code: Select all
until buffed.Level >= 2800 or not player:hasBuff(622402)
Basically if it doesn't get to the 2800 score then it will error from the hasBuff as that isn't the ideal implementation but it was what I came up with in the few minutes I had to write the code for it.
Re: Andor Trainig Range
Posted: Sun Nov 11, 2012 2:37 am
by xrozhija
I don't quite get it, when i use the userfunction, it just stands there, not clicking any of the tortoises, it does write in the mm window with the list of all the mobs that are present, but doesnt click any of them to kill them.
Re: Andor Trainig Range
Posted: Sun Nov 11, 2012 8:39 am
by grande
Thx again Lisa. This post contains a common but random error that occurs and how I'm using your code.
The error is a random crash usually midway through the event. Just seems like the same crap from siege war... who knows. Here's the output:
Code: Select all
resting a little before attacking, countdown starts now.
12
11
...
2
1
targeting: 106882
targeting: 106881
Did not find any crashed game clients.
8:28am - X:/micromacro/scripts/rom/functions.lua:674: bad argument #1 to 'memory
ReadByte' ((null))
I do the userfunction method since that's sort of how Lisa's code evolved. Then, I call it from the waypoint with part of something from the function... errr yeah:
Userfunction:
Code: Select all
function tort()
local proc = getProc()
local function checkclicked(address)
local tmp = memoryReadRepeat("int", proc, address + addresses.pawnAttackable_offset) or 0;
if bitAnd(tmp,0x8) then
return true
else
return false
end
end
local function one(ID)
print("targeting: "..ID)
local objectList = CObjectList();
objectList:update();
local objSize = objectList:size()
for i = 0,objSize do
obj = objectList:getObject(i)
if (obj.Id == ID or ID == 106885) and checkclicked(obj.Address) then
player:target(obj)
RoMScript("UseExtraAction(1)")
yrest(10)
player:target(obj)
RoMScript("UseExtraAction(1)")
if ID == 106883 then
yrest(10)
player:target(obj)
RoMScript("UseExtraAction(1)")
end
yrest(100)
end
end
end
if player:findNearestNameOrId(106881) then
local countt = 12
print("resting a little before attacking, countdown starts now.")
repeat
print(countt)
yrest(1000)
countt = countt -1
until countt == 0
for i = 1,6 do
one(106882)
one(106882)
one(106881)
one(106883)
one(106884)
end
end
end
And the waypoint:
Code: Select all
<?xml version="1.0" encoding="utf-8"?><waypoints>
<onload>
--== User Option ==--
startGMDetect()
</onload>
<!-- # 1 --><waypoint x="4935" z="-1936" y="109">
player:target_NPC("Kate Wesker");
yrest(1000);
sendMacro("ChoiceOption(1);");
waitForLoadingScreen();
player:target_NPC("Magelly Basac");
yrest(1000);
sendMacro("ChoiceOption(1);");
yrest(1000);
sendMacro("ChoiceOption(1);");
yrest(1000);
sendMacro("ChoiceOption(1);");
yrest(14000);
</waypoint>
<!-- # 2 --><waypoint x="53" z="411" y="963">
repeat
tort()
player:update()
buffed = player:getBuff(622402)
yrest(100)
until buffed.Level >= 2000 or not player:hasBuff(622402)
print("Event finished, end score was "..buffed.Level)
</waypoint>
<!-- # 6 --><waypoint x="-48" z="337" y="961">
player:target_NPC("Magelly Basac");
sendMacro("ChoiceOption(1);");
sendMacro("ClickRequestDialogButton(0)");
waitForLoadingScreen();
</waypoint>
<!-- # 1 --><waypoint x="4935" z="-1936" y="109">
loadPaths("survivalR5");
</waypoint>
</waypoints>
Re: Andor Trainig Range
Posted: Sun Nov 11, 2012 9:32 am
by lisa
give this a try.
Basically all I did was in the romscript function, which is done quite a bit, I added
at the start of the function and then used the proc instead of getProc()
What this does is reduce the number of times the getProc() function is called, from 4 down to 1.
It might help.
Re: Andor Trainig Range
Posted: Sun Nov 11, 2012 10:20 am
by dejfit
Lisa, do you know why sometimes bot stops after clearing first wave with this error:
Code: Select all
...\rom/bot.lua:505: onLoad error: [string "..."]:86: attempt to index global 'buffed' (a boolean value)
?
Re: Andor Trainig Range
Posted: Sun Nov 11, 2012 10:28 am
by lisa
lisa wrote:it will error from the hasBuff as that isn't the ideal implementation but it was what I came up with in the few minutes I had to write the code for it.
it should actually be getBuff and not hasBuff
Re: Andor Trainig Range
Posted: Sun Nov 11, 2012 10:34 am
by dejfit
My code looks lik this:
Code: Select all
repeat
tort()
player:update()
buffed = player:getBuff(622402)
yrest(100)
until not RoMScript("TimeKeeperFrame:IsVisible()") or buffed.Level >= 3400
and sometimes i get this error. How to make it better?
Re: Andor Trainig Range
Posted: Sun Nov 11, 2012 10:53 am
by lisa
try
Code: Select all
repeat
tort()
player:update()
buffed = player:getBuff(622402)
yrest(100)
until (not RoMScript("TimeKeeperFrame:IsVisible()")) or (buffed and buffed.Level >= 3400)
if rombot can't find the buff it returns it as false, so buffed would be false
Re: Andor Trainig Range
Posted: Sun Nov 11, 2012 5:07 pm
by wulf
lisa wrote:This is what I was using
I have 50% of crashes with this script:
Code: Select all
Command> tort()
resting a little before attacking, countdown starts now.
12
11
10
9
8
7
6
5
4
3
2
1
targeting: 106882
targeting: 106882
targeting: 106881
onLoad error: ...tten 4.0.9.2504/micromacro/scripts/rom/functions.lua:674: bad argument #1 to 'memoryReadByte' ((null))
EDIT: ignore this, I see it has been reported previously.
EDIT2: now (with the new function.lua) I have:
Code: Select all
Command> tort()
resting a little before attacking, countdown starts now.
12
11
10
9
8
7
6
5
4
3
2
1
targeting: 106882
targeting: 106882
targeting: 106881
onLoad error: ... botten 4.0.9.2504/micromacro/scripts/rom/macros.lua:162: bad argument #1 to 'memoryReadUInt' ((null))
Re: Andor Trainig Range
Posted: Sun Nov 11, 2012 8:01 pm
by lisa
wulf wrote:EDIT2: now (with the new function.lua) I have:
Is the game crashing before the print or is MM just doing the error without the game crashing.
Re: Andor Trainig Range
Posted: Mon Nov 12, 2012 3:42 am
by wilifox
Code: Select all
...\rom/bot.lua:505: onLoad error: [string "..."]:86: attempt to index global 'buffed' (a boolean value)?
Why this error?? Thx you!!
Re: Andor Trainig Range
Posted: Mon Nov 12, 2012 3:47 am
by lisa
wilifox wrote:Code: Select all
...\rom/bot.lua:505: onLoad error: [string "..."]:86: attempt to index global 'buffed' (a boolean value)?
Why this error?? Thx you!!
Hmm you can either click this link
http://www.solarstrike.net/phpBB3/viewt ... 916#p43916
OR just read a few posts before this 1........
Re: Andor Trainig Range
Posted: Mon Nov 12, 2012 6:34 am
by wulf
lisa wrote:Is the game crashing before the print
yes
Re: Andor Trainig Range
Posted: Mon Nov 12, 2012 8:16 am
by lisa
wulf wrote:lisa wrote:Is the game crashing before the print
yes
try doubling the values in the yrest()
Maybe you just need more time between targeting the next "mob"
Re: Andor Trainig Range
Posted: Mon Nov 12, 2012 12:46 pm
by wilifox
where put in the code the checkRelog() function??? not found in my code ;((
thx you
Code: Select all
<?xml version="1.0" encoding="utf-8"?><waypoints type="TRAVEL">
<onLoad>
function checkRelog()
SetCharList({
{account=1 , chars= {2,3,4,5,7,8}},
{account=2 , chars= {1,2,3,4,5,6,7,8}},
{account=6 , chars= {1,2,3,4,5,6,7,8}},
{account=7 , chars= {1,2,3,4,5,6,7,8}},
})
LoginNextChar()
loadProfile()
loadPaths("Eventos/tortugas.xml");
end
--=== User Options ===--
local kate = GetIdName(121035) --Kate Wesker
local magelly = GetIdName(120687) --Magelly Basac
function tort()
local proc = getProc()
local function checkclicked(address)
local tmp = memoryReadRepeat("int", proc, address + addresses.pawnAttackable_offset) or 0;
if bitAnd(tmp,0x8) then
return true
else
return false
end
end
local function one(ID)
print("targeting: "..ID)
local objectList = CObjectList();
objectList:update();
local objSize = objectList:size()
for i = 0,objSize do
obj = objectList:getObject(i)
if (obj.Id == ID or ID == 106885) and checkclicked(obj.Address) then
player:target(obj)
RoMScript("UseExtraAction(1)")
yrest(10)
player:target(obj)
RoMScript("UseExtraAction(1)")
if ID == 106883 then
yrest(10)
player:target(obj)
RoMScript("UseExtraAction(1)")
end
yrest(100)
end
end
end
if player:findNearestNameOrId(106881) then
local countt = 12
print("resting a little before attacking, countdown starts now.")
repeat
print(countt)
yrest(1000)
countt = countt -1
until countt == 0
for i = 1,6 do
one(106882)
one(106882)
one(106881)
one(106883)
one(106884)
end
end
end
--== MINIGAME ==--
repeat
player:update()
if getZoneId() ~= 355 then
local empties = inventory:itemTotalCount(0)
if 5 > empties then
-- Wait for user to make some space in inventory.
cprintf(cli.yellow,"Not much space left in inventory. Are you sure you want to continue with only %d spaces left?\n",empties)
player:sleep()
end
if 30 > inventory:itemTotalCount(203038) then
print("Not enough Phirius Token Coins.")
logentry = "Not enough Phirius Token Coins."
end
if player:target_NPC(kate) then
sendMacro("ChoiceOption(1);");
yrest(1000);
waitForLoadingScreen(10)
if getZoneId() ~= 360 then
print("Failed to teleport into Ancient Treasure. Maybe you already done it today.")
logentry = "Failed to teleport into Ancient Treasure. Maybe you already done it today."
end
end
if player:target_NPC(magelly) then
yrest(2000);
sendMacro("ChoiceOption(2);"); --Make it 1 if you want Timed arena
yrest(2000);
sendMacro("ChoiceOption(1);");
yrest(2000);
sendMacro("ChoiceOption(1);");
yrest(12000);
end
end
repeat
yrest(100)
until player:findNearestNameOrId(106881)
print("OK event has started")
repeat
tort()
player:update()
buffed = player:getBuff(622402)
yrest(100)
until buffed.Level >= 2800 or not player:hasBuff(622402)
until false
-- player:target_NPC(magelly)
-- sendMacro("ChoiceOption(1);");
-- yrest(2000);
-- RoMScript("StaticPopup_OnClick(StaticPopup1, 1);");
checkRelog()
</onLoad>
</waypoints>
Re: Andor Trainig Range
Posted: Mon Nov 12, 2012 6:06 pm
by Cindy
Game crashing every time now, at "targeting: 106881", MM window stops without any apparent sign (other than things arent moving in it)
Re: Andor Trainig Range
Posted: Mon Nov 12, 2012 6:49 pm
by dr-nuker
Cindy wrote:Game crashing every time now, at "targeting: 106881", MM window stops without any apparent sign (other than things arent moving in it)
Somehow i have tha same now. When it comes to shootin the mewts the game crashes without report (mostly).
So sad that this was working very nice and now fails :/
Re: Andor Trainig Range
Posted: Mon Nov 12, 2012 6:57 pm
by Cindy
Update: the crashed window has a red message "Already casting" I wonder if that is related?
Re: Andor Trainig Range
Posted: Mon Nov 12, 2012 8:32 pm
by Cindy
yrest(250) didnt work... and im out of test characters