Page 2 of 6

Re: Andor Trainig Range

Posted: Thu Nov 08, 2012 7:20 am
by lisa
Ballerlocke wrote:can you make a file with a complete script for download
me?

nope, I don't have the time for it.

That function is pretty much just the missing piece of the puzzle, someone else should be able to make up a WP without to much hassle that will do the entire event.
Just look at the minigame WP's like AT or survival as an example, you could even just use the WP posted by someone earlier and get it to call the function after it wakes up instead of the code it currently does.

So many ways to do it, have fun.

--=== Added ===--
A little extra info for anyone looking at coding this event.

You get buffs for the extra skills.

I also suspect that the pawnAttackable_offset is where you will find a bit value for if it has already been hit by the skill.

using this will get printouts of that 4byte in memory.

Code: Select all

function tort()
	local proc = getProc()
	local function bitvalues()
		filename = getExecutionPath() .. "/logs/tortlog.txt";
		file, err = io.open(filename, "a+");
		if( not file ) then
			error(err, 0);
		end
		
		local objectList = CObjectList();
		objectList:update();
		local objSize = objectList:size()
		for i = 0,objSize do 
			obj = objectList:getObject(i)
			if obj.Id == 106881 then
				local flags = memoryReadRepeat("int", proc, obj.Address + 0x388) or 0;
				local bitnum=0x80000000
				local bitstring=""
				if bitAnd(flags,0x80000000) then
					file:write("Bits,1,")
				else
					file:write("Bits,0,")
				end
		
				repeat
					bitnum = bitnum / 2
					if bitAnd(flags,bitnum) then
						bitstring = bitstring .. "1,"
					else
						bitstring = bitstring .. "0,"
					end
				until bitnum == 1
				file:write(bitstring.."\n")
			end
		end
		file:close()
	end
	
	local function one(ID)
		if ID == 106881 then bitvalues() end
		local objectList = CObjectList();
		objectList:update();
		local objSize = objectList:size()
		for i = 0,objSize do 
			obj = objectList:getObject(i)
			if obj.Id == ID or ID == 106885 then
				print(obj.Name)
				player:target(obj)
				RoMScript("UseExtraAction(1)")
				yrest(10)
				player:target(obj)
				RoMScript("UseExtraAction(1)")
				if ID == 106883 then
					yrest(10)
					player:target(obj)
					RoMScript("UseExtraAction(1)")	
				end
				yrest(20)
			end
		end
	end
	one(106882)
	one(106882)	
	one(106881)
	one(106883)
	one(106884)	
end

then just open up the txt file in logs/tortlog.txt and see if there are any differences in the prints.

Re: Andor Trainig Range

Posted: Thu Nov 08, 2012 10:33 pm
by lisa
Ok this function easily scores 4000+ and you don't actually get any exciting items, loot seems same as scoring 1800ish.
I would strongly sugguest stopping the script before 2000, any score over 2500 is basically labelling yourself as a botter.

Who ever is going to code this up you can do a score check, it is actually a buff that keeps track of the score, even though you don't see an icon on screen.

Code: Select all

        Name:   Points
        Id:     622402
        Level:  4122
        TimeLeft:       619.54425048828
        Count:  1
there is also a buff for keeping track of how many "mobs" are allowed past the line. Level is how many can go past before it stops, so if it says Level 4 that means 4 mobs can go past line before event stops.

Code: Select all

        Name:   Allowed targets that crossed the line
        Id:     622576
        Level:  4
        TimeLeft:       562.76159667969
        Count:  1
Another buff is the aoe that blows up everything, level is how many "charges" you have for the skill.

Code: Select all

        Name:   Remaining shots of Blasting Fireball
        Id:     622646
        Level:  7
        TimeLeft:       565.95989990234
        Count:  1

Code: Select all

function tort(score)
	local proc = getProc()
	
	local function checkclicked(address)
		local tmp = memoryReadRepeat("int", getProc(), address + addresses.pawnAttackable_offset) or 0;
		if bitAnd(tmp,0x8) then
			return true
		else
			return false
		end
	end

	local function one(ID)
		local objectList = CObjectList();
		objectList:update();
		local objSize = objectList:size()
		for i = 0,objSize do 
			obj = objectList:getObject(i)

			if (obj.Id == ID or ID == 106885) and checkclicked(obj.Address) then
				print(obj.Name)
				player:target(obj)
				RoMScript("UseExtraAction(1)")
				yrest(10)
				player:target(obj)
				RoMScript("UseExtraAction(1)")
				if ID == 106883 then
					yrest(10)
					player:target(obj)
					RoMScript("UseExtraAction(1)")	
				end
				yrest(20)
			end
		end
	end
	if score then
		one(106882)
		one(106882)
		one(106884)		
		one(106881)
		one(106883)
	else
		one(106882)
		one(106882)
		one(106881)
		one(106883)
		one(106884)	
	end
