Page 1 of 1

timer

Posted: Thu Nov 03, 2011 12:42 am
by D1mAnn
two points

Code: Select all

	<waypoint x="-6901" z="-3986">
		if(player.free_counter1 == 0) then
         player.free_counter1 = os.time();
      end;
		timer = os.difftime(os.time(), player.free_counter1); yrest(1000);
	</waypoint>

Code: Select all

	<waypoint x="-6780" z="-3584" tag="rep">
		player:target_NPC("Смущенный искатель приключений"); yrest(100);
		if(timer > 300) then
			player.free_counter1 = 0;
			RoMScript("DeleteQuestByID(423776)");
			__WPL:setWaypointIndex(__WPL:findWaypointTag("request"));
		end
		RoMScript("ChoiceOption(1);"); yrest(100);
		RoMScript("ChoiceOption(1);"); yrest(100);
		local queststate = getQuestStatus("Заработать репутацию")
			if queststate == "incomplete" then
				__WPL:setWaypointIndex(__WPL:findWaypointTag("rep"));
			end
	</waypoint>
why the timer is always 0

Re: timer

Posted: Thu Nov 03, 2011 1:00 am
by lisa

Code: Select all

      if(player.free_counter1 == 0) then
         player.free_counter1 = os.time();
      end;
      timer = os.difftime(os.time(), player.free_counter1); 
so if the player.free_counter1 == 0 (always does at start up) then it sets it to the current time, you then compare that to the current time. So if player.free_counter1 == 0 timer will always be 0 the first time.

How are the waypoints occuring, is it in a small loop, which is first. what else happens?

Re: timer

Posted: Thu Nov 03, 2011 1:34 am
by D1mAnn
lisa wrote:what else happens?

Code: Select all

	
<waypoint x="-7542" z="-3854" tag="request">
	player.free_counter1 = 0;
</waypoint>
and etc.
if the bot can not find the NPC for 5 minutes, he removes the quest and go back to take
here and so have to struggle with game bug

Re: timer

Posted: Thu Nov 03, 2011 2:55 am
by lisa
Seems to me the issue might be in how you are trying to do what you want.

Can you post the WP code as it is in the WP. As it is I can only guess what may be wrong. Right now I assume that anytime this code is done

Code: Select all

     if(player.free_counter1 == 0) then
         player.free_counter1 = os.time();
      end;
      timer = os.difftime(os.time(), player.free_counter1); 
The player.free_counter1 is always 0, so need to work out why it is always 0.

Re: timer

Posted: Thu Nov 03, 2011 3:03 am
by D1mAnn

Code: Select all

