Sign in to follow this  
Followers 0
-TS-

_max Help

23 posts in this topic

i got 100 dif number $vars and i need to find the highest 6 $vars

how would i go about doing that?

Share this post


Link to post
Share on other sites



if they are whole number this you can use as a first filter

$len = StringLen("9362918254")
MsgBox(0, "String length is:", $len)
;len would = 10
;all number having a count size smaller than 10 eliminate

then you could use

$result = StringLeft("9362918254", 1)
if $result = 9 then
;keep that varible

i hope this helps...


 

Spoiler

shoot_zpsfd329d66.png
dontbelieveeverythingyouthink_zps0e1e900

Madness is the first step to understanding...

Share this post


Link to post
Share on other sites

well heres the boggle, some of the number $vars change each time (increace)

Share this post


Link to post
Share on other sites

you can us filewriteline to store the varibles to a file then read it back and eliminate the varibles like this then

write to the file all 100 varibles meaning 100 lines


 

Spoiler

shoot_zpsfd329d66.png
dontbelieveeverythingyouthink_zps0e1e900

Madness is the first step to understanding...

Share this post


Link to post
Share on other sites
:D well i do keep em stored in a *.ini

Share this post


Link to post
Share on other sites

just out of sheer sick curiousity may i see the code? :D


 

Spoiler

shoot_zpsfd329d66.png
dontbelieveeverythingyouthink_zps0e1e900

Madness is the first step to understanding...

Share this post


Link to post
Share on other sites

; ----------------------------------------------------------------------------

; Script Start

; ----------------------------------------------------------------------------

DO

; ----------------------------------------------------------------------------

; Loading the faverd numberlog

; ----------------------------------------------------------------------------

$Number1 = IniRead("SCN Pick em Quick Numberlog and Gamelog.ini", "Number Logger", "1 been called", 0)

$Number2 = IniRead("SCN Pick em Quick Numberlog and Gamelog.ini", "Number Logger", "2 been called", 0)

$Number3 = IniRead("SCN Pick em Quick Numberlog and Gamelog.ini", "Number Logger", "3 been called", 0)

$Number4 = IniRead("SCN Pick em Quick Numberlog and Gamelog.ini", "Number Logger", "4 been called", 0)

$Number5 = IniRead("SCN Pick em Quick Numberlog and Gamelog.ini", "Number Logger", "5 been called", 0)

$Number6 = IniRead("SCN Pick em Quick Numberlog and Gamelog.ini", "Number Logger", "6 been called", 0)

$Number7 = IniRead("SCN Pick em Quick Numberlog and Gamelog.ini", "Number Logger", "7 been called", 0)

$Number8 = IniRead("SCN Pick em Quick Numberlog and Gamelog.ini", "Number Logger", "8 been called", 0)

$Number9 = IniRead("SCN Pick em Quick Numberlog and Gamelog.ini", "Number Logger", "9 been called", 0)

$Number10 = IniRead("SCN Pick em Quick Numberlog and Gamelog.ini", "Number Logger", "10 been called", 0)

.....

$Number99 = IniRead("SCN Pick em Quick Numberlog and Gamelog.ini", "Number Logger", "99 been called", 0)

$Number100 = IniRead("SCN Pick em Quick Numberlog and Gamelog.ini", "Number Logger", "100 been called", 0)

; ----------------------------------------------------------------------------

; Finding the first five highest numbers

; ----------------------------------------------------------------------------

.... area i need help with

; ----------------------------------------------------------------------------

; Click commands for the most faverd number

; ----------------------------------------------------------------------------

IF $Number1 = $highernumber99 and $Number1 = $higher2number98 and $Number1 = $higher3number97 and $Number1 = $higher4number96 and $Number1 =$higher5number95 and $higher6number94 then

MouseClick ( "Left" , 43, 40, 1, 0)

Endif

IF $Number2 = $highernumber99 and $Number2 = $higher2number98 and $Number2 = $higher3number97 and $Number2 = $higher4number96 and $Number2 =$higher5number95 and $higher6number94 then