end
If you have argument 1 as true it will do
newts --> rabbits --> tortiouse --> armored

If no argument then it will do
newts --> tortiouse --> rabbits --> armored

In the first 5 rounds you can easily use the arg as true and it gets a very nice score without to many crossing the line, occasionally it doesn't click one of them.

That is all the time I have to spend on it, have fun.

For those wishing to use it before anyone actually builds a WP.

1. Save the code to a userfunction file
2. Enter the instance
3. start bot with "rom/bot path:commandline"
4. start the event
5. When it says Go!!!! wait 1 second
6. type "tort()" in the commandline on MM

repeat steps 5 and 6 until ur happy with score or the event ends.

So yes this is me saying cya to this topic, good luck =)

Re: Andor Trainig Range

Posted: Fri Nov 09, 2012 3:49 pm
by nightclaw
lisa wrote:Ok this function just scored 1900 and got to round 13, I just call it when it says go.

Code: Select all

function tort()
	
	local function one(ID)
		local objectList = CObjectList();
		objectList:update();
		local objSize = objectList:size()
		for i = 0,objSize do 
			obj = objectList:getObject(i)
			if obj.Id == ID or ID == 106885 then
				print(obj.Name)
				player:target(obj)
				RoMScript("UseExtraAction(1)")
				yrest(10)
				player:target(obj)
				RoMScript("UseExtraAction(1)")
				if ID == 106883 then
					yrest(10)
					player:target(obj)
					RoMScript("UseExtraAction(1)")	
				end
				yrest(20)
			end
		end
	end
	one(106882)
	one(106882)	
	one(106881)
	one(106883)
	one(106884)	
end

It does do some "casts" to turtles that have already dissappeared but it is fast enough to just keep up. There is probably an indicator that the "mob" has already been cast on and is in the process of dissappearing.

So what do i need or put it at to make it work like you did ?

Re: Andor Trainig Range

Posted: Fri Nov 09, 2012 3:57 pm
by nightclaw
thax

Re: Andor Trainig Range

Posted: Fri Nov 09, 2012 4:13 pm
by nightclaw
i did
1. Save the code to a userfunction file
2. Enter the instance
3. start bot with "rom/bot path:commandline"
4. start the event
5. When it says Go!!!! wait 1 second
6. type "tort()" in the commandline on MM

repeat steps 5 and 6 until ur happy with score or the event ends.
but when i did rom/bot path:commandline its askes 4 a way point what do i put in ??

i tryed with out 1 but it did not work

Re: Andor Trainig Range

Posted: Fri Nov 09, 2012 5:25 pm
by dejfit
Did you use this file "StartCommandLine.bat"?

Re: Andor Trainig Range

Posted: Fri Nov 09, 2012 5:48 pm
by lisa
dejfit wrote:Did you use this file "StartCommandLine.bat"?
I forgot about the .bat file,
you can replace steps 1,2,3 with just executing the StartCommandLine.bat =)

Re: Andor Trainig Range

Posted: Fri Nov 09, 2012 6:18 pm
by dejfit
Someone knows what to do to get 2 or 3 packages as a reward?

Re: Andor Trainig Range

Posted: Fri Nov 09, 2012 6:32 pm
by dr-nuker
dejfit wrote:Someone knows what to do to get 2 or 3 packages as a reward?
I always just get some of the Certificates. For me it feels like a higher score gives more certivicates, Its the same with the rubies. If I score low its only a handcrafted rubypack. On very good runs i get 5 of teardrop rubies...

Too bad my guild just managed to build stonewalls. Now every guild will get them with a twinkle of an eye...

Re: Andor Trainig Range

Posted: Fri Nov 09, 2012 6:34 pm
by lisa
I let it run to 3000-3100 for 5 or 6 chars yesterday and it appeared to get 2 packages each time but when I was scoring in the 4000+ I was only getting 1
*shrug*
I just figured it was random.
Too bad my guild just managed to build stonewalls. Now every guild will get them with a twinkle of an eye...
The walls cost 145000 (roughly) rubies, so even if everyone manages to get 500 each character it will still take a while to get the walls just by doing the event.

Re: Andor Trainig Range

