Page 1 of 2

harvest & co

Posted: Sun Jan 26, 2014 9:46 am
by Miworax
iam serching for the function that wait at a harvest wp until he can use it... i want these for a daily and cant find that :(
can someone help ?

PS. sorry for my bad english

Re: harvest & co

Posted: Sun Jan 26, 2014 10:55 am
by Danni
Can you be more specific?

Do you want to harvest mats, like wood. Or you want to harvest an item?

What's the daily name? So I might help out better.

Re: harvest & co

Posted: Sun Jan 26, 2014 10:58 am
by Miworax
its an daily, where i must do 10 fires on... but not all the fires are "useable" in these time.... can i say that rombot wait at each fire until he can use it ?

i hope its better now ....

Re: harvest & co

Posted: Sun Jan 26, 2014 11:06 am
by Danni
not really "more specific" (look to your pm)

but you could try to work with a loop.

Re: harvest & co

Posted: Sun Jan 26, 2014 11:07 am
by Miworax
How did that work ?

Re: harvest & co

Posted: Sun Jan 26, 2014 12:37 pm
by Bill D Cat
Perhaps you are looking to do something like this. It scans for the item to use, and if it is found AND within a distance of 50 (melee) then it uses it. Otherwise it waits 5 seconds and scans again.

Code: Select all

local itemhere = false
repeat
  item = player:findNearestNameOrId(xxxxxx) -- Whatever the Name or Id is for the item you want to use
  if item and 50 > distance(item,player) then
     player:target_Object(item.Id)
     itemhere = true
  else
     yrest(5000)
  end
until itemhere == true

Re: harvest & co

Posted: Sun Jan 26, 2014 1:20 pm
by Miworax
mh, that must i copy in each harvest wp in these lua ?

Re: harvest & co

Posted: Sun Jan 26, 2014 3:24 pm
by Bill D Cat
You could just make it a function in the <onload> section and just have a command to call that function in the appropriate waypoints.

Re: harvest & co

Posted: Sun Jan 26, 2014 3:44 pm
by Miworax
never done this before , i can try but maybe i need a bit help :D

Re: harvest & co

Posted: Mon Jan 27, 2014 1:02 am
by Bill D Cat
You can use this as a function and place it before the first waypoint.

Code: Select all

<onload>
function findMyItem()
  local itemhere = false
  repeat
    item = player:findNearestNameOrId(xxxxxx) -- Whatever the Name or Id is for the item you want to use
    if item and 50 > distance(item,player) then
      player:target_Object(item.Id)
      itemhere = true
    else
      yrest(5000)
    end
  until itemhere == true
end
</onload>
And then in each waypoint that needs it, just put "findMyItem()"

Re: harvest & co

Posted: Mon Jan 27, 2014 8:04 am
by Miworax
it dont work or i have a mistake in the script :(

Re: harvest & co

Posted: Mon Jan 27, 2014 8:25 am
by Miworax
function findMyItem()
local itemhere = false
repeat
item = player:findNearestNameOrId(120431) -- Whatever the Name or Id is for the item you want to use
if item and 50 > distance(item,player) then
player:target_Object(120431)
itemhere = true

function checkDQCount()
local dailyQuestCount, dailyQuestsPerDay= RoMScript("Daily_count()")
cprintf(cli.lightblue,"%s quests completed.\n",tostring(dailyQuestCount));
if (dailyQuestCount == 10) then
cprintf(cli.lightblue,"Completed max number of daily quests, trying to log in next chara.\n");
SetCharList({
{account=20 , chars= {}},
{account=21 , chars= {}},
{account=22 , chars= {}},
{account=23 , chars= {}},
{account=24 , chars= {}},
{account=25 , chars= {}},
{account=26 , chars= {}},
{account=27 , chars= {}},
{account=28 , chars= {}},
{account=29 , chars= {}},
{account=30 , chars= {}},
})
LoginNextChar()
end
end

function relog()
SetCharList({
{account=20 , chars= {}},
{account=21 , chars= {}},
{account=22 , chars= {}},
{account=23 , chars= {}},
{account=24 , chars= {}},
{account=25 , chars= {}},
{account=26 , chars= {}},
{account=27 , chars= {}},
{account=28 , chars= {}},
{account=29 , chars= {}},
{account=30 , chars= {}},
})

if IsLastChar() then
player:logout();
else
LoginNextChar()
end

SetRestartClientSettings(7, "rom4u")

end
</onLoad>
<!-- # 1 --><waypoint x="4488" z="2165" y="1418">sendMacro("ChangeParallelID(1)");
player:target_NPC("xxxx");
player:target_NPC("xxxx");
CompleteQuestByName("xxxx");
checkDQCount()
AcceptQuestByName("xxxx");
</waypoint>
<!-- # 2 --><waypoint x="4491" z="2167" y="1419">
findMyItem()</waypoint>
<!-- # 3 --><waypoint x="4557" z="2198" y="1421"> </waypoint>
<!-- # 4 --><waypoint x="4557" z="2198" y="1421">
findMyItem()</waypoint>
<!-- # 5 --><waypoint x="4561" z="2080" y="1418"> </waypoint>
<!-- # 6 --><waypoint x="4561" z="2080" y="1418">
findMyItem()</waypoint>
<!-- # 7 --><waypoint x="4477" z="2049" y="1418"> </waypoint>
<!-- # 8 --><waypoint x="4477" z="2049" y="1418">
findMyItem()</waypoint>
<!-- # 9 --><waypoint x="4478" z="2089" y="1418"> </waypoint>
<!-- # 10 --><waypoint x="4478" z="2089" y="1418">
findMyItem()</waypoint>
<!-- # 11 --><waypoint x="4496" z="2179" y="1420"> </waypoint>
<!-- # 12 --><waypoint x="4496" z="2179" y="1420">
findMyItem()</waypoint>
<!-- # 13 --><waypoint x="4560" z="2199" y="1421"> </waypoint>
<!-- # 14 --><waypoint x="4560" z="2199" y="1421">
findMyItem()</waypoint>
<!-- # 15 --><waypoint x="4557" z="2076" y="1418"> </waypoint>
<!-- # 16 --><waypoint x="4557" z="2076" y="1418">
findMyItem()</waypoint>
<!-- # 17 --><waypoint x="4476" z="2044" y="1418"> </waypoint>
<!-- # 18 --><waypoint x="4476" z="2044" y="1418">
findMyItem()</waypoint>
<!-- # 19 --><waypoint x="4478" z="2090" y="1418"> </waypoint>
<!-- # 20 --><waypoint x="4478" z="2090" y="1418">
findMyItem()</waypoint>
<!-- # 21 --><waypoint x="4499" z="2164" y="1418"> </waypoint>
checkDQCount()
</waypoints>



maybe, someone can help, rombot says: line 98... mismatched tag

Re: harvest & co

Posted: Mon Jan 27, 2014 10:19 am
by Danni
:geek: Is that your whole WP?

I am can't see any tags right now. So I am not sure where the problems lies.

But you Code has only 94 lines :?

So either something is missing or you misread the error ;) There is no line 98 :)

