Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Mabinogi > Mabinogi Hacks, Bots, Cheats & Exploits
You last visited: Today at 01:09

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

Advertisement



[Guide] Scripted Health Check.

Discussion on [Guide] Scripted Health Check. within the Mabinogi Hacks, Bots, Cheats & Exploits forum part of the Mabinogi category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Dec 2009
Posts: 395
Received Thanks: 94
[Guide] Scripted Health Check.

Didn't realize there was now a sub-forum, suppose this is in the wrong spot then, oh well.

This is written for AutoIt. Something similar would also work in AutoHotKey.

It's also not much of a tutorial, the code is short and straight forward. If you can get something out of it, great. This is more or less an example of something you can do that's pretty easy but useful.

Below I break it up into three sections with comments for pretty much everything, at the bottom is the code without any comments at all.

This only works on character with less than 100 health. If over 100 health you would have to increase $lifebar[0] and change the "36" at the bottom if you want to test this on a character with over 100 health.

Lets declare variables.

Code:
;Declare our variables, we'll put them into global scope.

Global $colorhex,$variation,$percent,$lifebar[3]

;The hex code of the pixel color we're search for.

$colorhex = 0xCD398D

;x coord start of life bar.  I'm pretty sure it really starts at 162 on my screen.
;Hower we dont start searching till after the health text, in this example we're
;starting at x coord 198, this will vary if your health is higher than the character
;I used in this example.

$lifebar[0] = 198

;Y coord of life bar.

$lifebar[1] = 736 

;X coord end of life bar. Not the actual end which is more like 262. 258 is the last pixel that can max our $colorhex.

$lifebar[2] = 258

;How much variation to use in PixelSearch, we want no variation so we set to 0.

$variation = 0
Now lets switch to our game, pause a second and then we'll call our function to check health. After we check our health bar it pops up a message box stating your health percent. Its not totally accurate but its close enough in this given example.

Code:
;Switch to your game screen.

WinActivate("Mabinogi : Dragon")

;x.X

sleep(2000)

;Call our function.

_lifecheck()

;Just a little msg box displaying your health percent, - 1% in my limited testing.

msgbox(0,"Health Percent",$percent)
And now the function itself.

Code:
;Start of our function code.
Func _lifecheck()
	;Loop our search
	Do
		PixelSearch($lifebar[0],$lifebar[1],$lifebar[0],$lifebar[1],$colorhex,$variation)
		;PixelSearch sets @error so that if @error is defined our pixel wasn't found.
		If Not @error Then
		;Found our $colorhex so we'll increase our X Coord by 1 to search in a line.
		$lifebar[0] +=1
		ElseIf @error Then
		;Our $colorhex was not found which means our health bar is not full.
		EndIf
		;We loop until we don't match our pixel color
		;or we reach the end of the bar.
	Until @error or $lifebar[0] = $lifebar[2]
	If $lifebar[0] = $lifebar[2] Then
		;Health bar was full, give or take. :p
		$percent = 100
	Else
		;Oh noes.
		$percent = 36 + ($lifebar[0]-198)			
		;If our health bar starts at 162 and ends at 262 thats 100 pixels.
		;We start at 198 or 36 pixels in. So that 36 plus the difference between
		;where our search ended minus the starting point equals our percentage.
	EndIf
EndFunc
All together without comments.

Code:
Global $colorhex,$variation,$percent,$lifebar[3]
$colorhex = 0xCD398D
$lifebar[0] = 198
$lifebar[1] = 736 
$lifebar[2] = 258
$variation = 0

WinActivate("Mabinogi : Dragon")
sleep(2000)

_lifecheck()
msgbox(0,"Health Percent",$percent)


Func _lifecheck()
	Do
		PixelSearch($lifebar[0],$lifebar[1],$lifebar[0],$lifebar[1],$colorhex,$variation)
		If Not @error Then
		$lifebar[0] +=1
		ElseIf @error Then
		EndIf
	Until @error or $lifebar[0] = $lifebar[2]
	If $lifebar[0] = $lifebar[2] Then
		$percent = 100
	Else
		$percent = 36 + ($lifebar[0]-198)			
	EndIf
