Page 1 of 6

Secret Garden Ideas

Posted: Mon Mar 24, 2014 5:39 am
by ninjazero
I've been working on a file for the Secret Garden / Treasure Riot and have reached my limit on how to make it better.

I've created a file with predefined travel waypoints at each of the chests and once RoMScript("TimeKeeperFrame:IsVisible()") start calling the function getchests() at each waypoint and then checks the TimeKeeperFrame to see if it should go get the last five chests.

This works fine to get ~35 chests in the event, although by manual play I've gotten up to 50.

Opportunities for improvement:
-Using a table and letting it loot the closest chest seemed slower but may be my limit on how code/sort the list.
-Teleporting to the next waypoint seems slower than running with speed over 100. Any way to increase very short distance teleport speed.
-Once speed is increased over ~150, it starts to overshoot the waypoint and has trouble looting the correct chest.
-In manual play you can click to move on to the next chest slightly before the previous chest is done opening, any way to simulate this like move on when cast bar is 90% full.

Code: Select all

function evalClickable(address)
		local chest = memoryReadRepeat("byte", getProc(), address + 0x2F0) or 0
		if chest ~= 0 then
			return true
		else
			return false
		end
	end

 
function getchests()	
				local chest
				chest = player:findNearestNameOrId(123536,nil,evalClickable)
				local mydistance = distance(chest, player)
					if chest and 50 > mydistance then
						player:target_Object(chest.Id, nil, nil, true, evalClickable);
					end
					
	end			
	 

Re: Secret Garden Ideas

Posted: Mon Mar 24, 2014 8:04 am
by rock5
Teleporting over short distances less than 115 should do it in one teleport and will take as long as it takes. there is nothing in the function that slows it down. If teleporting over longer distances then it might do multiple teleports and pause between each. By default the pause is 500ms. You can change the pause length with the following command.

Code: Select all

teleport_SetStepPause(val)
Where 'val' is the size of the pause in ms you want to set it to. You can also increase the step size but I think that increases the chance of pull back.

player:target_Object waits for the casting bar to disappear. If you want to take action during the casting bar you have to use a different function. Player:target_NPC should work. That function just clicks but does not wait. Then you would have to wait the appropriate amount of time. I don't think there is any way to actually see how much time is left on the casting bar unfortunately. You would have to approximate the time to wait before trying to click again. It might be an idea to wait for the castingbar to start then time it from there.

Re: Secret Garden Ideas

Posted: Mon Mar 24, 2014 8:20 am
by lisa
would player:getRemainingCastTime() work for that?

Re: Secret Garden Ideas

Posted: Mon Mar 24, 2014 8:58 am
by rock5
I think that has been brought up before and it was found that it only applies to skills. http://solarstrike.net/phpBB3/viewtopic ... 161#p55161

At that link you will also find the code I suggested they use instead, that might be used in this case.

Re: Secret Garden Ideas

Posted: Mon Mar 24, 2014 10:13 am
by dx876234
To speed up I've been using player:target with a yrest after instead.

Code: Select all

player:target(chest.Address) 
Attack()
yrest(900)
I'm not sure if any cast speed pots/skills applies to looting chests, if they do this will fail.

-dx

Re: Secret Garden Ideas

Posted: Mon Mar 24, 2014 6:13 pm
by lisa
I went to check it out but my client crashed everytime I tried to enter Secret Garden, ohh well.

Re: Secret Garden Ideas

Posted: Mon Mar 24, 2014 6:40 pm
by ZZZZZ
Try replacing your eventdgn_secret_garden.wdb file from wbd/event_dungeon with the 1 in the link below:


http://www.filefactory.com/file/2yfympv ... garden.wdb


As for this event. I can't get the check for click to work, so I made it add it to an ignore variable, works almost spot on, there are some things I need to change to make it faster but so far I can run all 20+ alts I have through and they get around 30-35 chests each.

And as for the OP, I don't see how you can get 50....Best I have managed is 40 manually and thats with R5 and as many movement buffs that I can get, including standing between 2 chests so I can get 2 for every movement I make.

Re: Secret Garden Ideas

Posted: Mon Mar 24, 2014 8:11 pm
by lisa
interesting, I don't even have that file, no wonder it is crashing, bad patch I guess.

K had a look.

I would take a page out of Rocks Survival book for this, 104 chests and all in exact same positions every time, you could make a grid of the locations and move/teleport to between 2 chests and then click both chests without moving, then move to next spot and do next 2 chests.

That trig math stuff makes my head spin though, so someone else will have to do it ;)

Here are the coords though and they were the exact same every time.
Mind you the code would get the coords and address each time it is run anyway but atleast it will give you an idea of the coords before even having to enter the instance to come up with the code.

Code: Select all

