Jump to content
Sign in to follow this  
PickPocketz

Looping Through Combinations

Recommended Posts

PickPocketz

Hi Guys and Gals,

I'm attempting to write a script that will give me an output of all the possible combinations of a predifined set. For example I have five letters "P, K, R, A, W" that I want to run through and get every last combination from it.

Such as if I had then numbers 0, 1, 2 and a 3 digit combination I would have Twenty Seven different outcomes ranging from 000, 001 - 221, 222.

I wouldn't have a problem if I were ok with having repeated outcomes or writing a long list of code but I do not want repeats and I want to eventually set up a GUI based system to accept Alpha & Alphanumeric characters of any length and do what I am looking for now.

This is the basic layout I have:

#include <GUIConstantsEx.au3>
#include <Array.au3>
#include <StaticConstants.au3>
Const $title = "Combinator"
Global $wX = 300, $wY = 25
Local $array[5] = ["P", "K", "R", "A", "W"]
GUICreate($title, $wX, $wY)
GUICtrlCreateLabel("COMBINATIONS", 5, 5, $wX - 10, $wY - 10, $SS_CENTER)
GUISetState()
While 1

$msg = GUIGetMsg()

Select
case $msg = $GUI_EVENT_CLOSE
  Exit
EndSelect

WEnd
Func _generate()

;Combo Loop

Sleep(5000) ;Allow Time to See Combination

EndFunc

Share this post


Link to post
Share on other sites
PickPocketz

I just now realized what this is looking like and I apologize in advance. I am in no means attempting to make some sort of keygen or something along those lines. I was playing a game where a user would constantly have to ask "PKR" or "PKRAW" (P2P, Kik, Rev, Auto, Watch) and thought to myself what word could I come up with using those letters that would look natural in the english language. I then thought "well hell might as well use my love for AutoIt to figure it out for me". I know I have a unique thought process haha.

Share this post


Link to post
Share on other sites
Mikeman27294

Sorry, but the forum frowns upon game automation discussions. I realise that you are not trying to automate a game, but you are trying to cheat in a game which also, is not to be discussed in a forum. Unfortunately for you, I had almost submitted the answer and then I remembered playing text twist trying to figure out a problem with flash.

Just a hint - if you want to cheat in games, find another forum. Otherwise, dont try and discuss cheating.

Share this post


Link to post
Share on other sites
PickPocketz

Sorry, but the forum frowns upon game automation discussions. I realise that you are not trying to automate a game, but you are trying to cheat in a game which also, is not to be discussed in a forum. Unfortunately for you, I had almost submitted the answer and then I remembered playing text twist trying to figure out a problem with flash.

Just a hint - if you want to cheat in games, find another forum. Otherwise, dont try and discuss cheating.

I definatly understand.

I'm not trying to do anything directly with this game which is Habbo Hotel http://www.habbohotel.com. I just became curious with the combination possibilities and have been looking for different ideas to use AutoIt. If I were and I am not saying I am trying use this in some sort of way in this game the most I could do is spam in the chat. In all honesty if I were to work on something to manipulate a game in any way it would be in secret and I would not give anyone the opportunity to become an accessory to this. Again I do apologize for what this looks like but please believe me it is only a personal interest and another way to work on my skills in programming AutoIt.

If you have any doubt my username is Pickpocketz in game and feel free to report me if you believe I am not playing with integrity.

Share this post


Link to post
Share on other sites
czardas

I just now realized what this is looking like and I apologize in advance. I am in no means attempting to make some sort of keygen or something along those lines. I was playing a game where a user would constantly have to ask "PKR" or "PKRAW" (P2P, Kik, Rev, Auto, Watch) and thought to myself what word could I come up with using those letters that would look natural in the english language. I then thought "well hell might as well use my love for AutoIt to figure it out for me". I know I have a unique thought process haha.

You're digging a hole for yourself here. Anyway I believe you. The function _ArrayCombinations should do the job.

Share this post


Link to post
Share on other sites
PickPocketz

You're digging a hole for yourself here. Anyway I believe you. The function _ArrayCombinations should do the job.

I mean I don't know how to justify myself otherwise... The language has the ability to do so and if that were my interest I wouldn't be so naive as to ask for help on scripting something technically illegal. I don't know what to say except thank you for the help you actually are the only one that gave me advice on my first post (This being the second one.)

Share this post


Link to post
Share on other sites
XIXI

Your mathematical calculations about how many combinations you would have is incorrect.

Look up Recursive Functions. Might leave a reply later with something I can come up with.

Share this post


Link to post
Share on other sites
czardas

@ PickPocketz You don't have to justify everything. The question you asked is a very general one about something mathematical. Just stick to the question. If there's anything suspicious about a person's post then people will ask what the script is for. As I see it, you have always asked acceptable questions which don't break any forum rules.

Edited by czardas

Share this post


Link to post
Share on other sites
Mikeman27294

Ok, well then if that is the case and this is about trivial knowledge and not cheating, then that's alright.