Posted: Fri Nov 09, 2012 7:20 pm
by dejfit
Lisa is there any chance to start Your script when animals start to move?
Someting like:

Code: Select all

repeat
yrest(1000);
until "Go!" shows in the middle of a the screen
and then 
tort()

Re: Andor Trainig Range

Posted: Fri Nov 09, 2012 7:54 pm
by nightclaw
ok i type in rom/bot StartCommandLine.bat
and choice my char and i get this next??
Image

what did i do wrong??

Re: Andor Trainig Range

Posted: Fri Nov 09, 2012 8:51 pm
by lisa
looks like the waypoint is missing, which is wierd.
your waypoints folder should have the files in this pic that have a green tick.
wp1.jpg
I would suguest maybe doing a right click on that folder and do SVN revert.

Re: Andor Trainig Range

Posted: Fri Nov 09, 2012 8:54 pm
by nightclaw
that would be it i dont have that file i geting it now super thax

Re: Andor Trainig Range

Posted: Fri Nov 09, 2012 9:24 pm
by nightclaw
okay so i got it running and working runs great but crashes here and there. how do we fix?
we did the arena and it crashed. we did the time and it didnt crash. it seems that we get rubies from the arena. does this only work for the time? what way could we get it to work with the arena if this is just for time?

Re: Andor Trainig Range

Posted: Fri Nov 09, 2012 10:18 pm
by lisa
I've used it in both arena and times and works fine, not sure why it would crash for you.

Re: Andor Trainig Range

Posted: Fri Nov 09, 2012 10:23 pm
by nightclaw
okay

Re: Andor Trainig Range

Posted: Fri Nov 09, 2012 11:38 pm
by lisa
dejfit wrote:Lisa is there any chance to start Your script when animals start to move?
Someting like:

Code: Select all

repeat
yrest(1000);
until "Go!" shows in the middle of a the screen
and then 
tort()
Sorry I missed this post earlier, of course it can be done but you will need to work out what "type" of message the Go!! actually is. Use the chat monitoring system that already exists in rombot and there you go =)

Tricky bit is working out what type of message it is though.

Re: Andor Trainig Range

Posted: Sat Nov 10, 2012 5:23 am
by dr-nuker
Is there a way to check the size of the table?

To me as non-programmer this whole script looks kinda cryptic.
All i can do is: open a loop, find all targets, end the loop and shoot them.
But your code is way superior.

So i would like to do as follows, since i never worked with the chat monitoring system:
Loop the function that finds all objects on the field until it has at least 45 targets in.
Pick one of them and watch it`s position. If it moves you can fire.
Then go back to finding all objects and fireing until there are no targets anymore.
Then start over again.

I guess this code would kinda slow everything down but since reaching points higher than 4000 is suspicious anyways I would not mind to fail at that point ;)

Br,
nuker

Re: Andor Trainig Range

Posted: Sat Nov 10, 2012 5:36 am
by lisa
This is what I was using, I have of course improved it since then but this is what I am going to share, see if you can improve it ;)

Code: Select all

			function tort()
				local proc = getProc()
				
				local function checkclicked(address)
					local tmp = memoryReadRepeat("int", proc, address + addresses.pawnAttackable_offset) or 0;
					if bitAnd(tmp,0x8) then
						return true
					else
						return false
					end
				end

				local function one(ID)
					print("targeting: "..ID)
					local objectList = CObjectList();
					objectList:update();
					local objSize = objectList:size()
					for i = 0,objSize do 
						obj = objectList:getObject(i)

						if (obj.Id == ID or ID == 106885) and checkclicked(obj.Address) then
							player:target(obj)
							RoMScript("UseExtraAction(1)")
							yrest(10)
							player:target(obj)
							RoMScript("UseExtraAction(1)")
							if ID == 106883 then
								yrest(10)
								player:target(obj)
								RoMScript("UseExtraAction(1)")	
							end
							yrest(100)
						end
					end
				end
				if player:findNearestNameOrId(106881) then
					local countt = 12
					print("resting a little before attacking, countdown starts now.")
					repeat
						print(countt)
						yrest(1000)
						countt = countt -1
					until countt == 0
					for i = 1,6 do
						one(106882)
						one(106882)
						one(106881)
						one(106883)
						one(106884)	
					end
				end
			end
			
			repeat
				yrest(100)
			until  player:findNearestNameOrId(106881)
			print("OK event has started")
			repeat
				tort()
				player:update()
				buffed = player:getBuff(622402)
				yrest(100)
			until buffed.Level >= 2800 or not player:hasBuff(622402)
			print("Event finished, end score was "..buffed.Level)