MouseClick ( "Left" , 75, 40, 1, 0)

Endif

IF $Number3 = $highernumber99 and $Number3 = $higher2number98 and $Number3 = $higher3number97 and $Number3 = $higher4number96 and $Number3 =$higher5number95 and $higher6number94 then

MouseClick ( "Left" , 107, 40, 1, 0)

Endif

IF $Number4 = $highernumber99 and $Number4 = $higher2number98 and $Number4 = $higher3number97 and $Number4 = $higher4number96 and $Number4 =$higher5number95 and $higher6number94 then

MouseClick ( "Left" , 139, 40, 1, 0)

Endif

IF $Number5 = $highernumber99 and $Number5 = $higher2number98 and $Number5 = $higher3number97 and $Number5 = $higher4number96 and $Number5 =$higher5number95 and $higher6number94 then

MouseClick ( "Left" , 171, 40, 1, 0)

Endif

IF $Number6 = $highernumber99 and $Number6 = $higher2number98 and $Number6 = $higher3number97 and $Number6 = $higher4number96 and $Number6 =$higher5number95 and $higher6number94 then

MouseClick ( "Left" , 203, 40, 1, 0)

Endif

IF $Number7 = $highernumber99 and $Number7 = $higher2number98 and $Number7 = $higher3number97 and $Number7 = $higher4number96 and $Number7 =$higher5number95 and $higher6number94 then

MouseClick ( "Left" , 235, 40, 1, 0)

Endif

IF $Number8 = $highernumber99 and $Number8 = $higher2number98 and $Number8 = $higher3number97 and $Number8 = $higher4number96 and $Number8 =$higher5number95 and $higher6number94 then

MouseClick ( "Left" , 267, 40, 1, 0)

Endif

IF $Number9 = $highernumber99 and $Number9 = $higher2number98 and $Number9 = $higher3number97 and $Number9 = $higher4number96 and $Number9 =$higher5number95 and $higher6number94 then

MouseClick ( "Left" , 299, 40, 1, 0)

Endif

IF $Number10 = $highernumber99 and $Number10 = $higher2number98 and $Number10 = $higher3number97 and $Number10 = $higher4number96 and $Number10 =$higher5number95 and $higher6number94 then

MouseClick ( "Left" , 331, 40, 1, 0)

Endif

.....

IF $Number100 = $highernumber99 and $Number100 = $higher2number9 and $Number100 = $higher3number97 and $Number100 = $higher4number96 and $Number100 =$higher5number95 and $higher6number94 then

MouseClick ( "Left" , 331, 232, 1, 0)

Endif

MouseClick ( "Left" , 415, 247, 1, 0)

$wate = 0

do

$C = PixelGetColor ( 452, 249)

If $C = 16747571 then

sleep(1000)

$wate = 9

endif

until $wate = 9

; ----------------------------------------------------------------------------

; Adding the good numbers to the log numbers

; ----------------------------------------------------------------------------

If $Number1find = 39423 OR $Number1find = 3094809 then

$Number1 = $Number1 + 1

endif

If $Number2find = 39423 OR $Number2find = 3094809 then

$Number2 = $Number2 + 1

endif

If $Number3find = 39423 OR $Number3find = 3094809 then

$Number3 = $Number3 + 1

endif

If $Number4find = 39423 OR $Number4find = 3094809 then

$Number4 = $Number4 + 1

endif

If $Number5find = 39423 OR $Number5find = 3094809 then

$Number5 = $Number5 + 1

endif

If $Number6find = 39423 OR $Number6find = 3094809 then

$Number6 = $Number6 + 1

endif

If $Number7find = 39423 OR $Number7find = 3094809 then

$Number7 = $Number7 + 1

endif

If $Number8find = 39423 OR $Number8find = 3094809 then

$Number8 = $Number8 + 1

endif

If $Number9find = 39423 OR $Number9find = 3094809 then

$Number9 = $Number9 + 1

endif

If $Number10find = 39423 OR $Number10find = 3094809 then

