Page 1 of 1

Script error Tomara Daily

Posted: Sat Jul 16, 2011 4:21 am
by farayman3
Hello Everyone,

I've taken the tomara daily script and tried to implement a function that when the 10 dailys are done it takes a daily quest ticket.

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints>
<!-- Tomara Tavern Daily "Pig in a Pond's Helper" -->
<onLoad>
   repeat questname=RoMScript("TEXT('Sys421030_name')"); yrest(500) until questname
   repeat npcname=RoMScript("TEXT('Sys114417_name')"); yrest(500) until npcname
   changeProfileOption("HARVEST_DISTANCE", 40)
</onLoad>

   <!-- #  1 --><waypoint x="-1023" z="2171" tag="Main">
   repeat queststate = getQuestStatus(questname); yrest(500) until queststate
   if queststate == "complete" then
      -- Complete quest
      player:target_NPC(npcname); yrest(1000);
      sendMacro("OnClick_QuestListButton(3, 1)"); yrest(1000); sendMacro("CompleteQuest()"); yrest(2000);
      -- Check if Dailies are finished
      repeat dailyQuestCount, dailyQuestsPerDay= RoMScript("Daily_count()") until dailyQuestCount and dailyQuestsPerDay
      if (dailyQuestsPerDay - dailyQuestCount) == 0 then
	 inventory:useItem(Daily Quest Ticket)
      end
      -- Accept quest
      player:target_NPC(npcname); yrest(1000);
      sendMacro("OnClick_QuestListButton(1, 2)"); yrest(1000); sendMacro("AcceptQuest()"); yrest(2000);
      __WPL:setWaypointIndex(__WPL:findWaypointTag("Main"));   
   elseif queststate == "incomplete" then
      -- Collect menus
      __WPL:setWaypointIndex(__WPL:findWaypointTag("Get Menus"))
   else
      -- Accept quest
      player:target_NPC(npcname); yrest(1000);
      sendMacro("OnClick_QuestListButton(1, 2)"); yrest(1000); sendMacro("AcceptQuest()"); yrest(2000);
      __WPL:setWaypointIndex(__WPL:findWaypointTag("Main"));   
   end
   </waypoint>
   <!-- #  2 --><waypoint x="-1017" z="2264" tag="Get Menus">
      player:target_Object(114475,7000,true)
      repeat queststate = getQuestStatus(questname); yrest(500) until queststate
      if queststate == "complete" then
         __WPL:setWaypointIndex(__WPL:findWaypointTag("Main"));
      end
   </waypoint>
   <waypoint x="-985" z="2256"> </waypoint>
   <!-- #  3 --><waypoint x="-1016" z="2373"> 
      player:target_Object(114475,7000,true)
   </waypoint>
   <!-- #  4 --><waypoint x="-1054" z="2368">
      repeat queststate = getQuestStatus(questname); yrest(500) until queststate
      if queststate == "incomplete" then
         player:target_Object(114475,7000,true)
      end
   </waypoint>
   <!-- #  5 --><waypoint x="-1062" z="2318"> -- </waypoint>
   <!-- #  5 --><waypoint x="-1097" z="2265"> </waypoint>
   <!-- #  5 --><waypoint x="-1055" z="2260">
      repeat queststate = getQuestStatus(questname); yrest(500) until queststate
      if queststate == "complete" then
         __WPL:setWaypointIndex(__WPL:findWaypointTag("Main"));
      else
         player:target_Object(114475,7000,true)
         repeat queststate = getQuestStatus(questname); yrest(500) until queststate
         if queststate == "complete" then
            __WPL:setWaypointIndex(__WPL:findWaypointTag("Main"));
         else
            __WPL:setWaypointIndex(__WPL:findWaypointTag("Get Menus"))
         end
      end
   </waypoint>
</waypoints>
But this doesn't work. It gives me this error:
...:\Program Files (x86)\micromacro\scripts\rom/bot.lua failed to compile and run Lua code for waypoint #2
It works fine when I do nothing to the script.
Where it sais inventory:useItem(Daily Quest Ticket) there used to be player:sleep().


anyone who can help?
thanks

Re: Script error Tomara Daily

Posted: Sat Jul 16, 2011 7:35 am
by lisa
I didn't look through all the code, but the bit you mentioned

Code: Select all

inventory:useItem(Daily Quest Ticket)
Should have ""

Code: Select all

inventory:useItem("Daily Quest Ticket")
I also find a good way to test new code is to make it a userfunction by adding it to a file in the userfunctions folder. By doing this you won't just get an error saying failed to load, you get an error saying which line is wrong and what the problem is.
You can then just copy paste the code to where you want it and delete the userfunction.

Re: Script error Tomara Daily

Posted: Sat Jul 16, 2011 10:59 am
by farayman3
ahh :P, thanks alot!