Page 2 of 3
Re: Flower festival - Bot throwing a rose at cavies minigame
Posted: Mon Feb 24, 2014 8:18 am
by noobbotter
I had also made my own modified version of this but cannot get it to run without crashing the game client. Plenty of rests within every function and every loop and yet still can't get through one round without crashing.
So for now I just made a simple macro of /script UseExtraAction(1) and put it on a keystroke and I use some of the cast time reduction pots. With manually targeting and using the macro to kill the cavies, I can get 50 points almost every round. (some rounds cheat me because it seems like they put out fewer brown cavies and kokomos. But I would like to get the script working properly.
Re: Flower festival - Bot throwing a rose at cavies minigame
Posted: Mon Feb 24, 2014 8:43 am
by lisa
I had a look at the WP posted on first post and it seems similar to the andor training, as in you need to target some stuff and use extra action bar to attack it.
Well the Wp posted here is under 30 lines of code, andor training is almost 150, hopefully you can see where I am going here, for it to work it needs more work done on it.
Someone could use the andor training WP as a guide/template for making this 1 work =)
Re: Flower festival - Bot throwing a rose at cavies minigame
Posted: Mon Feb 24, 2014 9:25 am
by noobbotter
Here's the version I made. Thought I was gonna be smart with creating a menu at the beginning of the script that asks how many I want to run, and also will use items for improving cast speed. Most everything seems to work fine, and it will even begin targetting and attacking cavies but then the client always crashes for me before the end of the first round... probably within the first 20 - 30 seconds.
Code: Select all
<?xml version="1.0" encoding="utf-8"?><waypoints>
<onLoad>
--Kokomo 120386 gives most points... top priority
--Brown Cavy 120385 gives 2 points... 2nd priority
--Baabaa Sheep 120384 gives only 1 point... low priority
function doMenu()
print("How Many runs would you like to do?")
print(" ")
print(" Enter a number and hit ENTER. >")
printf("\n")
userinput = io.stdin:read()
numruns = tonumber(userinput)
end
function buffCastSpeed()
tempItems = {}
Guitars = {
204461, -- Magic Guitar (3 Days)
204543, -- Magic Guitar (3 Days)
204569, -- Magic Guitar (7 Days)
206418 -- Magic Guitar (30 Days)
}
Pots = {
200192, -- Ancient Spirit Water
207202 -- Clear Thought
}
for k,v in pairs(Guitars) do
if inventory:itemTotalCount(v) > 0 then
table.insert(tempItems,v)
break
end
end
for k,v in pairs(Pots) do
if inventory:itemTotalCount(v) > 0 then
table.insert(tempItems,v)
break
end
end
for k,v in pairs(tempItems) do
if v == 207202 then
if (useGoodie) then
useGoodie("casting")
else
inventory:useItem(v)
end
else
inventory:useItem(v)
end
yrest(500)
end
if player.Class1 == CLASS_SCOUT and player.Class2 == CLASS_PRIEST then
player:cast("SCOUT_SPIRITUAL_LEADER")
yrest(500)
elseif player.Class1 == CLASS_MAGE then
player:cast("MAGE_ELEMENTAL_CATALYSIS")
yrest(500)
if player.Class2 == CLASS_ROGUE then
player:cast("ROGUE_SHADOW_PROTECTION")
yrest(500)
end
end
end
function acceptGame()
player:moveTo(CWaypoint(3080,161))
if inventory:itemTotalCount(202903) == 0 then
error("You don't have any transport runes.")
end
player:target_NPC(120380);
yrest(500);
sendMacro("ChoiceOption(2);");
yrest(500);
sendMacro("ChoiceOption(1);");
yrest(500);
player:moveTo(CWaypoint(3044,117))
buffCastSpeed() <!-- use items to increase casting speed -->
repeat
player:target_Object(120391) -- clicks the bench to start game
yrest(200)
until RoMScript("ExtraActionBarFrame:IsVisible()")
end
function killCavies()
creatures={120386,120385,120384}
while RoMScript("ExtraActionBarFrame:IsVisible()") do
mytarget=nil
for k,id in pairs(creatures) do
if ignoreOldObj==nil then
mytarget=player:findNearestNameOrId(id)
else
mytarget=player:findNearestNameOrId(id,ignoreOldObj)
end
yrest(50)
if mytarget~=nil then <!--Attack and wait for casting to finish -->
player:target(mytarget)
yrest(50)
RoMScript("UseExtraAction(1)")
ignoreOldObj=mytarget.Address
yrest(200)
repeat
player:update()
yrest(50)
until player.Casting==false
break
end
yrest(50)
end
yrest(50)
end
end
function turnIn()
player:moveTo(CWaypoint(3080,161))
player:target_NPC(120380);
yrest(500);
sendMacro("ChoiceOption(2);");
end
function mainRoutine()
--transport rune: 202903
acceptGame() <!-- Click bench to start game -->
killCavies() <!-- begin targeting and attacking cavies -->
turnIn()
end
<!-- Initial Variables -->
numruns = nil
mytarget = nil
ignoreOldObj = nil
currentrun = 1
for k,v in pairs(settings.profile.skills) do
v.AutoUse = false
yrest(50)
end
<!-- Begin bot actions -->
doMenu()
for currentrun = 1,numruns do
mainRoutine()
yrest(50)
end
</onLoad>
<!-- # 1 --><waypoint x="3080" z="161">
printf("Finished %s runs.\n",currentrun)
error("Done")
</waypoint>
</waypoints>
For now, though, I'll go through and look at the Andor Training script and see if I can find something I'm doing way wrong or another way I can try this.
Re: Flower festival - Bot throwing a rose at cavies minigame
Posted: Mon Feb 24, 2014 12:02 pm
by gloover
thx noob - thas the way I also ahve tried, combine andor script with rocks Elementconverter. @ this moment without any success.
One thing as an improvement
is not the priority targeting method - it will only target the nearest creature, so if the sheep is in the front row and kokomo in the last row, the bot will allways select the sheep.
So it may be better to use it similar to this one
Code: Select all
ignoreOldObj=nil
while true do
yrest(100)
mytarget=nil
if ignoreOldObj==nil then
mytarget = player:findNearestNameOrId(120386) or player:findNearestNameOrId(120385) or player:findNearestNameOrId(120384)
else
mytarget=player:findNearestNameOrId(120386,ignoreOldObj) or player:findNearestNameOrId(120385,ignoreOldObj) or player:findNearestNameOrId(120384,ignoreOldObj)
end
if mytarget~=nil then
player:target(mytarget)
yrest(100)
RoMScript("UseExtraAction(1)");
repeat
yrest(100)
player:update();
until player.Casting==false
ignoreOldObj=mytarget.Address;
yrest(100);
end
end
Re: Flower festival - Bot throwing a rose at cavies minigame
Posted: Mon Feb 24, 2014 12:24 pm
by noobbotter
Actually, I'm pretty sure the way I wrote mine was to target by priority. With is:
it will start by looking for a kokomo. if it doesn't find one, it will then look for a cavy, and then sheep last.
But yeah, with it causing a client crash it's kinda pointless.
Re: Flower festival - Bot throwing a rose at cavies minigame
Posted: Mon Feb 24, 2014 6:30 pm
by lisa
The client crashing is, pure guess, because there is no check if that object has already been clicked. In the andor training you will find a check for it clicked or not.
As for the priority
doesn't actually always start with the first and go through to the last in order, so it may be doing them out of the order you want, it may also be doing them in the order you want.
however
forces it to do them in order from first to last. I don't remember exactly why they have a pairs and ipairs for table usage but either way that is the story.
Hope this helps =)
Re: Flower festival - Bot throwing a rose at cavies minigame
Posted: Tue Feb 25, 2014 2:46 am
by rock5
As far as I know if you create a fresh table like so
They will always be in order and 'pairs' will give them in order. The same is not true if you actually specify index numbers, eg.
Code: Select all
creatures={[1]=120386,[2]=120385,[3]=120384}
You also can't rely on them being in order if you add items to the table.
The difference between pairs and ipairs is ipairs will give you the items in a table by index order. So if they are out of order ipairs will display them in order. ipairs requires the table to start with index number of 1 and will stop at the last continuous number. pairs give you all the values in a table regardless of whether they use ordered index numbers or key strings.
You should use ipairs when you expect the items in the table to use continuous index numbers and the order is important and you should use pairs when the table doesn't use ordered index numbers or the order doesn't matter.
Re: Flower festival - Bot throwing a rose at cavies minigame
Posted: Tue Feb 25, 2014 8:04 am
by noobbotter
Doesn't this part check to ensure the item hasn't already been clicked?
Code: Select all
if ignoreOldObj==nil then
mytarget=player:findNearestNameOrId(id)
else
mytarget=player:findNearestNameOrId(id,ignoreOldObj)
end
Maybe it works fine until it has three brown cavies. It targets one, sets the ignoreOldObj, targets the next, sets it as ignoreOldObj, then tries to target the first? I wonder if I should use a temporary table to store the old objects in so they never get targeted again?
I haven't yet looked at the Andor Training to see what it uses to verify the item hasn't been clicked but I'll do that now.
Re: Flower festival - Bot throwing a rose at cavies minigame
Posted: Tue Feb 25, 2014 6:52 pm
by lisa
yes you should check andy script, just adding 1 object to an ignore list won't help and it may be causing the issue as you are trying to target an object which is in the process of dissappearing.
look for
local function checkclicked(address)
I did this up as a quick test.
Code: Select all
<?xml version="1.0" encoding="utf-8"?><waypoints type="TRAVEL">
<onLoad>
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)
local objectList = CObjectList();
objectList:update();
local objSize = objectList:size()
for i = 0,objSize do
obj = objectList:getObject(i)
obj:update()
if obj.Id == ID and checkclicked(obj.Address) then
player:target(obj)
print("targeting: "..obj.Name)
RoMScript("UseExtraAction(1)")
yrest(1000)
repeat
player:updateCasting()
yrest(100)
until player.Casting==false
yrest(100)
break
end
end
end
while true do
one(120386)
one(120385)
one(120384)
yrest(1)
end
</onLoad>
</waypoints>
It worked fine for 3 runs and then crashed on the 4th run, issue might be the object dissappears during casting, which would also crash manually?
No casting boosts and using a melee char, scored 24-26 each time.
Code: Select all
targeting: Baabaa Sheep
targeting: Kokomo
targeting: Wood Cavy
targeting: Baabaa Sheep
targeting: Kokomo
targeting: Wood Cavy
targeting: Baabaa Sheep
targeting: Wood Cavy
targeting: Baabaa Sheep
targeting: Wood Cavy
targeting: Baabaa Sheep
targeting: Wood Cavy
targeting: Baabaa Sheep
targeting: Wood Cavy
targeting: Baabaa Sheep
targeting: Wood Cavy
targeting: Baabaa Sheep
targeting: Wood Cavy
Hope it helps.
this event is very familiar to me, pretty sure I did a working WP a looooong time ago.
Re: Flower festival - Bot throwing a rose at cavies minigame
Posted: Tue Feb 25, 2014 9:41 pm
by lisa
After some testing the checkclicked doesn't work in this case =(
Re: Flower festival - Bot throwing a rose at cavies minigame
Posted: Wed Feb 26, 2014 1:19 am
by lisa
Well I have come up with this, run it around 20 times with no crash and melee char with no fast casting scores 30-38, depending how lucky you get with komodo and misses.
Code: Select all
We successfully target NPC Waysie Stainbrick and try to open the dialog window.
Use MACRO: Executing RoMScript "ChoiceOption(2);".
Use MACRO: Executing RoMScript "ChoiceOption(1);".
2
4
5
Missed, trying again
7
9
11
13
15
17
19
20
Missed, trying again
22
23
27
29
Missed, trying again
31
33
35
37
Missed, trying again
39
We try to find NPC 120380:
We successfully target NPC Waysie Stainbrick and try to open the dialog window.
Use MACRO: Executing RoMScript "ChoiceOption(2);".
Missed, trying again
2
Missed, trying again
4
6
Missed, trying again
8
Missed, trying again
9
11
Missed, trying again
13
15
17
19
Missed, trying again
20
24
26
Missed, trying again
27
29
30
This file will use up all your transport runes though.
Start it at the NPC and it moves and uses the closest bench, if someone else wants to they can add in user options and such to choose which bench to use and what ever else they can think of.
- rose1.xml
- V 1.0 throw rose event
- (2.71 KiB) Downloaded 323 times
Re: Flower festival - Bot throwing a rose at cavies minigame
Posted: Wed Feb 26, 2014 9:22 am
by Ego95
"Error, no waypoints in the file"
How do I solve this. Had the same problem in a weapon leveling script
Re: Flower festival - Bot throwing a rose at cavies minigame
Posted: Wed Feb 26, 2014 9:29 am
by noobbotter
I'll have to give that a try.
What we need now is to create something that will auto turn in certificates, and auto merge all the elements into the required items. A menu system for this would be nice. Where you select which type/level of pet you want, or specify what level of element you want (Sand, stone, star, etc...) and have it do all that work for you. The merging of items takes longer than the actual game.
Re: Flower festival - Bot throwing a rose at cavies minigame
Posted: Wed Feb 26, 2014 9:51 am
by rock5
Ego95 wrote:"Error, no waypoints in the file"
How do I solve this. Had the same problem in a weapon leveling script
That just means that the code in the onload has finished running and there are no waypoints in the file to go to. In this case finishing means you ran out of Transport Runes.
Hm... I see a bug. It wont even do it once if you don't have any Transport Runes.
Re: Flower festival - Bot throwing a rose at cavies minigame
Posted: Wed Feb 26, 2014 1:04 pm
by spyfromsiochain
noobbotter wrote:I'll have to give that a try.
What we need now is to create something that will auto turn in certificates, and auto merge all the elements into the required items. A menu system for this would be nice. Where you select which type/level of pet you want, or specify what level of element you want (Sand, stone, star, etc...) and have it do all that work for you. The merging of items takes longer than the actual game.
Noobbotter there is one waypoint to transform the elements already, "element_fuser.xml" done by rock5.
I tried the waypoint also, doesn't crash anymore, but stops sometimes for like 5 sec or so... if it was continuous it would reach the desire 51 hits, without any help of curse runes, or pots or anything to increase cast.
Edit: element_fuser.xml
http://solarstrike.net/phpBB3/viewtopic ... ment_fuser
Re: Flower festival - Bot throwing a rose at cavies minigame
Posted: Wed Feb 26, 2014 2:37 pm
by noobbotter
Oh, thanks for the info Spy. I'll have to try that out as well.
Re: Flower festival - Bot throwing a rose at cavies minigame
Posted: Wed Feb 26, 2014 2:44 pm
by Ego95
That just means that the code in the onload has finished running and there are no waypoints in the file to go to. In this case finishing means you ran out of Transport Runes.
Omg
Yes. I was sure I had transport runes, but I did not have any :O
Lol, things I could answer myself.
Thanks rock
But yes. The script is very slow. I do is as priest/knight with the lvl 25 elite skill now. With that buff your next cast will only cast one second, but you don't lose it in that minigame. Manually with just spamming a simple ingame macro I get up to 88 points. But I always stop after reaching 50 points. This is enough to get 5 certificates.
Re: Flower festival - Bot throwing a rose at cavies minigame
Posted: Wed Feb 26, 2014 7:14 pm
by lisa
Ego95 wrote:But yes. The script is very slow. I do is as priest/knight with the lvl 25 elite skill now. With that buff your next cast will only cast one second, but you don't lose it in that minigame.
Yeah the WP is designed around having to do the long cast and so the yrest are longish, you could change them to be shorter but with the amount of checks in the WP to try and make it not crash it won't ever score really really high.
2 places have
Code: Select all
RoMScript("UseExtraAction(1)")
yrest(1000)
So yeah it has a 1 second rest after using the skill, you could reduce that to 500 and it will probably speed things up for you.
Re: Flower festival - Bot throwing a rose at cavies minigame
Posted: Thu Feb 27, 2014 12:01 pm
by spyfromsiochain
lisa wrote:Ego95 wrote:But yes. The script is very slow. I do is as priest/knight with the lvl 25 elite skill now. With that buff your next cast will only cast one second, but you don't lose it in that minigame.
Yeah the WP is designed around having to do the long cast and so the yrest are longish, you could change them to be shorter but with the amount of checks in the WP to try and make it not crash it won't ever score really really high.
2 places have
Code: Select all
RoMScript("UseExtraAction(1)")
yrest(1000)
So yeah it has a 1 second rest after using the skill, you could reduce that to 500 and it will probably speed things up for you.
I lower the rest to 500, I don't think that's the problem, has I said up it stops literally, runs like this:
8 hits
waits for the next stage
repeat
if it was doing the hits always in the same rate, it would perfectly get to 51 points no problem without any cast buffs (1sec cast), best I get like this without buffs is 33, maybe if I buff up to like 0.5 sec cast I might get to 51 points... not sure
regards
Re: Flower festival - Bot throwing a rose at cavies minigame
Posted: Thu Feb 27, 2014 12:13 pm
by noobbotter
Yeah, I ran it yesterday and I saw where it will run decent for a few and then it just stops for several seconds. Then eventually it starts going again. There's gotta be something specific causing it to pause like that. I'm thinking that it probably has something to do with the points in the game where anything left on the bench disappears and the bench repopulates.