$Number10 = $Number10 + 1

endif

.....

If $Number100find = 39423 OR $Number100find = 3094809 then

$Number100 = $Number100 + 1

endif

; ----------------------------------------------------------------------------

; Writing the good numbers to the log

; ----------------------------------------------------------------------------

IniWrite("SCN Pick em Quick numberlog and gamelog.ini", "Number Logger", "1 been called", $Number1)

IniWrite("SCN Pick em Quick numberlog and gamelog.ini", "Number Logger", "2 been called", $Number2)

IniWrite("SCN Pick em Quick numberlog and gamelog.ini", "Number Logger", "3 been called", $Number3)

IniWrite("SCN Pick em Quick numberlog and gamelog.ini", "Number Logger", "4 been called", $Number4)

IniWrite("SCN Pick em Quick numberlog and gamelog.ini", "Number Logger", "5 been called", $Number5)

IniWrite("SCN Pick em Quick numberlog and gamelog.ini", "Number Logger", "6 been called", $Number6)

IniWrite("SCN Pick em Quick numberlog and gamelog.ini", "Number Logger", "7 been called", $Number7)

IniWrite("SCN Pick em Quick numberlog and gamelog.ini", "Number Logger", "8 been called", $Number8)

IniWrite("SCN Pick em Quick numberlog and gamelog.ini", "Number Logger", "9 been called", $Number9)

IniWrite("SCN Pick em Quick numberlog and gamelog.ini", "Number Logger", "10 been called", $Number10)

.....

IniWrite("SCN Pick em Quick numberlog and gamelog.ini", "Number Logger", "100 been called", $Number100)

MouseClick ( "Left" , 415, 247, 1, 0)

Until $x = 5

Exit

Share this post


Link to post
Share on other sites

ohhh wow!!! you over complicated this alot....

$i = 0
While $i = 101
;if you do your code with this example you can eliminate alot of code to go throught....
WEnd

why i even show this you can have like 15 lines of code to do the same thing you whole thing is doing....

i think you are making things way to complicated on yourself... writing to an ini is more complicated than just writing to a text file.

each line that is written into a text file can be used as a varible unto itself..

i am bored wide awake and willing to help...


 

Spoiler

shoot_zpsfd329d66.png
dontbelieveeverythingyouthink_zps0e1e900

Madness is the first step to understanding...

Share this post


Link to post
Share on other sites

here take a look at this code i made using the while command

Autoit Forum

now if you take that entire code i had written and use it in a script please omitt the text part at the bottom of the script is the (while) command. see how much it writes and calculates in the resulting txt file....use the entire script and see what i mean...


 

Spoiler

shoot_zpsfd329d66.png
dontbelieveeverythingyouthink_zps0e1e900

Madness is the first step to understanding...

Share this post


Link to post
Share on other sites

Found out how to reduce all the $vars

