Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Programming
You last visited: Today at 07:27

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Question] House Permit Bot (AutoIt3)

Discussion on [Question] House Permit Bot (AutoIt3) within the CO2 Programming forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
clintonselke's Avatar
 
elite*gold: 0
Join Date: Feb 2007
Posts: 348
Received Thanks: 2,175
[Question] House Permit Bot (AutoIt3)

Ok people, I'm attempting a rather crazy project.

I'm building a bot in AutoIt that will do the House Permit Quest while i'm sleeping. This bot navigates its way through other obstacles and players standing/sitting/dancing all over the place. So far I have managed the following:

(Alt+1): Going from the entry point in twin city over to the pharmacist, and buys two tc scrolls.

(Alt+2): Going from the pharmacist over to the conductress and teleporting into the markets.

(Alt+3): Going from the entry point of the markets over to the craftsman. (But not yet trading ore, i'm gonna work on that.)

(Alt+4): Going from the entry point in twin city over to the mine cave. (But not yet entering the mine cave.)

These Alt-shortcuts are just there for the time being so i can debug each sub-part of the quest. At the moment these parts seem to get past people very good, stay on track with the waypoints, and put itself in the correct position to talk to the next NPC.

However there is one teeny tiny little problem.... The BLOODY ASSISTANT WONT LET ME IN W/O ANSWERING HIS RIDDLE!!!.

So... I need to find a way to detect the correct answer to his riddle. I thought about using the _ImageSearch() add-on to autoit, to search a transparent bitmap of all possible correct answers and picking it. But _ImageSeach() does not work with the conquer screen (maybe because it is using a DirectX drawing surface, rather than GDI surface or something like that). And I thought about another tool PixelChecksum(), i could create a checksum for all the correct answers, then scan for the checksum for each possible answer and compare it to correct ones. But i ran into another problem there, the black-box containing the text is semi-transparent, which means a correct answer would have a different checksum in each of the 4 locations. Which means i would have to keep talking to that guy until all possible correct answers have occurred in each of the 4 possible locations to develop the checksums, and thats gonna take forever and a day.

There must be an easier way to auto-{get into that mine cave form outside the thing}.

Does anyone have some ideas or tips on that??, Using Memory reading or some hack possibly?

Attach I have my current source code for anybody interested.

Steps for using it are as follows:

Step 1: Run your conquer client @ full-screen 1024x768 and log in ur character.

Step 2: Run the house permit bot with AutoIt3.

Step 3: Find an empty location with no players, monsters or obsticles, and also away from the corners of the map. Then Press Alt+L, and wait for the bot to finish learning how to transform screen coordinates into map coordinates and visa versa.

Step 4: Use a twin city scroll to have a good starting point.

Step 5: Press Alt+p to strink that ToolTip in the top left, so that the bot can answer NPCs w/o clicking the ToolTip.

Step 6: Try out Alt+1, the bot should buy two tc scrolls.

Step 7: Alt+2, the bot should make its way into the markets.

Step 8: Alt+3, the bot should make its way to the craftsman.

Step 9: Use a tc scroll

Step 10: Alt+4, the bot should make its way to just outside the mine cave... grrr.

Thanks for reading. I really appreciate it
Attached Files
File Type: zip house-permit-bot.zip (6.0 KB, 107 views)
clintonselke is offline  
Thanks
2 Users
Old 04/22/2009, 16:45   #2
 
elite*gold: 12
Join Date: Mar 2009
Posts: 383
Received Thanks: 1,317
Hi there!
It is possible with Memory Reading,but unfortunately I do not know how.
But there is a simple way to enter mine cave,I think Azthoras have posted it.
Spam answers at his questions and check after each spam a pixel that it changes color.
Example: Check if the pixel at 740,560 changes color after you have selected the answer.
So... it will do the following:

1.After the character is outside mine cave,
2.Get the color of an pixel(exapmple 740,560).
3.Then click at the NPC,
4.Click at one of the answers
5.And check if the color of that pixel we selected(740,560) has changed or no.
6.If it has changed means that you are inside mine cave(then start mining! ),
7.if not you are still out...
so continue answer his stupid questions until you get in.

Tell me what you think,
Alexios.
Alexios is offline  
Thanks
2 Users
Old 04/22/2009, 17:01   #3
 
clintonselke's Avatar
 
elite*gold: 0
Join Date: Feb 2007
Posts: 348
Received Thanks: 2,175
Quote:
Originally Posted by Alexios View Post
Hi there!
It is possible with Memory Reading,but unfortunately I do not know how.
But there is a simple way to enter mine cave,I think Azthoras have posted it.
Spam answers at his questions and check after each spam a pixel that it changes color.
Example: Check if the pixel at 740,560 changes color after you have selected the answer.
So... it will do the following:
After the character is outside mine cave, get the color of an pixel(exapmple 740,560).
The click at the NPC, click at one of the answers and checks if the color of that pixel we selected(740,560) has changed or no.
If it has changed means that you are inside mine cave, if not you are still out...
so continue answer his stupid questions until you get in.

Tell me what you think,
Alexios.
Thats not a bad idea. The chances of randomly selecting a correct answer are 1 in 4, so on average i would enter the mine cave in 4 attempts. This isn't so bad since it does not take long to answer him. Other parts of the quest (the mining) take much longer.

Thanks Alexios.

As for memory reading, I use something like this in autoit for the map coordinates.

PHP Code:
$PID ProcessExists("Conquer.exe")
If 
$PID == 0 Then
    MsgBox
(0"Error""Conquer must be running first.")
    Exit
EndIf
$MemID _MemoryOpen($PID)
. . .
    
$XCoordinate _MemoryRead($XCoordinateAddress$MemID)
    
$YCoordinate _MemoryRead($YCoordinateAddress$MemID
The functions _MemoryOpen() and _MemoryRead() are from NomadMemory.au3 included in the zip.

And the memory addresses ($XCoordinateAddress, $YCoordinateAddress), can be obtained from a program like CheatEngine.

As for the answers to the mine-cave, I'm really not sure how to get the address of it from CheatEngine.

I'm gonna use ur method if no-one finds it. Thanks.
clintonselke is offline  
Old 04/22/2009, 18:01   #4
 
elite*gold: 20
Join Date: Aug 2007
Posts: 1,749
Received Thanks: 2,198


You could use my example from that thread .
IAmHawtness is offline  
Thanks
1 User
Old 04/23/2009, 11:07   #5
 
clintonselke's Avatar
 
elite*gold: 0
Join Date: Feb 2007
Posts: 348
Received Thanks: 2,175
Quote:
Originally Posted by IAmHawtness View Post


You could use my example from that thread .
Wow, that actually worked, i can't believe it.

I don't mind if the address keeps changing each time i run co, can configure that when first running the bot each time np at all.

I now have something to play with.

Thanks

Edit: It now enters the mines , finally in. I'll submit an update to the code when its all fully working. I think next im gonna leave the timber on the character until they have enough for a rosewood voucher, then i will make the char put rosewood vouchers in the wh on the way back. So if a pker comes, then i will only lose ore and less than 10 wood.

24 slots in an inventory and 50 rosewoods to make a house. After getting 10 rosewood in the inventory, i made have to add to the code so the bot takes it out and trades it for a timber voucher and puts that back. Alot more work to do.

PHP Code:
Global Const $REPLY_COORDS[4][2] = [[310,116],[573,113],[360,134],[592,133]]
Global Const 
$REPLY_ADDRESS[4] = [0x01D3DFBC0x01D3E0F4,0x01D3E22C,0x01D3E364]
Global Const 
$CORRECT_REPLY[8] = ["A good beginning makes a good ending.","Caution is the parent of safety.","Custom is a second nature.","Fire and water have no mercy.","Far water does not put out near fire.","Great men`s sons seldom do well.","Greedy folks have long arms.","Don`t put the cart before the horse.""God helps those who help themselves."]

Func AnswerMineQuestion()
    For 
$i 0 to UBound($REPLY_ADDRESS)-1
        $Reply 
ReadMemoryString($REPLY_ADDRESS[$i])
        For 
$j 0 to UBound($CORRECT_REPLY)-1
            
If $Reply == $CORRECT_REPLY[$jThen
                MouseClick
("left"$REPLY_COORDS[$i][0], $REPLY_COORDS[$i][1])
                Return
            EndIf
        
Next
    Next
    MsgBox
(0"Error""Could not answer the Mine Question.")
    Exit(
1)
EndFunc

Func ReadMemoryString
($Address)
    
$Str ""
    
$A _MemoryRead($Address$MemID"char")
    While 
Asc($A) <> 0
        $Str 
$Str $A
        $Address 
$Address 1
        $A 
_MemoryRead($Address$MemID"char")
    
Wend
    
Return $Str
EndFunc 
clintonselke is offline  
Old 04/23/2009, 17:35   #6
 
elite*gold: 20
Join Date: Aug 2007
Posts: 1,749
Received Thanks: 2,198
Quote:
Originally Posted by clintonselke View Post
Wow, that actually worked, i can't believe it.

I don't mind if the address keeps changing each time i run co, can configure that when first running the bot each time np at all.

I now have something to play with.

Thanks

Edit: It now enters the mines , finally in. I'll submit an update to the code when its all fully working. I think next im gonna leave the timber on the character until they have enough for a rosewood voucher, then i will make the char put rosewood vouchers in the wh on the way back. So if a pker comes, then i will only lose ore and less than 10 wood.

24 slots in an inventory and 50 rosewoods to make a house. After getting 10 rosewood in the inventory, i made have to add to the code so the bot takes it out and trades it for a timber voucher and puts that back. Alot more work to do.
Wow, you're one of the few that actually understands something!
Your coding is really nice also. But about the memory addresses of the answers, you would have to do some assembly work to make the addreses static, luckily there's lots of people here who knows how to do that .
IAmHawtness is offline  
Old 04/24/2009, 02:48   #7
 
clintonselke's Avatar
 
elite*gold: 0
Join Date: Feb 2007
Posts: 348
Received Thanks: 2,175
Quote:
Originally Posted by IAmHawtness View Post
Wow, you're one of the few that actually understands something!
Your coding is really nice also. But about the memory addresses of the answers, you would have to do some assembly work to make the addreses static, luckily there's lots of people here who knows how to do that .
Thats probably true, dynamic memory allocation for the strings. But i'm not so sure yet, the address for the map coordinates seems to be static, i have tested it a lot with many runs on different computers. And the strings at the moment appear to be static, but not 100% confident about that. When i run it many times last night all same addresses, when i run it this morning the addresses unchanged, but i have no tested this on other computers.

I do know some assembly language, mostly 16-bit 8086, w/ the registers AX,BX, etc. 16-bit registers, however I'm not very familiar with the newer 32-bit (i was learning it when only 16-bit around, but not 32 lol). But from what i can see in ollydbg, they now use 32-bit registers EAX, EBX, and i think they have some additional registers for float point arithmetic. I really should read up on it

Of course if there was an update from TQ that patches the Conquer.exe, then all the static addresses would change.

Handsdown to all that can garentee something static
clintonselke is offline  
Old 04/24/2009, 02:54   #8
 
hok30's Avatar
 
elite*gold: 0
Join Date: Feb 2007
Posts: 1,366
Received Thanks: 256
Looks like an interesting project. I'm going to look into it when I have a little more time. Is the script included by any chance?

Also, is it just like point and click, not any pixelfinding or anything when the character is moving? Because, the bot could glitch and click on a player and that would screw up the whole macro.
hok30 is offline  
Old 04/24/2009, 04:30   #9
 
clintonselke's Avatar
 
elite*gold: 0
Join Date: Feb 2007
Posts: 348
Received Thanks: 2,175
Quote:
Originally Posted by hok30 View Post
Looks like an interesting project. I'm going to look into it when I have a little more time. Is the script included by any chance?

Also, is it just like point and click, not any pixelfinding or anything when the character is moving? Because, the bot could glitch and click on a player and that would screw up the whole macro.
Yea, its all only script, i wont compile it to .exe, had so many going "someone scan it plz", "someone scan it plz", in my other posts. I think more people are comfortable with just the source, at least for the "Programming" section, the other sections i would release executables. If ya want to test it, u use AutoIt3 to run the script, remember to follow the instructions in the first post. Alt+L for learning mode (it solves the matrix for converting mouse<-->map coords), and I also added a Alt+A which when the Assistant asks the questions outside the mine (after clicking to reach the four possible answers) it fires a function that will answer his question.

For anyone interested in the conversion of screen/mouse coordinates into map coordinates, see the following link:


Its memory read for the current player location, and it makes use of matrix math for converting mouse coordinates into map coordinates and visa versa. It works by using waypoints (a collection of map coordinates), and it adds some randomness to each jump to help avoid obstacles. No pixel scanning, just memory reading and linear equations.

Update: I made it all the way to the mine cave and back to tc now Alt+1, and from the markets it now jumps all the way to the craftsman and trades all the ore for timber vouchers Alt+3

Note: Not fully complete yet, give me some time to work on it. But it is looking very promising. I do have some problem when multiple players are in the way, but i think i just need to increase the randomness in each jump to avoid them.

Attached is the updated code:

takes me so long to debug it lol... mining is so slow.

Also one of the questions asked by the Assistant just outside the mines, one question is too long "Good helps those who help themselves." i think that one, it has different coordinates for clicking the answers, bcuz the answers take up 2 lines, not one. I'll fix it soon... just give it time

When im fully done, i will put all the Alt macros 1,2,3,4,5,etc. in a loop and have them trigger one after the other indefinitely. This will make the script perform the entire house permit quest.

Off Topic: umm... RandyRun, what that??, is that allowed in wow? lol
Attached Files
File Type: zip house-permit-bot-24-04-09.zip (6.7 KB, 16 views)
clintonselke is offline  
Old 04/24/2009, 06:39   #10
 
clintonselke's Avatar
 
elite*gold: 0
Join Date: Feb 2007
Posts: 348
Received Thanks: 2,175
OK.

I'm now up to the stage where i can get the autoit bot to produce Rosewood Vouchers w/o me helping it along. It buys scrolls from tc, it goes to the mine, it mines until full inventory, it goes from tc to markets, it goes and trades for wood, it goes and trades for rosewood. OK very good so far.

One thing is troubling me though.... those s2pid PKers in the mines. I just can't leave Rosewood Voucher laying around in my inventory (I wish i could, then i would be finished this bot).

Plan of attack:
- Determine a way to find out which items are rose wood in my inventory.
- Get the bot to put Rosewoods in the twin city warehouse.
- Get the bot to scan the twin city warehouse for 10 rosewood.
--> If there are 10, then make the bot go off to the markets to turn it into a timber voucher. And put the timber voucher in the twin city warehouse.
--> If not, leave them in the twin city wear house.
- Then Done ... get the bot to loop over and over.

Problems:
- Timber Vouchers look just like Rosewood Vouchers.
- Can not reliably determine an item just by reading pixels, other items can contain same pixel colours.

I wonder though, does anyone know how to memory read the inventory?

Then i can just make use of ItemIDs which are more reliable.

Thanks
clintonselke is offline  
Old 04/24/2009, 10:39   #11
 
elite*gold: 12
Join Date: Mar 2009
Posts: 383
Received Thanks: 1,317
Quote:
Originally Posted by clintonselke View Post
I'm now up to the stage where i can get the autoit bot to produce Rosewood Vouchers w/o me helping it along. It buys scrolls from tc, it goes to the mine, it mines until full inventory, it goes from tc to markets, it goes and trades for wood, it goes and trades for rosewood. OK very good so far.
NOTE: If you found a way to do it with memory address, don't read the post. It will be just a waste of time.

I have understand that CO will be on top,if not then do not even read this post... it will be a waste of time.

After you have done all these steps, you want to put the rosewoods at the warehouse,right?
If yes,then couldn't you just click at rosewood(which will be the last item in the inventory(if I am not wrong)) and put it at warehouse?

*Are you stupid!? I just said that Timber and Rosewood look same!! How will I know if I have gotten Rosewood or not?*

If the above statement is true
Quote:
rosewood(which will be the last item in the inventory
(when you trade Timber for Rosewood, if the rosewood appears the last item in your inventory, then you could think think think and not find a way... but here I am,I say it in words and you translate in Programming:

If the rosewood that you get is the last item in the inventory, before you trade Timber for Rosewood, check each slot of your inventory to see what it has, ore(do not forget the euxenites and gold ores)/timber or scoll. Caclulate how many Timbers you have. After that trade as many Timbers you can for rosewoods(which will be the last item at your inventory). So you now know how many rosewoods you have because if you traded 10T you got 1R, 20T -> 2R, etc...
Then go at warehouse and put the rosewoods in it

Note: I think there is a faster way,but I got bored of thinking (that's my weakness I think).

Else
I have noticed in some trades with NPCs that the item they give you goes at the slot that was the first item you gave them.


Example:
You have at slots 5,8,10,15,24 the items you want to give at NPC.
You trade the items for another item(let's name is B).
And B appears at 5th slot.


If you got it from now,don't read the below...
So now you will check how many timbers you have at your inventory. If you have more than 9, then look which is the first slot that a timber is. Trade the timbers for a rosewood. Then if you had more than 19 timbers before the trade, look which is the second slot(second slot because rosewoods and timbers look the same,right?) that a timber is. Trade the timbers for a rosewood and keep going...
After you have gotten as many rosewoods you can, go at warehouse and save them.

I hope it helps,
Sorry if that post has any mistakes(mostly at typing, at grammar I am almost sure that it has ) and if it was I dk, retarded(I do not know what excacly means) or something.
Tell me if the post is something... and if it helped you
Alexios is offline  
Old 04/24/2009, 18:45   #12
 
clintonselke's Avatar
 
elite*gold: 0
Join Date: Feb 2007
Posts: 348
Received Thanks: 2,175
Sorry for the late reply, taking a break from coding.

I'm gonna try that out... but I also want to experiment w/ hooking the conquer jump() function, so that i can garentee that no noob piles can block the waypoints off... like it will jump on-top of noobs that are in the way.

Give me a little time
clintonselke is offline  
Old 04/24/2009, 19:23   #13
 
elite*gold: 12
Join Date: Mar 2009
Posts: 383
Received Thanks: 1,317
ok. btw in Twin City, instead of trying to find somewhere that there is not players to jump, you can click at Path-Finding to go at Pharmacist and Conductress and Warehouseman!
Also something that could use to travel inside market without problem too
Alexios is offline  
Thanks
1 User
Old 04/24/2009, 19:30   #14
 
clintonselke's Avatar
 
elite*gold: 0
Join Date: Feb 2007
Posts: 348
Received Thanks: 2,175
Quote:
Originally Posted by Alexios View Post
ok. btw in Twin City, instead of trying to find somewhere that there is not players to jump, you can click at Path-Finding to go at Pharmacist and Conductress and Warehouseman!
Also something that could use to travel inside market without problem too
Oh... nice nice nice .... ty again
clintonselke is offline  
Old 04/25/2009, 01:41   #15
 
elite*gold: 0
Join Date: Sep 2008
Posts: 490
Received Thanks: 595
Quote:
Originally Posted by clintonselke View Post
Sorry for the late reply, taking a break from coding.

I'm gonna try that out... but I also want to experiment w/ hooking the conquer jump() function, so that i can garentee that no noob piles can block the waypoints off... like it will jump on-top of noobs that are in the way.

Give me a little time
Some more info about hooking to jump function, when doing so you will get the "cant jump to this coordinate" message when someone stands on the coordinate you're trying to jump too.
So it aint that failsafe either, course you could add a rand() of 1-2 to each coordinate. anyway thought id share.
But eitherway dont think with autoit u can hook to a function, proof me wrong
_fobos_ is offline  
Reply


Similar Threads Similar Threads
[help]making house permit and upgrade cert undroppable
06/06/2009 - CO2 Private Server - 2 Replies
Hi what I made a little house code nothing much. Might actually make the whole proccess like the vouchers and stuff but what I need now is how to make a house permit and upgrade certificate undroppable and untradable. Thanks,
Question about house item box
04/30/2008 - Conquer Online 2 - 2 Replies
Ok, so we all now know we need to be trade partner to get things out of wifes house. I got a chance at 550m right now if I can by this. I dont know if I can remain with this same partner for 72 hrs (its just an exp thing). Anyway is this a client side thing telling me I cant do it meaning if I revert to an older version stop the AP and login in can I access it or is this codded into the sever? If so somone please help me get by it!
house permit cost
01/02/2008 - Conquer Online 2 - 1 Replies
hey guys, I'm playing this game after a year's break now so i don't know the prices of many things so..... I wanted to know the average prices of house permits in the venus server. If anyone knows, please tell me. thnx Akshay
house permit again
08/01/2007 - Conquer Online 2 - 6 Replies
wondering how much a house permit cocts in the market, any server, i dont really care, and do u think its worth it to go for 62.5 trips?
a house permit
08/01/2007 - Conquer Online 2 - 7 Replies
Anyone know how many ores needs to get house permit? I calculate it is 2500 ores.



All times are GMT +2. The time now is 07:27.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.