{X= 160.76661682129, Z=-302.79663085938},
{X= -197.66920471191, Z=-26.167356491089},
{X= -233.63619995117, Z=8.56556224823},
{X= 159.53254699707, Z=-232.09672546387},
{X= 15.66459274292, Z=-93.165046691895},
{X= -20.302396774292, Z=-58.432132720947},
{X= -56.269386291504, Z=-23.699213027954},
{X= 51.63158416748, Z=-127.89797210693},
{X= 87.598571777344, Z=-162.63088989258},
{X= 123.56555938721, Z=-197.36380004883},
{X= 334.43121337891, Z=-122.96168518066},
{X= 11.962378501892, Z=118.93467712402},
{X= 47.92936706543, Z=84.201759338379},
{X= 190.56326293945, Z=15.96999168396},
{X= 82.662284851074, Z=120.16874694824},
{X= 226.53024291992, Z=-18.762926101685},
{X= 298.46423339844, Z=-88.22876739502},
{X= 262.49722290039, Z=-53.495845794678},
{X= 118.62928009033, Z=85.435829162598},
{X= 154.5962677002, Z=50.702911376953},
{X= 83.896354675293, Z=49.468837738037},
{X= 299.69830322266, Z=-158.92866516113},
{X= -58.737529754639, Z=117.7006072998},
{X= 155.83033752441, Z=-19.996997833252},
{X= 263.73132324219, Z=-124.19575500488},
{X= -22.770540237427, Z=82.967681884766},
{X= 119.86334991455, Z=14.735919952393},
{X= 227.76431274414, Z=-89.462837219238},
{X= 191.79733276367, Z=-54.729915618896},
{X= -158, Z=-273},
{X= 21.834949493408, Z=-446.66458129883},
{X= -14.132040023804, Z=-411.93167114258},
{X= -50.099029541016, Z=-377.19876098633},
{X= -122.03301239014, Z=-307.73291015625},
{X= -229.93397521973, Z=-203.53416442871},
{X= -123.26708221436, Z=-237.03300476074},
{X= -87.300094604492, Z=-271.76593017578},
{X= -51.333103179932, Z=-306.49884033203},
{X= -159.23406982422, Z=-202.30009460449},
{X= -193.96699523926, Z=-238.26707458496},
{X= 20.600877761841, Z=-375.96469116211},
{X= -15.366111755371, Z=-341.23175048828},
{X= 56.567867279053, Z=-410.69760131836},
{X= -337.8349609375, Z=-99.335411071777},
{X= -301.86795043945, Z=-134.06832885742},
{X= -265.90097045898, Z=-168.80123901367},
{X= -195.20106506348, Z=-167.56716918945},
{X= 90.066719055176, Z=-304.03070068359},
{X= 54.099723815918, Z=-269.29779052734},
{X= 126.03370666504, Z=-338.76361083984},
{X= -161.70220947266, Z=-60.900276184082},
{X= -232.40213012695, Z=-62.134346008301},
{X= -17.834255218506, Z=-199.83195495605},
{X= 18.132736206055, Z=-234.5648651123},
{X= -125.73522186279, Z=-95.633193969727},
{X= -89.76823425293, Z=-130.36610412598},
{X= -53.801242828369, Z=-165.09902954102},
{X= -196.4351348877, Z=-96.867263793945},
{X= -268.36911010742, Z=-27.401428222656},
{X= -267.1350402832, Z=-98.101333618164},
{X= -303.10202026367, Z=-63.36841583252},
{X= 91.300788879395, Z=-374.73062133789},
{X= -231.16804504395, Z=-132.8342590332},
{X= 195.49954223633, Z=-266.82965087891},
{X= -160.46813964844, Z=-131.60018920898},
{X= -124.50115203857, Z=-166.33309936523},
{X= -88.534164428711, Z=-201.06602478027},
{X= -52.56717300415, Z=-235.79893493652},
{X= -16.600183486938, Z=-270.53186035156},
{X= 19.366807937622, Z=-305.26477050781},
{X= 55.333797454834, Z=-339.99768066406},
{X= 230.23246765137, Z=-230.86265563965},
{X= -92.236373901367, Z=11.033705711365},
{X= -128.20336914063, Z=45.766624450684},
{X= -164.17036437988, Z=80.499542236328},
{X= 86.364501953125, Z=-91.930976867676},
{X= 122.33148956299, Z=-126.66389465332},
{X= 158.29847717285, Z=-161.39682006836},
{X= -21.536468505859, Z=12.267777442932},
{X= 194.26547241211, Z=-196.12973022461},
{X= 14.430521011353, Z=-22.465141296387},
{X= 50.397510528564, Z=-57.198059082031},
{X= 52.865653991699, Z=-198.59786987305},
{X= 88.832641601563, Z=-233.33079528809},
{X= -19.068325042725, Z=-129.13203430176},
{X= 16.898664474487, Z=-163.8649597168},
{X= -91.002304077148, Z=-59.666202545166},
{X= -198.90327453613, Z=44.532550811768},
{X= -55.035316467285, Z=-94.399124145508},
{X= -126.96929931641, Z=-24.933284759521},
{X= 124.79963684082, Z=-268.06372070313},
{X= -162.93627929688, Z=9.7996339797974},
{X= -86.066017150879, Z=-342.46585083008},
{X= 13.196449279785, Z=48.234767913818},
{X= 157.06440734863, Z=-90.696907043457},
{X= 264.96539306641, Z=-194.89566040039},
{X= 228.99838256836, Z=-160.16275024414},
{X= 193.03140258789, Z=-125.4298248291},
{X= -57.50345993042, Z=47.000694274902},
{X= -93.47045135498, Z=81.733612060547},
{X= -129.43743896484, Z=116.46652984619},
{X= 121.09741973877, Z=-55.963989257813},
{X= 85.130432128906, Z=-21.231069564819},
{X= 49.163440704346, Z=13.501848220825},