$highernumber1 = _Max( $Number1, $Number2)
$highernumber2 = _Max( $Number3, $Number4)
$highernumber3 = _Max( $Number5, $Number6)
$highernumber4 = _Max( $Number7, $Number8)
$highernumber5 = _Max( $Number9, $Number10)
$highernumber6 = _Max( $Number11, $Number12)
$highernumber7 = _Max( $Number13, $Number14)
$highernumber8 = _Max( $Number15, $Number16)
$highernumber9 = _Max( $Number17, $Number18)
$highernumber10 = _Max( $Number19, $Number20)
$highernumber11 = _Max( $Number21, $Number22)
$highernumber12 = _Max( $Number23, $Number24)
$highernumber13 = _Max( $Number25, $Number26)
$highernumber14 = _Max( $Number27, $Number28)
$highernumber15 = _Max( $Number29, $Number30)
$highernumber16 = _Max( $Number31, $Number32)
$highernumber17 = _Max( $Number33, $Number34)
$highernumber18 = _Max( $Number35, $Number36)
$highernumber19 = _Max( $Number37, $Number38)
$highernumber20 = _Max( $Number39, $Number40)
$highernumber21 = _Max( $Number41, $Number42)
$highernumber22 = _Max( $Number43, $Number44)
$highernumber23 = _Max( $Number45, $Number46)
$highernumber24 = _Max( $Number47, $Number48)
$highernumber25 = _Max( $Number49, $Number50)
$highernumber26 = _Max( $Number51, $Number52)
$highernumber27 = _Max( $Number53, $Number54)
$highernumber28 = _Max( $Number55, $Number56)
$highernumber29 = _Max( $Number57, $Number58)
$highernumber30 = _Max( $Number59, $Number60)
$highernumber31 = _Max( $Number61, $Number62)
$highernumber32 = _Max( $Number63, $Number64)
$highernumber33 = _Max( $Number65, $Number66)
$highernumber34 = _Max( $Number67, $Number68)
$highernumber35 = _Max( $Number69, $Number70)
$highernumber36 = _Max( $Number71, $Number72)
$highernumber37 = _Max( $Number73, $Number74)
$highernumber38 = _Max( $Number75, $Number76)
$highernumber39 = _Max( $Number77, $Number78)
$highernumber40 = _Max( $Number79, $Number80)
$highernumber41 = _Max( $Number81, $Number82)
$highernumber42 = _Max( $Number83, $Number84)
$highernumber43 = _Max( $Number85, $Number86)
$highernumber44 = _Max( $Number87, $Number88)
$highernumber45 = _Max( $Number89, $Number90)
$highernumber46 = _Max( $Number91, $Number92)
$highernumber47 = _Max( $Number93, $Number94)
$highernumber48 = _Max( $Number95, $Number96)
$highernumber49 = _Max( $Number97, $Number98)
$highernumber50 = _Max( $Number99, $Number100)


$higher2number1 = _Max( $highernumber1, $highernumber2)
$higher2number2 = _Max( $highernumber3, $highernumber4)
$higher2number3 = _Max( $highernumber5, $highernumber6)
$higher2number4 = _Max( $highernumber7, $highernumber8)
$higher2number5 = _Max( $highernumber9, $highernumber10)
$higher2number6 = _Max( $highernumber11, $highernumber12)
$higher2number7 = _Max( $highernumber13, $highernumber14)
$higher2number8 = _Max( $highernumber15, $highernumber16)
$higher2number9 = _Max( $highernumber17, $highernumber18)
$higher2number10 = _Max( $highernumber19, $highernumber20)
$higher2number11 = _Max( $highernumber21, $highernumber22)
$higher2number12 = _Max( $highernumber23, $highernumber24)
$higher2number13 = _Max( $highernumber25, $highernumber26)
$higher2number14 = _Max( $highernumber27, $highernumber28)
$higher2number15 = _Max( $highernumber29, $highernumber30)
$higher2number16 = _Max( $highernumber31, $highernumber32)
$higher2number17 = _Max( $highernumber33, $highernumber34)
$higher2number18 = _Max( $highernumber35, $highernumber36)
$higher2number19 = _Max( $highernumber37, $highernumber38)
$higher2number20 = _Max( $highernumber39, $highernumber40)
$higher2number21 = _Max( $highernumber41, $highernumber42)
$higher2number22 = _Max( $highernumber43, $highernumber44)
$higher2number23 = _Max( $highernumber45, $highernumber46)
$higher2number24 = _Max( $highernumber47, $highernumber48)
$higher2number25 = _Max( $highernumber49, $highernumber50)

$higher3number1 = _Max( $higher2number1, $higher2number2)
$higher3number2 = _Max( $higher2number3, $higher2number4)
$higher3number3 = _Max( $higher2number5, $higher2number6)
$higher3number4 = _Max( $higher2number7, $higher2number8)
$higher3number5 = _Max( $higher2number9, $higher2number10)
$higher3number6 = _Max( $higher2number11, $higher2number12)
$higher3number7 = _Max( $higher2number13, $higher2number14)
$higher3number8 = _Max( $higher2number15, $higher2number16)
$higher3number9 = _Max( $higher2number17, $higher2number18)
$higher3number10 = _Max( $higher2number19, $higher2number20)
$higher3number11 = _Max( $higher2number21, $higher2number22)
$higher3number12 = _Max( $higher2number23, $higher2number24)
$higher3number13 = _Max( $higher2number25, $higher2number25)