<waypoints type="TRAVEL">
	<onLoad>
		repeat zoneid = RoMScript("GetZoneID()") until zoneid
		if zoneid == 13 then  __WPL:setWaypointIndex(__WPL:findWaypointTag("day"))
		end
		player:update();
		name = "name"
		Account = 1;
		Charcount = 1;
		pass = 0;
		pass2={"pass2","pass2","pass2"};
		fastLoginAccNames={Names"","Names","Names","Names","Names","Names"};
        sendMacro("}fastLoginLoggedIn=false;a={");
        yrest(100);
        sendMacro("}fastLoginAutoEnter=true;a={");
        yrest(100);
        sendMacro("}fastLoginAutoLogin=true;a={");
        yrest(100);
        sendMacro("}fastLoginRelog=true;a={");
        yrest(100);
        sendMacro("}fastLoginNoZoom=true;a={");
	</onLoad>
	<waypoint x="-7114" z="-4124" tag="day">
		player:update();
		local dailyQuestCount, dailyQuestsPerDay= RoMScript("Daily_count()");
		if 10 == dailyQuestCount then __WPL:setWaypointIndex(__WPL:findWaypointTag("boxd"))
		else
			printf(player.Name.."_\145\164\165\171\160\173\174 "..dailyQuestCount.." \164\165\169\171\168\170\174\162.");
		end
	</waypoint>
	<waypoint x="-7114" z="-4124">
		repeat
		player:target_NPCA("Хугоп");
		until RoMScript("SpeakFrame:IsVisible()")
		RoMScript("OnClick_QuestListButton(1, 1);");
		RoMScript("SpeakFrame_AcceptQuest();"); player:rest(1);
		local queststate = getQuestStatus("Заработать репутацию")
		if queststate == "not accepted" then
			__WPL:setWaypointIndex(__WPL:findWaypointTag("day"));
		end
	</waypoint>
	<waypoint x="-7059" z="-4233">
	if(player.free_counter1 == 0) then 
		player.free_counter1 = os.time();
	end;
		timer = os.difftime(os.time(), player.free_counter1); yrest(1000);
	</waypoint>
	<waypoint x="-6997" z="-4429" tag="rep">
		player:target_NPC("Смущенный искатель приключений"); yrest(100);
		if(timer > 300) then
			player.free_counter1 = os.time();
			RoMScript("DeleteQuestByID(423776)");
			__WPL:setWaypointIndex(__WPL:findWaypointTag("request"));
		end
		RoMScript("ChoiceOption(1);"); yrest(100);
		RoMScript("ChoiceOption(1);"); yrest(100);
		local queststate = getQuestStatus("Заработать репутацию")
			if queststate == "incomplete" then
				__WPL:setWaypointIndex(__WPL:findWaypointTag("rep"));
			end
	</waypoint>
	<waypoint x="-6997" z="-4429" tag="request">
		player.free_counter1 = 0;
	</waypoint>
	<waypoint x="-7114" z="-4124" tag="complete">
		repeat 
		player:target_NPCA("Хугоп");
		until RoMScript("SpeakFrame:IsVisible()")
		RoMScript("OnClick_QuestListButton(3, 1);");
		RoMScript("SpeakFrame_CompleteQuest();")
		local queststate = getQuestStatus("Заработать репутацию")
		if queststate == "not accepted" then __WPL:setWaypointIndex(__WPL:findWaypointTag("day"));
			else __WPL:setWaypointIndex(__WPL:findWaypointTag("complete"));
		end
	</waypoint>
	<waypoint x="-7114" z="-4124" tag="boxd">
	inventory:update();
	box = RoMScript("GetMagicBoxEnergy()");
	if(13 > box) then __WPL:setWaypointIndex(__WPL:findWaypointTag("escape"));
		else __WPL:setWaypointIndex(__WPL:findWaypointTag("tomail"));
	end
	</waypoint>
	<waypoint x="-7114" z="-4124" tag="escape">
	inventory:update();
	coin = inventory:itemTotalCount(203038);
	printf("Phirius %d \n", coin);
	if(300 > coin) then __WPL:setWaypointIndex(__WPL:findWaypointTag("home"));
	else 
	energy = inventory:itemTotalCount(202928);
	pass = pass + 1;
	inventory:update();
	BuyFromItemShop(762, pass2[pass]);
	player:rest(1); 
	inventory:update();
	inventory:useItem(202928)
	box = RoMScript("GetMagicBoxEnergy()")
	if(13 > box) then __WPL:setWaypointIndex(__WPL:findWaypointTag("escape"));
		else __WPL:setWaypointIndex(__WPL:findWaypointTag("tomail"));
	end
	end
	</waypoint>
	<waypoint x="-7044" z="-4124" tag="tomail"></waypoint>
	<waypoint x="-7002" z="-3990"></waypoint>
	<waypoint x="-7112" z="-3942" tag="mail">
		repeat
		player:target_NPCA("Почтовый ящик",1500); yrest(1000);
		sendMacro("ChoiceOption(1);"); yrest(1000);
		until RoMScript("MailFrame:IsVisible()")
		UMM_TakeMail (); yrest(1000);
		sendMacro("CloseWindows()");
		inventory:update();
	</waypoint>
	<waypoint x="-7112" z="-3942" tag="tier">
		player:rest(2);
		local cnt = 0;
		local retry_count = 0;
		while(cnt == 0)and(retry_count<3)do
		-- Config Save
		sendMacro("FusionConfig_OnShow()"); yrest(2000)
		sendMacro("FusionConfigFrame_ItemlistEditBox:SetText(TEXT('Превосходный пояс'))"); yrest(2000)
		sendMacro("FusionConfig_Save()"); yrest(2000) 
		-- Open dialogs
		if RoMScript("AdvancedMagicBoxFrame ~= nil") then
		sendMacro("AdvancedMagicBoxFrame:Show()"); yrest(2000)
		else
		sendMacro("MagicBoxFrame:Show()"); yrest(2000)
		end
		sendMacro("FusionFrame:Show()"); yrest(2000)
		-- Set number to make
		sendMacro("FusionFrameFusionNumberEditBoxFusionAndItem:SetText('9')"); yrest(1000)
		sendMacro("FusionFrameFusionNumberEditBox5:SetText('3')"); yrest(1000)
		sendMacro("FusionFrameFusionNumberEditBox6:SetText('1')"); yrest(2000)
		-- Do
		sendMacro("Fusion_QueueManastones(FusionFrame_Do)");
		repeat yrest(2000) until RoMScript("Fusion.LastGrad")==0
		-- close 
		yrest(2000)
		if RoMScript("AdvancedMagicBoxFrame ~= nil") then
		sendMacro("AdvancedMagicBoxFrame:Hide()"); yrest(2000)
		else
		sendMacro("MagicBoxFrame:Hide()"); yrest(2000)
		end
		inventory:update();
		cnt = inventory:getItemCount(202845);
		retry_count = retry_count + 1;
		end
	</waypoint>
	<waypoint x="-7112" z="-3942" tag="send">
		repeat
		player:target_NPCA("Почтовый ящик",1500); yrest(1000);
		sendMacro("ChoiceOption(1);"); yrest(1000);
		until RoMScript("MailFrame:IsVisible()")
		inventory:update();
		UMM_SendByNameOrId(name, "Камень маны ур. 6");
		sendMacro("CloseWindows()"); yrest(100);
	</waypoint>
	<waypoint x="-7002" z="-3990"></waypoint>
	<waypoint x="-7044" z="-4124"></waypoint>
	<waypoint x="-7114" z="-4124" tag="home">
		pass = 0;
		if(Charcount > 0) then
		Charcount = Charcount + 1
		printf("Character %d of account %s has completed task!\n", Charcount, fastLoginAccNames[Account]);
		end
		if(9 > Charcount) then
		sendMacro("}LoginNextToon=true;a={");
		yrest(100);
		sendMacro("Logout();");
		yrest(100);
		waitForLoadingScreen();
		player:update();
		end
		if(Charcount > 8) then
		Charcount = 1
		Account = Account + 1
		sendMacro("}fastLoginUser=\"" .. fastLoginAccNames[Account] .. "\";a={");
		yrest(100);
		sendMacro("}fastLoginPass=\"" .. fastLoginAccNames[Account] .. "\";a={");
		yrest(100);
		sendMacro("}fastLoginChrSel=" .. Charcount .. ";a={");
        yrest(100);
        sendMacro("}fastLoginTriedOnce=false;a={");
        yrest(100);
        sendMacro("}fastLoginLoggedIn=false;a={");
        yrest(100);
        sendMacro("CharacterSelect_Exit();");
		waitForLoadingScreen();
		yrest(100);
		player:update();
		end
		sendMacro("}LoginNextToon=false;a={");
		player:update();
		__WPL:setWaypointIndex(__WPL:findWaypointTag("day"))
	</waypoint>