Re: harvest & co

Posted: Mon Jan 27, 2014 10:21 am
by Miworax
iam an idiot ...

wait ....

Re: harvest & co

Posted: Mon Jan 27, 2014 10:23 am
by Miworax
<?xml version="1.0" encoding="utf-8"?><waypoints>
<onLoad>
cprintf(cli.lightgreen,"\n xxx von xxxx\n")

function findMyItem()
local itemhere = false
repeat
item = player:findNearestNameOrId(120431) -- Whatever the Name or Id is for the item you want to use
if item and 50 > distance(item,player) then
player:target_Object(120431)
itemhere = true

function checkDQCount()
local dailyQuestCount, dailyQuestsPerDay= RoMScript("Daily_count()")
cprintf(cli.lightblue,"%s quests completed.\n",tostring(dailyQuestCount));
if (dailyQuestCount == 10) then
cprintf(cli.lightblue,"Completed max number of daily quests, trying to log in next chara.\n");
SetCharList({
{account=20 , chars= {}},
{account=21 , chars= {}},
{account=22 , chars= {}},
{account=23 , chars= {}},
{account=24 , chars= {}},
{account=25 , chars= {}},
{account=26 , chars= {}},
{account=27 , chars= {}},
{account=28 , chars= {}},
{account=29 , chars= {}},
{account=30 , chars= {}},
})
LoginNextChar()
end
end