Re: Secret Garden Ideas

Posted: Mon Mar 24, 2014 8:29 pm
by ZZZZZ
I used to get issues when entering tosh and AC. All I had to do was replace their corresponding file with 1 from somebody elses client that worked and I could then enter. Corrupt or in this case missing files are op :P

Re: Secret Garden Ideas

Posted: Mon Mar 24, 2014 8:47 pm
by lisa
Also no need to do click check, nothing to attack you or interupt you, just set it to click chest and then do yrest for set time and then click next. Just go through them in an order.

Re: Secret Garden Ideas

Posted: Mon Mar 24, 2014 9:48 pm
by rock5
lisa wrote:Here are the coords though and they were the exact same every time.
I can use those to visualize the coords in Excel.
ScreenShot.jpg
So, what order do you want to do them in and where does it start and I'll see what I can do.

Re: Secret Garden Ideas

Posted: Mon Mar 24, 2014 9:56 pm
by ZZZZZ
There are actually 110 chests Lisa. Its just that you need to run a chest row or 2 into the room for the last lot to appear.

Re: Secret Garden Ideas

Posted: Mon Mar 24, 2014 10:04 pm
by lisa
NPC is at (-158, -317, 6) and you need to click NPC to start it, so yeah that is starting spot I guess and work from there.

Ideally you want to move/teleport to between 2 chests and then click them both before moving again, this will reduce moving time.

Re: Secret Garden Ideas

Posted: Mon Mar 24, 2014 10:06 pm
by ninjazero
zzzzz

In manual play I usually get 4.5 rows done using a modified R5 to travel at 900 speed and open chests in a straight line. This prevents slowing down from the "speed buff". At that speed there is almost no travel time and the limit on the number of chests is how fast you can target the next chest and click it at the right time.

I've switched to using the Attack() function an I tried adding a casting bar check, sometimes it doesn't open the chest at first and now won't skip over them, at 200 speed travel I have bumped up the number to 35-40 total. Testing teleport instead I had to increase the wait time so it wouldn't skip past the chest which slowed down looting.

Code: Select all

function getchests()					
	repeat
		local chest
		chest = player:findNearestNameOrId(123536)
		player:target(chest.Address)
		Attack()
		yrest(100)
		player:updateCasting()
    until player.Casting
	yrest(900)
en
Ideally I think the fastest way would be to use the coordinate list and a predefined order without using waypoints like Lisa suggests (simulating manual play with high travel speed) but that is beyond my knowledge.

Rock 5: The best path I found was starting at -112, -308 moving NE then back again, avoiding the top 6 chests until the timer goes to zero.

Re: Secret Garden Ideas

Posted: Mon Mar 24, 2014 10:10 pm
by ZZZZZ
righto... This is the huge mess of code I tried, half of its probably useless but hey, it works though only gets around ~33

Code: Select all

function openChests(_noCounter)
	local chest
	chest = player:findNearestNameOrId(123536)
	if chest ~= nil then
		if _noCounter then
			--print("aaaa");
			repeat
				--chest = player:findNearestNameOrId(123536, chest.Address)
				for __, addr in pairs(chestIgnoreList) do
					if chest.Address == addr then
						chest = false
						--print("bbbb");
					end
				end
				if chest then
				--print("cccc");
					teleport(chest.X,chest.Z,chest.Y)
						player:target_Object(123536);
						chestIgnoreList[1] = chest.Address
						chestLootedCounter = chestLootedCounter + 1
				end
				chest = player:findNearestNameOrId(123536, chest.Address)
				---print("dddd");
			until not chest
			cprintf(cli.green,"\nTotal # chests looted: "..chestLootedCounter.."\n")
		else
			repeat		
				for __, addr in pairs(chestIgnoreList) do
					if chest.Address == addr then
						chest = false
					end
				end
				if chest then
					if not RoMScript("TimeKeeperFrame:IsVisible()") then
						return
					end
					teleport(chest.X,chest.Z,chest.Y)
						player:target_Object(123536);
						chestIgnoreList[1] = chest.Address
						chestLootedCounter = chestLootedCounter + 1
				end
				chest = player:findNearestNameOrId(123536, chest.Address)
			until not RoMScript("TimeKeeperFrame:IsVisible()")
		end
	end
