Page 1 of 1

Tag OnLoad?

Posted: Wed Sep 10, 2014 9:56 am
by Lamkefyned
hi,

I have this script:(LUA)

Code: Select all

-- LVersion 1.16

	setExecutionPath(getExecutionPath().."/..")

--=================--

	cprintf(cli.red,"\n\n Load DTG Waypoints \n\n")
	yrest(500)
	clearDG()
     
--=================--

	if getZoneId() == 6 then
		clearDG()
		cprintf(cli.lightblue,"\n  ZONE ID : %s \n\n", getZoneId())
		travelDG("ObsidianCastle")
		player:target_NPC(NPCGuild)
		sendMacro("ChoiceOption(2);");
		waitForLoadingScreen()
	end

--=================--
     
	if getZoneId() == 401 then
		clearDG()
		cprintf(cli.lightblue,"\n  ZONE ID : %s \n\n", getZoneId())
		GotoGuild("Drill Ground")
		player:target_Object("Drill Ground");
		sendMacro("ChoiceOption(1);");
		waitForLoadingScreen()
	end

--=================--

	if getZoneId() == 354 then
		clearDG()

		if MaxHonor > getCurrency("honor") then
		 repeat
			cprintf(cli.lightblue,"\n  ZONE ID : %s \n", getZoneId())
			cprintf(cli.lightgreen,"\n    -- TOTAL HONOR : %s \n\n", comma_valueDG(getCurrency("honor")))
			fly()
			player:moveTo(CWaypoint(5121,2515,13),true)
			player:moveTo(CWaypoint(5121,2651,111),true)
			player:moveTo(CWaypoint(4754,2954,430),true)
			player:moveTo(CWaypoint(2609,4302,430),true)
			player:moveTo(CWaypoint(2120,4644,13),true)
			player:moveTo(CWaypoint(2665,4160,430),true)
			player:moveTo(CWaypoint(3443,4016,430),true)
			yrestsystemDG()
			clearDG()
         until getCurrency("honor") == MaxHonor
		else
			clearDG()
			flyoff()
			player:target_NPC(NPCID)
			sendMacro("ChoiceOption(7);");
			waitForLoadingScreen()
			checkgoldDG()
			GotoGuild("Guild Castle Transport Point")
			player:moveTo(CWaypoint(80,-568,6),true)
			acceptmessageDG()
			waitForLoadingScreen()
		end
	end

--=================--

	if getZoneId() == 6 then
		clearDG()
		travelDG("MercenarySquare")
	end

--=================--

	if getZoneId() == 6 then
		clearDG()
		cprintf(cli.lightblue,"\n  ZONE ID : %s \n\n", getZoneId())
		player:moveTo(CWaypoint(-22062,3654,-179),true)
		player:target_NPC(NPCStore)
		yrest(500)
		if StoreOption == 1 then
			sendMacro("ChoiceOption(1);");
		elseif StoreOption == 2 then
			sendMacro("ChoiceOption(2);");
		elseif StoreOption == 3 then
			sendMacro("ChoiceOption(3);");
		end
		yrest(1000)
		store:buyItem(ObjectBuy, AmountBuy)
		yrest(500)
		RoMScript("CloseAllWindows()")   
		GuildDonate("all", "green")
		yrest(1000)
	end

--=================--

	clearDG()
	travelDG("ObsidianCastle")

--=================--
The question is ... how I can return to the top end of the waypoint?

Re: Tag OnLoad?

Posted: Wed Sep 10, 2014 10:07 am
by rock5
So this is a waypoint onload?

You could put the whole thing into a big loop. Or you could put the whole thing into a function and loop the function. Or you could just reload the waypoint file.

Code: Select all

loadPaths(__WPL.FileName)

Re: Tag OnLoad?

Posted: Wed Sep 10, 2014 10:11 am
by Lamkefyned
Prefer the loop function

Re: Tag OnLoad?

Posted: Wed Sep 10, 2014 10:38 am
by rock5

Code: Select all

repeat

   -- Your code

until SomeCondition
I don't know what condition you would use. When would you want it to stop? If you don't want it to stop you can just use "until false".

Re: Tag OnLoad?

Posted: Wed Sep 17, 2014 5:53 am
by Maxalu
rock5 wrote:

Code: Select all

repeat

   -- Your code

until SomeCondition
I don't know what condition you would use. When would you want it to stop? If you don't want it to stop you can just use "until false".
i think the stop point would be when he has less then 1000 honor then

Code: Select all

 if MinHonor > getCurrency("honor") then
or smth like that

Re: Tag OnLoad?

Posted: Wed Sep 17, 2014 6:12 am
by rock5
In that case it would be

Code: Select all

repeat

   -- Your code

until 1000 > getCurrency("honor")
Or whatever value you wanted to use.

Re: Tag OnLoad?

Posted: Wed Sep 17, 2014 7:28 am
by Maxalu
thx it helped but i have 2 more question if i would like 2 buy and use the bought item and rebuy them if u have more than 1000 honor

Code: Select all

store:buyItem(x, y) 
then inventory:useItem(y) until inventory:useItem(y) ==0 
 if 1000< getCurrency("honor") then ???
      yrest(500)
in other words i would like 2 use the bought items till i have 0 of it in my bag. The second question is are thouse comands: "clearDG()", "checkgoldDG()" are included in the bot coz I see them first time?

Re: Tag OnLoad?

Posted: Wed Sep 17, 2014 2:32 pm
by noobbotter
I think something like this is what you're looking for. This is untested:

Code: Select all

if getCurrency("honor") > 1000 then
	repeat
		store:buyItem(x, y) 
		yrest(500)
		repeat
			inventory:useItem(y) 
			yrest(200)
		until inventory:itemTotalCount(y) == 0 
	until 1000 > getCurrency("honor")
end