AutoIt Math au3 menu

User Tag List

Results 1 to 7 of 7
  1. #1
    swollen's Avatar Member
    Reputation
    36
    Join Date
    May 2007
    Posts
    124
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    AutoIt Math au3

    Thought this may be handy for some others, I use it for bot writing.

    Has two features, _largernumber() and _getdistance(),
    Both can be used in writing a bot with waypoints.

    _largernumber() obviously returns the larger number.
    E.g.
    _largernumber( 231, 342 )
    Would obviously return 342
    Syntax: _largernumber ($number1, $number2)

    _getdistance() calculates the distance between two sets of co-ordinates.
    E.g.

    _getdistance (2341, 2231, 8718, 9182)
    Would return how far it is from 2341, 2231 to 8718, 9182 (Handy for use of waypoints)
    Syntax: _getdistance ($x1, $x2, $y1, $y2)

    Code:
    Code:
    #cs ----------------------------------------------------------------------------
     AutoIt Version: 3.2.10.0
     Author:         Dampe
    
     Script Function: Returns the larger number of 2 givin numbers.
     
    	_largernumber ( $number1, $number2 )
    	$number1 : First number to check
    	$number2 : Second number to check
    	Return : Returns the larger number, will return 0 if numbers are the same.
    	@error :	1 - Invalid number
    #ce ----------------------------------------------------------------------------
    	
    	Func _largernumber ( $number1, $number2 )
    		
    		If $number1 > $number2 Then
    			;Number1 is larger!
    			Return $number1
    		ElseIf $number2 > $number1 Then
    			;Number2 is larger!
    			Return $number2
    		ElseIf $number1 = $number2 Then
    			;Numbers are the same!
    			Return 0
    		Else
    			;Error
    			SetError (1)
    		EndIf
    		
    	EndFunc
    
    #cs ----------------------------------------------------------------------------
     AutoIt Version: 3.2.10.0
     Author:         Dampe
    
     Script Function: Using Pythagros' theorm, returns the distance between 2 set's of co-ordinates.
     
    	_pythagoras($x1, $x2, $y1, $y2)
    	$x1 = The first x co-ordinate
    	$x2 = The second x co-ordinate
    	$y1 = The first y co-ordinate
    	$y2 = The second y co-ordinate
    	Return : Distance
    #ce ----------------------------------------------------------------------------
    	
    		Func _getdistance($x1, $x2, $y1, $y2)
    			
    			$largerx = _largernumber ($x1, $x2)
    			
    				If $largerx = $x1 Then
    					$trisidex = $x2 - $x1
    				ElseIf $largerx = $x2 Then
    					$trisidex = $x1 - $x2
    				Else
    					$trisidex = $x1 - $x2
    				EndIf
    			
    			$largery = _largernumber ($y1, $y2)
    			
    				If $largery = $y1 Then
    					$trisidey = $y2 - $y1
    				ElseIf $largery = $y2 Then
    					$trisidey = $y1 - $y2
    				Else
    					$trisidey = $y1 - $y2
    				EndIf
    				
    				;Pythagoras' Theorm, C2 = A2 + B2
    			$distance = Sqrt (($trisidex * $trisidex) + ($trisidey * $trisidey))
    			
    			Return $distance
    			
    		EndFunc
    hope it helps someone!

    AutoIt Math au3
  2. #2
    Flos's Avatar Member
    Reputation
    49
    Join Date
    Feb 2008
    Posts
    146
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You know.. not to criticise you, but there is WAY to much code (and therefore slower) used in those functions.

    _largernumber should never return 0 if both numbers are equal.. since you would need an extra check once you call this function..
    and if you use Pythagoras.. there is no need to call _largernumber since x^2 will always be positive...

    but anyway... everybody who tried to write a bot needs those functions.. so nice sharing

  3. #3
    swollen's Avatar Member
    Reputation
    36
    Join Date
    May 2007
    Posts
    124
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Never looked at it that way, but I'm sure it will hardly make it slower, only in the tiniest.
    Thanks for consrtuctive crit though.

  4. #4
    alek900's Avatar Contributor
    Reputation
    103
    Join Date
    Nov 2007
    Posts
    101
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have to agree that _Largenumber should never return 0

    Func _Largenumber($s_Num1, $s_Num2)
    If $sNum1 > $s_Num2 then Return $sNum1
    Return $s_Num 2
    Endfunc

    but there is already a function like this in autoit (or in math.au3 that comes with autoit)


    _Max ( $nNum1, $nNum2 )


    also i would like to trow in a subtract function that subtracts the lowest number from the bigest.


    Func _Sub($s_Num1, $s_Num2)
    If $s_Num1 > $s_Num2 Then Return $s_Num1-$s_Num2
    Return $s_Num2-$s_Num1
    EndFunc

    which then can be added to the _Distance function to make it a lot smaller

    Func _Distance($s_x1, $s_y1, $s_x2, $s_y2)
    Return Sqrt(_Sub($s_x1, $s_x2)^2 + _Sub($s_y1, $s_y2)^2)
    EndFunc



    for some reason the code tags doesn't like my $ :s
    19+4 that means i score

  5. #5
    khaled1994's Avatar Active Member
    Reputation
    23
    Join Date
    May 2007
    Posts
    248
    Thanks G/R
    0/0
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    dosnt work for me:P

  6. #6
    khaled1994's Avatar Active Member
    Reputation
    23
    Join Date
    May 2007
    Posts
    248
    Thanks G/R
    0/0
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    dosent* sryy

  7. #7
    Zim619's Avatar Member
    Reputation
    13
    Join Date
    Feb 2008
    Posts
    71
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm pretty sure that your double post was completely unnecessary there.. There is an edit button for a reason.. Besides the fact you didn't even spell "doesn't" right the second post.

Similar Threads

  1. [Active]Act3Q1 Tremors in the Stone - Au3 Leveling AutoIt Script
    By NoUseLying in forum D3 Leveling profiles
    Replies: 41
    Last Post: 11-30-2012, 01:49 AM
  2. [Au3]Convert Descriptor Dump to AutoIt
    By bouh2 in forum WoW Memory Editing
    Replies: 10
    Last Post: 05-11-2009, 12:03 PM
  3. No fall dmg (autoIT)
    By KuRIoS in forum World of Warcraft Exploits
    Replies: 6
    Last Post: 06-19-2006, 12:22 PM
  4. autoIT question
    By Vel0city in forum World of Warcraft General
    Replies: 3
    Last Post: 06-18-2006, 02:54 PM
  5. AutoIt Macro for WoW AFK Bot
    By Matt in forum World of Warcraft Bots and Programs
    Replies: 8
    Last Post: 04-06-2006, 06:01 AM
All times are GMT -5. The time now is 04:20 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search