$higher4number1 = _Max( $higher3number1, $higher3number2)
$higher4number2 = _Max( $higher3number3, $higher3number4)
$higher4number3 = _Max( $higher3number5, $higher3number6)
$higher4number4 = _Max( $higher3number7, $higher3number8)
$higher4number5 = _Max( $higher3number9, $higher3number10)
$higher4number6 = _Max( $higher3number11, $higher3number12)
$higher4number7 = _Max( $higher3number13, $higher3number13)

$higher5number1 = _Max( $higher4number1, $higher4number2)
$higher5number2 = _Max( $higher4number3, $higher4number4)
$higher5number3 = _Max( $higher4number5, $higher4number6)
$higher5number4 = _Max( $higher4number7, $higher4number7)


$highernumber99 = $higher4number6 ;1st number
$higher2number98 = $higher4number7;2nd number
$higher3number97 = $higher5number1;3rd number
$higher4number96 = $higher5number2;4th number
$higher5number95 = $higher5number3;5th number
$higher6number94 = $higher5number4;6th number

and it works, just need to fix the next part

lmbos

Share this post


Link to post
Share on other sites

well that is an intersting way of doing it.... hmmmmmmmm will be awaiting next reply :D


 

Spoiler

shoot_zpsfd329d66.png
dontbelieveeverythingyouthink_zps0e1e900

Madness is the first step to understanding...

Share this post


Link to post
Share on other sites

i know i forgot to ask ya. are you using random to generate these numbers?


 

Spoiler

shoot_zpsfd329d66.png
dontbelieveeverythingyouthink_zps0e1e900

Madness is the first step to understanding...

Share this post


Link to post
Share on other sites

Thx for the help.

No the program that it is running with is using a randomizer.

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

What about doing it this way to load the 100 numbers then copy the array and sort it. ?

Its uses For... Next loops so you have to do a lot less coding.....

Only couldn't figure out how you were getting the $NUMBER1FIND values...

i didn't test the below script .. It's just to give you some food for thought...

Dim $NUMBERS[101]
Dim $HIGH_NUMBERS[6]
do
  ; ----------------------------------------------------------------------------
  ; Loading the faverd numberlog
  ; ----------------------------------------------------------------------------
   For $X = 1 To 100
      $NUMBER[$X] = IniRead("SCN Pick em Quick Numberlog and Gamelog.ini", "Number Logger", $X & " been called", 0)
   Next
   $HIGH_NUMBERS = $NUMBERS
   SortArray ($HIGH_NUMBERS, 100)
  ; ----------------------------------------------------------------------------
  ; Click commands for the most faverd number
  ; ----------------------------------------------------------------------------
   For $X = 1 To 100
      If $NUMBER[$X] = $HIGHERNUMBER[100] _
            And $NUMBER[$X] = $HIGHER2NUMBER[99] _
            And $NUMBER[$X] = $HIGHER3NUMBER[98] _
            And $NUMBER[$X] = $HIGHER4NUMBER[97] _
            And $NUMBER[$X] = $HIGHER5NUMBER[96] Then
         MouseClick("Left", 43 + ($X - 1) * 32, 40, 1, 0)
      EndIf
   Next
  ;
   MouseClick("Left", 415, 247, 1, 0)
   $WATE = 0
   do
      $C = PixelGetColor(452, 249)
      If $C = 16747571 Then
         Sleep(1000)
         $WATE = 9
      EndIf
   Until $WATE = 9
  ; ----------------------------------------------------------------------------
  ; Adding the good numbers to the log numbers
  ; ----------------------------------------------------------------------------
  ; **** how do you get values for $NUMBER1FIND etc ?????
   If $NUMBER1FIND = 39423 Or $NUMBER1FIND = 3094809 Then
      $NUMBER1 = $NUMBER1 + 1
   EndIf
   .....
   If $NUMBER100FIND = 39423 Or $NUMBER100FIND = 3094809 Then
      $NUMBER100 = $NUMBER100 + 1
   EndIf
   
  ; ----------------------------------------------------------------------------
  ; Writing the good numbers to the log
  ; ----------------------------------------------------------------------------
   For $X = 1 To 100
      IniWrite("SCN Pick em Quick numberlog and gamelog.ini", "Number Logger", $1 & " been called", $NUMBER[$X])
   Next 
   MouseClick("Left", 415, 247, 1, 0)
