Page 1 of 1

Earn a Reputation

Posted: Sun Jan 08, 2012 3:04 am
by kuripot
i want to learn how to make a waypoint by using player:target_NPC..
this is daily quest in heffner for level 5..
i try to get some idea from elf2.xml

but i dont know why the "Uncomfortable Adventurer" not follow the sendMacro("ChoiceOption(1);");
and i got error this my waypoint

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints>
	<!-- #  1 --><waypoint x="-7103" z="-4156" y="172">
         queststate = getQuestStatus("Earn a Reputation");
          if queststate == "complete" then
               player:target_NPC("Hugope");
           CompleteQuestByName("Earn a Reputation")
   end
         local dqCount, dqPerDay = RoMScript("Daily_count()");
     if dqCount == 10 then
		player:sleep();
	else
               player:target_NPC("Hugope");
               AcceptQuestByName("Earn a Reputation")
          end
	</waypoint>
	<!-- #  2 --><waypoint x="-7068" z="-4245" y="174">	</waypoint>
	<!-- #  3 --><waypoint x="-7006" z="-4399" y="171">
	player:target_NPC("Uncomfortable Adventurer");
		sendMacro("ChoiceOption(1);");
		yrest(3000);
         end
	</waypoint>
	<!-- #  4 --><waypoint x="-7006" z="-4399" y="171">
	player:target_NPC("Uncomfortable Adventurer");
		sendMacro("ChoiceOption(1);");
		yrest(5000);
         end
	</waypoint>
	<!-- # 5 --><waypoint x="-7006" z="-4399" y="171">	</waypoint>
	<!-- # 6 --><waypoint x="-7035" z="-4328" y="172">	</waypoint>
	<!-- # 7 --><waypoint x="-7106" z="-4157" y="172">	</waypoint>
</waypoints>
and this is the error

Re: Earn a Reputation

Posted: Sun Jan 08, 2012 4:34 am
by lisa
the end shouldn't be there because there is nothing that needs to end.

try this

Code: Select all

player:target_NPC("Uncomfortable Adventurer");
sendMacro("ChoiceOption(1);");
yrest(3000);
things that need to have an end

if
for
while

probably more of them, can't think of them off the top of my head.

So

Code: Select all

if 
blah blah blah
end

for
blah blah blah
end

while
blah blah blah
end

Re: Earn a Reputation

Posted: Sun Jan 08, 2012 5:52 am
by rock5
kuripot wrote:but i dont know why the "Uncomfortable Adventurer" not follow the sendMacro("ChoiceOption(1);");
Have you tried doing the quest manually? You need to select option 1 twice. So

Code: Select all

		player:target_NPC("Uncomfortable Adventurer"); yrest(500)
		RoMScript("ChoiceOption(1)") yrest(500)
		RoMScript("ChoiceOption(1)") yrest(500)
That's what I use.

Re: Earn a Reputation

Posted: Sun Jan 08, 2012 7:41 am
by kuripot
thanks both of you now its working

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints>
	<!-- #  1 --><waypoint x="-7085" z="-4136" y="173">
         queststate = getQuestStatus("Earn a Reputation");
          if queststate == "complete" then
               player:target_NPC("Hugope");
           CompleteQuestByName("Earn a Reputation")
   end
         local dqCount, dqPerDay = RoMScript("Daily_count()");
     if dqCount == 10 then
		player:sleep();
	else
               player:target_NPC("Hugope");
               AcceptQuestByName("Earn a Reputation")
          end
	</waypoint>
	<!-- #  3 --><waypoint x="-7085" z="-4136" y="173">	</waypoint>
	<!-- #  4 --><waypoint x="-7053" z="-4237" y="174">	</waypoint>
	<!-- #  5 --><waypoint x="-7003" z="-4397" y="171">
		player:target_NPC("Uncomfortable Adventurer");
		sendMacro("ChoiceOption(1);");
		yrest(500);
		sendMacro("ChoiceOption(1);");
		yrest(1000);
	</waypoint>
	<!-- #  9 --><waypoint x="-7003" z="-4397" y="171">	</waypoint>
	<!-- # 10 --><waypoint x="-6991" z="-4227" y="170">	</waypoint>
	<!-- # 11 --><waypoint x="-6972" z="-3949" y="167">	</waypoint>
	<!-- # 12 --><waypoint x="-7122" z="-3892" y="147">	</waypoint>
	<!-- # 13 --><waypoint x="-7131" z="-3865" y="146">
		player:target_NPC("Uncomfortable Adventurer");
		sendMacro("ChoiceOption(1);");
		yrest(500);
		sendMacro("ChoiceOption(1);");
		yrest(1000);
	</waypoint>
	<!-- # 17 --><waypoint x="-7131" z="-3865" y="146">	</waypoint>
	<!-- # 18 --><waypoint x="-6981" z="-3937" y="166">	</waypoint>
	<!-- # 19 --><waypoint x="-6983" z="-4096" y="170">	</waypoint>
	<!-- # 20 --><waypoint x="-7083" z="-4114" y="172">	</waypoint>