</waypoints>

Re: timer

Posted: Thu Nov 03, 2011 3:36 am
by rock5
When repeating in the "rep" loop it never updates timer. So it never changes and never goes above 300.

Re: timer

Posted: Thu Nov 03, 2011 3:41 am
by D1mAnn

Code: Select all

 <waypoint x="-6780" z="-3584" tag="rep">
      player:target_NPC("Смущенный искатель приключений"); yrest(100);
 if(player.free_counter1 == 0) then
         player.free_counter1 = os.time();
      end;
      timer = os.difftime(os.time(), player.free_counter1); yrest(1000);
      if(timer > 300) then
         player.free_counter1 = 0;
         RoMScript("DeleteQuestByID(423776)");
         __WPL:setWaypointIndex(__WPL:findWaypointTag("request"));
      end
      RoMScript("ChoiceOption(1);"); yrest(100);
      RoMScript("ChoiceOption(1);"); yrest(100);
      local queststate = getQuestStatus("Заработать репутацию")
         if queststate == "incomplete" then
            __WPL:setWaypointIndex(__WPL:findWaypointTag("rep"));
         end
   </waypoint>
right?

Re: timer

Posted: Thu Nov 03, 2011 4:25 am
by rock5
That looks like it will work.

Re: timer

Posted: Thu Nov 03, 2011 4:52 am
by D1mAnn
tyvm :D