Until $X = 5
Exit 

;=====================================================
; sort an array 
;=====================================================
Func sort_array(ByRef $I_ARRAY, $I_UBOUND)
  ;shell sort array 
   $A_SIZE = $I_UBOUND
   $GAP = Int($A_SIZE / 2)
  ;
   While $GAP <> 0
      $ISCHANGED = 0
      For $COUNT = 1 To ($A_SIZE - $GAP)
         If $I_ARRAY[$COUNT] > $I_ARRAY[$COUNT + $GAP] Then
            $TEMP = $I_ARRAY[$COUNT]
            $I_ARRAY[$COUNT] = $I_ARRAY[$COUNT + $GAP]
            $I_ARRAY[$COUNT + $GAP] = $TEMP
            $ISCHANGED = 1
         EndIf
      Next
    ;if no changes were made to array, decrease $gap size
      If $ISCHANGED = 0 Then
         $GAP = Int($GAP / 2)
      EndIf
   Wend
EndFunc  ;==>sort_array
Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

same reason why i had to stop JdeB... cause there is proabbaly like 10 different ways of doing what they are stating... i was thinking of an easier way of instead of 6 varibles just resort the order from either highest to lowest or vise versa into a text file....


 

Spoiler

shoot_zpsfd329d66.png
dontbelieveeverythingyouthink_zps0e1e900

Madness is the first step to understanding...

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

I like my scripts layed out ez to view, yea there is probley a ezer way but it works fine. :D

the $number1find and what not was the $vars i was using on the first attemt of finding the 6 highest numbers

Edited by -TS-

Share this post


Link to post
Share on other sites

That's not easy to view at all. In fact, I think the only person who can even figure out what is going on is you because none of the rest of us want to read a 5 billion line script to find a problem, especially when 70% or more of it is redundant code. Less is more.

Share this post


Link to post
Share on other sites

#18 ·  Posted (edited)

I've heard that, statistically, the number of bugs (or potential for bugs) in a program increases greatly whenever any code subroutine exceeds what you can view on screen without scrolling.

So -TS- should either heed Valik's advice or should find a montior capable of

4,000,000 x 3,000,000 resolution :D

Edit: Reduntant code is bad, simpler is better, arrays are good. I would have to use another script (or regular expressions) to generate what you posted here! I surely wouldn't do it by hand.

Edited by CyberSlug

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites

I've heard that, statistically, the number of bugs (or potential for bugs) in a program increases greatly whenever any code subroutine exceeds what you can view on screen without scrolling.

So -TS- should either heed Valik's advice or should find a montior capable of

4,000,000 x 3,000,000 resolution :huh2:

Edit:  Reduntant code is bad, simpler is better, arrays are good.  I would have to use another script (or regular expressions) to generate what you posted here!  I surely wouldn't do it by hand.

It looked to me that the person said they didn't want to know anything they didn't already know, but they would appreciate it if you would fix it using their method, not yours thank you very much!

:D


[font="Verdana"]Thanks for the response.Gene[/font]Yes, I know the punctuation is not right...

Share this post


Link to post
Share on other sites

It looked to me that the person said they didn't want to know anything they didn't already know, but they would appreciate it if you would fix it using their method, not yours thank you very much!

:D

Isn't that sort of like telling a carpenter to build a house out of wood but he can't use lumber?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0