</waypoints>
but i can see the problem in future... if im not the only one doing quest... because after you talk to "Uncomfortable Adventurer" he will run away. so after im back again in his spot and he is not yet come back.. my character continue running and going somewhere..

Re: Earn a Reputation

Posted: Thu Jul 26, 2012 12:37 pm
by CanceR
i am sorry for digging up this thread.
if i make this daily quest in party of 2(3-6) chars, and one of them is circulating to talk with NPC's on a mount, and others are passive chars, which just wait the daily quest to be finished?
i tried with only first waypoint of upper shown chain, but passive char constantly losses focus and get back focused to NPC Hugope, and constantly turns around the coordinates of the waypoint.
any idea how to make char to wait until quest is finished, to be able to finish it, without moving and focusing NPC?

Re: Earn a Reputation

Posted: Fri Jul 27, 2012 5:05 am
by rock5
I suspect what you are doing is making it redo the waypoint again and again. What you should do is stay inside a loop until their dalies are completed.

Re: Earn a Reputation

Posted: Fri Jul 27, 2012 11:21 am
by CanceR
i did tried both ways: repeating waypoint (does upper explained effect), and tried for looping with "while .. do" and "repeat .. until" - micromacro crashes with error in "rom/bot.lua:792: Faild to compile and run Lua code for waypoint #1"

Code: Select all

 
<?xml version="1.0" encoding="utf-8"?><waypoints>
	<!-- #  1 --><waypoint x="-7139" z="-4111" y="172">	
	local dqCount = RoMScript("Daily_count()");
	if dqCount == 10 then
             player:sleep()
	else
	  queststate = getQuestStatus("Earn a Reputation");
           if (queststate != "complete") then
             repeat
				
	  until queststate == "complete";
	  player:target_NPC("Hugope")
	  AcceptCompleteQuestByName("Earn a Reputation")
	else
	  player:target_NPC("Hugope")
	  AcceptQuestByName("Earn a Reputation")
	end
     end 
	</waypoint>
</waypoints>
can you please advice what is proper syntax of loops or give me link to read it. thank you in advance

Re: Earn a Reputation

Posted: Fri Jul 27, 2012 12:42 pm
by rock5
Your best reference for lua is
http://www.lua.org/manual/5.1/

But basically the loops are

Code: Select all

repeat
   ...
until condition

Code: Select all

while condiftion do
   ...
end
and the 'for' statement which can come in different flavours so I wont provide examples.

Re: Earn a Reputation

Posted: Fri Jul 27, 2012 6:45 pm
by lisa

Code: Select all

if (queststate != "complete") then
should be
~=

Code: Select all

if (queststate ~= "complete") then
you also need an end for that if statement but not at the end of all the code, needs to be before the next else as it is nested inside another if statement.

Something like this will work.

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints>
   <!-- #  1 --><waypoint x="-7139" z="-4111" y="172">   
     player:target_NPC("Hugope")
     CompleteQuestByName("Earn a Reputation")
   local dqCount = RoMScript("Daily_count()");
   if dqCount == 10 then
             player:sleep()
   else
     player:target_NPC("Hugope")
     AcceptQuestByName("Earn a Reputation")
               repeat
                  yrest(1000)
               until getQuestStatus("Earn a Reputation") == "complete";
    end
   </waypoint>
</waypoints>