EndFunc
Theri is offline  
Thanks
2 Users
Old 01/05/2010, 20:18   #2
 
pawntobishop's Avatar
 
elite*gold: 0
Join Date: Sep 2009
Posts: 1,317
Received Thanks: 472
Interesting... useful if you want to preserve the life of your bots i suppose.
pawntobishop is offline  
Old 01/05/2010, 20:24   #3
 
elite*gold: 0
Join Date: Dec 2009
Posts: 395
Received Thanks: 94
It has its uses, can be extended to check mana or stamina. There's a faster way to do this than what I posted but if someone was really interested in it they could probably figure it out.
Theri is offline  
Old 02/16/2010, 05:30   #4
 
pawntobishop's Avatar
 
elite*gold: 0
Join Date: Sep 2009
Posts: 1,317
Received Thanks: 472
This is a really cool snippit of code. Bumping.
pawntobishop is offline  
Old 02/17/2010, 00:23   #5
 
elite*gold: 0
Join Date: Dec 2009
Posts: 395
Received Thanks: 94
What are you, a spam bot now?
Theri is offline  
Old 02/17/2010, 03:54   #6
 
pawntobishop's Avatar
 
elite*gold: 0
Join Date: Sep 2009
Posts: 1,317
Received Thanks: 472
I'm not a spam bot, I just feel some valid posts should be on the front page rather then **** thats outdated and full of flames.
pawntobishop is offline  
Old 02/17/2010, 19:30   #7
 
elite*gold: 0
Join Date: Dec 2009
Posts: 395
Received Thanks: 94
I see. Well a better version of this is in my bot functions thread.
Theri is offline  
Old 02/17/2010, 21:27   #8
 
pawntobishop's Avatar
 
elite*gold: 0
Join Date: Sep 2009
Posts: 1,317
Received Thanks: 472
I do enjoy your competence with bots.
pawntobishop is offline  
Old 02/18/2010, 22:54   #9
 
elite*gold: 0
Join Date: Feb 2010
Posts: 49
Received Thanks: 6
I agree with pawntobishop, your bot scripts are pretty beastly.
BamIPwnedYou is offline  
Reply


Similar Threads Similar Threads
[Guide] How to edit ur Pic Health/Magic bar
09/30/2011 - EO PServer Guides & Releases - 38 Replies
This is a Guide For People who know how to edit the client. If you ever wanted to edit your interface you notice that you can edit everything but there is 1 edit doesn't work no matter what u do it is called the MainRoleinfo03.dds. Here is a SS http://i585.photobucket.com/albums/ss297/Undergro undgaming/1.jpg As you can See it is unedited it is Normal unlike the rest in the file so i am gonna edit it. http://i585.photobucket.com/albums/ss297/Undergro undgaming/2.jpg Now you can see that i...
[Guide]How to edit your health/Magicbar from 0 till 100% l
04/24/2009 - EO PServer Guides & Releases - 2 Replies
I amn't Photocopying or anything i am explaining how to edit the client from 0 till 100% there is two ways 1-by the photo shop 2-by Xnview(easy way) i will explain on Xnview it doesnot take alotof steps 1-downlad XnView Download - Softpedia 2-open the program 4shared.com - photo sharing - download image first.JPG 3-open your client from the program then choose data/interface/style01/main 4shared.com - photo sharing - download image second.JPG
Scripted-Network Funserver
10/21/2008 - WoW PServer Exploits, Hacks & Tools - 3 Replies
Scripted-Network Deutscher WoW Server: Zum spielen benötigt ihr The Burning Crusade mit dem Patch 2.4.3. Realms: Blutiger Funserver: >FunServer >1 Player Treff (Neutral) D1-T6 auch (S4) und vieles mehr kaufbar >Levelbergrenzung: 100 >LevelArena 1-40, 40-80, 80-100 >Eigen erstellte Items (Keine übermäigen Waffen max. 100-400 dps)



All times are GMT +2. The time now is 01:11.


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.