I would expect it would be just a basic for loop inside a for loop, hopefully.

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  

  • Similar Content

    • omicron
      By omicron
      Hello!

      I am working on a function that I am just getting lost on. The goal is a multiple nested loop.

      Here are the steps:
      Contents of file1.txt::
      [topic] var1=Name var2=OtherName var3=SomeotheName Contents of file2.txt::
      [subTopic] top=sub1 top2=sub2 top3=sub3 The Shell I am working from::
      #include <file.au3> $file = "c:\yourfile.txt" FileOpen($file, 0) For $i = 1 to _FileCountLines($file) $line = FileReadLine($file, $i) msgbox(0,'','the line ' & $i & ' is ' & $line) Next FileClose($file) Understanding however that the "msgbox" needs to then become a variable. in example the following::
      $file = "c:\yourfile.txt" FileOpen($file, 0) While true( prog.exe is running && "WinName" is open) do For $i = 1 to _FileCountLines($file) $line = FileReadLine($file, $i) ;Open File to log "current location of file 1" FileWriteLine ("filename", $i & ' is ' & $line) var = $line Next $file2 = "c:\yourfile.txt" FileOpen($file, 0) For $i = 1 to _FileCountLines($file) $line = FileReadLine($file, $i) ; OpenFile to log "Current location of file 2" FileWriteLine ("filename", $i & ' is ' & $line) Next FileClose($file2) FileClose($file) The goal in written form is the following ::

      While in "OpenWindow"
          read from file 1 starting at line 1 until end of file.
         file 1 is a list of names to be searched.
         With $line selected, add this element to the element in file 2.
       
      The search of a variables in list 1 and list 2 differ on the amount of posts that day. (This is not a web based platform, it is a game) I need to search 2 names and take a screenshot of the out put. The sizes of the names list depend on the activity of names at the time of search.
      This loop continues until all the names from both lists have been searched. Mostly in the format of::
      File1= item
      File2= Vendor
       
      Item + Vendor  ( Capture screen, scroll) -- Not sure how to detect if I need to scroll)
       
      Thank you for your help and support!
    • Jackized
      By Jackized
      Is there a way to loop back to the beginning and keep the already entered data in the GUI Input boxes? I can GUIDelete and start a new GUI but all the typed data has to be redone. Here is a sample.

       
      #Include <GuiConstants.au3> Dim $msg,$okbutton,$cancelbutton,$objOU,$intAccValue,$strGroup1,$strGroup2 Dim $strFirstName,$strLastName,$strUserName,$strUserName2,$strPassword,$strDescription,$strContainer Dim $Combo,$Duration Do $Form1 = GuiCreate("", 300, 300)          GUISetBkColor(0xA6CAF0)         GuiCtrlCreateLabel("First Name:", 50, 10)         $strFirstName = GuiCtrlCreateInput("", 50, 25, 200, 20)         GUICtrlSetState ( $okbutton, $GUI_FOCUS )         GuiSetState()     $okbutton = GUICtrlCreateButton ("OK",75,240,50,20)     $cancelbutton = GUICtrlCreateButton ("Cancel",175,240,50,20) While 1     $msg = GUIGetMsg()     Select     Case $msg = $GUI_EVENT_CLOSE Or $msg = $cancelbutton             Exit     Case $msg = $okbutton             $strFirstName = GUICtrlRead($strFirstName)             ExitLoop     EndSelect Wend $len = StringLen($strFirstName)     If $len > "20" then         MsgBox(0, "ERROR Name to long", $strFirstName & " can't be over 20 characters." & @CRLF & "Total: " & $len)         ;Exit         GUIDelete($Form1)     EndIf Until $len < "20" MsgBox(0, "Done", "")  
    • mrtgtr
      By mrtgtr
      I want to do something , after wait 2 min and again do same thing
      But I do do not want with sleep, it must be timer 
      How I do this ?
    • Skeletor
      By Skeletor
      Hi Guys,
      Is it possible to get a variable on your For..Next loop? 
       
      Local $Lines1 = _FileCountLines(C:\temp\test.txt) Local $linesToCount2 = $Lines1 + 2 $var = Number($linesToCount2) For $count = 1 To _FileCountLines($FileRead2) Step 1 For $i = $var To $count Next ;Code does stuff here Next Somehow my code doesn't work even though I thought I could convert the variable to a Integer / Number.
      This code I posted above does not move to the next value.
      But the code below does... why is that?
      For $count = 1 To _FileCountLines($FileRead2) Step 1 For $i = 2 To $count Next ;Code does stuff here Next  
      Why is the For loop resetting itself?
      Is it because the program does not cache the variable and needs to keep on acquiring this variable each time?
      If so , how would you make this variable static?

       
    • BogdanNicolescu
      By BogdanNicolescu
      While 1 / / / A whole bunch of codes found in help and here: https://www.autoitscript.com/autoit3/docs/ / / / WEnd OR:

       
      HotKeySet("{ESC}", "Terminate") While 1 MouseClick("Right",674,422) MouseClick("Left",673,447) Sleep(2000) / / / A whole bunch of codes found in help and here: https://www.autoitscript.com/autoit3/docs/ / / / MouseClick("Left",675,339) SLeep(3000) WEnd Func Terminate()     Exit 0 EndFunc  
      Sorry if i should't let this here to be found by newbies like me -.-'
×