end

function createChestTable(_noCounter) -- Gets array of chests
		chests = {}

		local objectList = CObjectList();
		objectList:update();
		local objSize = objectList:size()

		for i = 0,objSize do
			local obj = objectList:getObject(i);
			if obj.Id == 123536 then
				table.insert(chests, table.copy(obj))
			end
		end
		-- sort by address
		local function addresssortfunc(a,b)
			return a.Address > b.Address
		end
		table.sort(chests, addresssortfunc)
	openChests(_noCounter)
end
I could probably adjust it to follow a path but havnt got that far...lol

Re: Secret Garden Ideas

Posted: Mon Mar 24, 2014 10:19 pm
by rock5
I should be able to figure out where the rest are from the info provided.

So I guess that means you enter from the bottom.

So do you just collect as many chests as possible until the time runs out? I thought someone said something about "last 5 chests". Ninjazero, what do you mean by "avoiding the top 6 chests until the timer goes to zero"? Why do you avoid the top six? If you go NE which way do you turn when you get to the end? Doesn't it make more sense to go back and forth along the lines so you have more available close?
ScreenShot.jpg
Also I wonder if you can stand in the middle of 4 chests and open them all without moving. That would put them only about 35 away.

Re: Secret Garden Ideas

Posted: Mon Mar 24, 2014 10:26 pm
by lisa
you have 1 minute and then they vanish but 6 still remain after timer runs out, the very top 6, the ones not in the list I provided ;)

Ok so between 4 should work,
since you have 60 seconds and it takes roughly 1 second to open a chest you won't ever get them all, so just plan path to get 60 and it should be fine.

To give you an idea I have been testing with this and it has opened 25-30 consistantly for me.

Code: Select all

function logchest()
	--teleport(-277, -446, 39)
	local tablechest = {}
	local objectList = CObjectList();
	objectList:update();
	local objSize = objectList:size()
	for i = 0,objSize do
		local obj = objectList:getObject(i);
		if obj.Id == 123536 then
			--pawn = CPawn(obj.Address)
			obj.distance = distance(obj,player)
			--logInfo("secret2","{X= "..pawn.X..", Z="..pawn.Z.."},")
			table.insert(tablechest, table.copy(obj))
		end
	end
	-- sort by distance
	local function distancesortfunc(a,b)
		return b.distance > a.distance
	end
	table.sort(tablechest, distancesortfunc)
	local count = 0
	for i = 1, #tablechest do
		print(tablechest[i].distance)
		if not RoMScript("TimeKeeperFrame:IsVisible()") then break end
		teleport(tablechest[i].X,tablechest[i].Z,tablechest[i].Y)
		--player:moveTo(CWaypoint(tablechest[i].X,tablechest[i].Z),true)
		--keyboardPress( settings.hotkeys.MOVE_FORWARD.key )
		repeat
			print("targeting")
			player:target(tablechest[i].Address)
			yrest(100)
			Attack()
			yrest(300)
			player:updateCasting()
			yrest(200)
		until player.Casting
		yrest(500)
		count = count + 1
	end
	print(count)
end
then timer has ended and you can just go get last 6 chests.

Re: Secret Garden Ideas

Posted: Mon Mar 24, 2014 10:28 pm
by ZZZZZ
You can stand between 2 chests and reach them both but not 4. I have found that if you follow that orange line along to the end looting the 2 on either side of you as you go, then go across to the next line to the left and start heading back towards the beginning you can get the most.

The 6 chests they are talking about are the 6 that finish the rectangle. There are 6 in the north of that image that complete the corner, those 6 do NOT disappear when the 1 min timer is finished, meaning you can leave those until after timer is done to loot.

Re: Secret Garden Ideas

Posted: Mon Mar 24, 2014 10:31 pm
by lisa
yeah just tested and u cant get all 4 from 1 spot, takes a slight movement but being slight you "could" be just off centre and get 2 then do a small move to other side of centre and do other 2, its a very small movement.

Re: Secret Garden Ideas

Posted: Mon Mar 24, 2014 10:42 pm
by ninjazero
The last 6 chests that should be looted are at:
-25 224 19
11 190 15
-60 188 17
47 155 15
-24 154 17
-95 152 17

The path I've been following is attached, from the start it lines up the most chests in a straight line and will likely finish near the back.