Jump to content
UBot Underground

Shuffle list psuedo library


Recommended Posts

Thought I would make this, its based on a tutorial by john. Since someone asked how to do it and it seems like something kind of pesky to write in every bot, I went for it. If you've ever made a youtube viewer that loads a list, and you set it to random list item... you've probably at least once seen the same video twice in a row :blink:

 

So the break down of what we want is the following :

1) We want to be able to shuffle a list on the fly

2) We want to use a separate process to do it outside or the bot ie shuffle.exe

 

So lets get started

 

Once again,

 

http://www.ubotstudio.com/forum/index.php?/topic/10970-using-hma-and-auto-verifying-ip-change/page__p__57341#entry57341

This is a basic write up the how I set my folders up. Main folder where you store sources and processes while work, with a folder labeled data to house information in.

Start off by tossing the following text files into data:

1)Shuffle.txt

2)List

Leave them empty, the script will change them for us.

 

I've broken the shuffle down into multiple defines, but you can toss it into one.

 

define load_list {
   delete file("{$special folder("Application")}\\data\\shuffle.txt")
   save to file("{$special folder("Application")}\\data\\shuffle.txt", 0)
   add list to list(%input, $list from file("{$special folder("Application")}\\data\\list.txt"), "Delete", "Global")
}

First thing it does is delete shuffle.txt, replaces it with a new one with a value of zero to tell the other program 'hey we're working buddy.' It may not make sense now, but it will a bit. We then load the list, which will be supplied by the other program. It's confusing, but this is how we'll make compiled programs communicate later on.

 

define shuffle {
   set(#yes_or_no, 0, "Global")
   loop while($comparison(#yes_or_no, "=", 0)) {
       add item to list(%output, $random list item(%input), "Delete", "Global")
       if($comparison($list total(%input), "=", $list total(%output))) {
           then {
               set(#yes_or_no, 1, "Global")
               delete file("{$special folder("Application")}\\data\\list.txt")
               save to file("{$special folder("Application")}\\data\\list.txt", %output)
               save to file("{$special folder("Application")}\\data\\shuffle.txt", 1)
           }
           else {
           }
       }
   }
}

 

This is where we shuffle the list. We set a value for the variable (#yes_or_no) to 0 so it'll loop until the value changes making the comparison untrue. We add the input list to the output list until both lists are equal. The if...then compares list totals and if they're equal , it deletes the old list file and replaces it with a new one. After that it changes the value in shuffle to 1 and kills the loop.

 

So all together this is what it'll look like.

 

define run_me {
   clear list(%input)
   clear list(%input)
   delete file("{$special folder("Application")}\\data\\shuffle.txt")
   save to file("{$special folder("Application")}\\data\\shuffle.txt", 0)
   add list to list(%input, $list from file("{$special folder("Application")}\\data\\list.txt"), "Delete", "Global")
   set(#yes_or_no, 0, "Global")
   loop while($comparison(#yes_or_no, "=", 0)) {
       add item to list(%output, $random list item(%input), "Delete", "Global")
       if($comparison($list total(%input), "=", $list total(%output))) {
           then {
               set(#yes_or_no, 1, "Global")
               delete file("{$special folder("Application")}\\data\\list.txt")
               save to file("{$special folder("Application")}\\data\\list.txt", %output)
               save to file("{$special folder("Application")}\\data\\shuffle.txt", 1)
           }
           else {
           }
       }
   }
   shell("cmd.exe /c \"taskkill /im shuffle.exe /f\"")
}

(I added clear list in there also ^)

ui stat monitor("<script type=\"text/javascript\">
   window.onload = ubot.runScript(\'run_me()\')
</script>", "")

Once again, add kreatus's onload feature

 

Now we can save and compile it as shuffle.exe into our main folder. Now its time to write the communication snippet.

 

define shuffling_snipet {
   delete file("{$special folder("Application")}\\data\\list.txt")
   save to file("{$special folder("Application")}\\data\\list.txt", %example_list)
   comment("replace the list names with the list you want to shuffle!")
   clear list(%example_list)
   comment("replace the list names with the list you want to shuffle!")
   shell("{$special folder("Application")}\\shuffle.exe")
   wait(1)
   set(#shuffle_complete, 0, "Global")
   loop while($comparison(#shuffle_complete, "=", 0)) {
       set(#test, $read file("{$special folder("Application")}\\data\\shuffle.txt"), "Global")
       if($comparison(#test, "=", 1)) {
           then {
               set(#shuffle_complete, 1, "Global")
           }
           else {
           }
       }
   }
   add list to list(%example_list, $list from file("{$special folder("Application")}\\data\\list.txt"), "Delete", "Global")
   comment("replace the list names with the list you want to shuffle!")
}

 

In a nut shell, it passes the list to our friend shuffle.exe then waits patiently to have it handed back. Next tutorial will be combining the hma.exe, random user agent and shuffle together. :lol:

Link to post
Share on other sites

WOW that is some effort.

 

Here is an easier alternative to shuffle a list if you like:

 

http://www.ubotstudio.com/forum/index.php?/topic/10985-get-shuffle-list/

 

Hope it helps.

 

Praney :)

thanks man, I love simpler, definitely rewriting the one I have later.

Link to post
Share on other sites
  • 7 months later...

I spent half the day trying to find an 'easy' way to do this, and finally figured something out as soon as I noticed the ubot 4.2.15 update which opened an idea of an easy new way to do this for me... So.... Just in case someone in the future wants to do a "Shuffle" I was able to accomplish a "Shuffle" using the new "sort table" (4.2.15+) command like this:

 

lets say list name is %thelist
We'll output a new list as %sortedlist
 

clear list(%randnumlist)
clear list(%sortedlist)
clear table(&thelist)
loop($list total(%thelist)) {
    add item to list(%randnumlist, $rand(0, 9999), "Delete", "Global")
}
add list to table as column(&thelist, 0, 0, %thelist)
add list to table as column(&thelist, 0, 1, %randnumlist)
plugin command("TableCommands.dll", "sort table", &thelist, 1)
add list to list(%sortedlist, $plugin function("TableCommands.dll", "$list from table", &thelist, "Column", 0), "Delete", "Global")

 

I personally just used the table itself (cuz thats what I was trying to do anyway) and skipped converting it back to a new list but wanted to show that step anyway just in case using a LIST was important to someone.

Edited by dankass
Link to post
Share on other sites

You can easily add your code when you post, by clicking on the <> button of the editor.

 

That way it will keep nice formatting and all.

Link to post
Share on other sites
You can easily add your code when you post, by clicking on the <> button of the editor.

 

That way it will keep nice formatting and all.

 

Thanks, yea, I'm not sure how it ended up like that, but I fixed it thanks:)

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...