function relog()
SetCharList({
{account=20 , chars= {}},
{account=21 , chars= {}},
{account=22 , chars= {}},
{account=23 , chars= {}},
{account=24 , chars= {}},
{account=25 , chars= {}},
{account=26 , chars= {}},
{account=27 , chars= {}},
{account=28 , chars= {}},
{account=29 , chars= {}},
{account=30 , chars= {}},
})

if IsLastChar() then
player:logout();
else
LoginNextChar()
end

SetRestartClientSettings(7, "rom4u")

end

</onLoad>
<!-- # 1 --><waypoint x="4488" z="2165" y="1418">sendMacro("ChangeParallelID(1)");
player:target_NPC("xxxx");
player:target_NPC("xxxx");
CompleteQuestByName("xxxx");
checkDQCount()
AcceptQuestByName("xxxx");
</waypoint>
<!-- # 2 --><waypoint x="4491" z="2167" y="1419">
findMyItem()</waypoint>
<!-- # 3 --><waypoint x="4557" z="2198" y="1421"> </waypoint>
<!-- # 4 --><waypoint x="4557" z="2198" y="1421">
findMyItem()</waypoint>
<!-- # 5 --><waypoint x="4561" z="2080" y="1418"> </waypoint>
<!-- # 6 --><waypoint x="4561" z="2080" y="1418">
findMyItem()</waypoint>
<!-- # 7 --><waypoint x="4477" z="2049" y="1418"> </waypoint>
<!-- # 8 --><waypoint x="4477" z="2049" y="1418">
findMyItem()</waypoint>
<!-- # 9 --><waypoint x="4478" z="2089" y="1418"> </waypoint>
<!-- # 10 --><waypoint x="4478" z="2089" y="1418">
findMyItem()</waypoint>
<!-- # 11 --><waypoint x="4496" z="2179" y="1420"> </waypoint>
<!-- # 12 --><waypoint x="4496" z="2179" y="1420">
findMyItem()</waypoint>
<!-- # 13 --><waypoint x="4560" z="2199" y="1421"> </waypoint>
<!-- # 14 --><waypoint x="4560" z="2199" y="1421">
findMyItem()</waypoint>
<!-- # 15 --><waypoint x="4557" z="2076" y="1418"> </waypoint>
<!-- # 16 --><waypoint x="4557" z="2076" y="1418">
findMyItem()</waypoint>
<!-- # 17 --><waypoint x="4476" z="2044" y="1418"> </waypoint>
<!-- # 18 --><waypoint x="4476" z="2044" y="1418">
findMyItem()</waypoint>
<!-- # 19 --><waypoint x="4478" z="2090" y="1418"> </waypoint>
<!-- # 20 --><waypoint x="4478" z="2090" y="1418">
findMyItem()</waypoint>
<!-- # 21 --><waypoint x="4499" z="2164" y="1418"> </waypoint>
checkDQCount()
</waypoints>

Re: harvest & co

Posted: Mon Jan 27, 2014 10:24 am
by Miworax
Line: 98
Column: 17
Pos: 3256
Message: mismatched tag

Re: harvest & co

Posted: Mon Jan 27, 2014 10:25 am
by Miworax
now there is the whole wp and the error message

Re: harvest & co

Posted: Mon Jan 27, 2014 10:30 am
by Danni
change
<!-- # 21 --><waypoint x="4499" z="2164" y="1418"> </waypoint>
checkDQCount()
into

Code: Select all

<!-- # 21 --><waypoint x="4499" z="2164" y="1418">
checkDQCount() 	</waypoint>
than it should work.

Re: harvest & co

Posted: Mon Jan 27, 2014 10:31 am
by Miworax
i try, 1 moment pls :D

Re: harvest & co

Posted: Mon Jan 27, 2014 10:35 am
by Miworax
scripts/rom/classes/waypointlist.lua:83: Fehler beim
kompilieren und ausfuhren des LUA codes. Fehler in dem onLoad Event in der Wegp
unkt Datei.


an other error message :(