Jump to content
UBot Underground

[BUY] Thread strategy need the code for it


Recommended Posts

Hi guys oki I want to pay someone to make this for me because the way I'm doing it right now is way to long and frankly stupid I've used so many if else it's crazy :)

Oki this is how I have my bot set up I have 70 sites they are under define command every individual site so I have define site1.com define site2.com etc the variables are collected from a csv file where I have all the info the csv file is set like this 

site1.com(which is the name of the define ) and then | username|password|title|description|text|etc
So what I need is this if the csv file has 40 lines every line is referring to one site define command , I set up 5 threads and what I need is for the bot to open 5 threads and open the 5 sites define commands from the first 5 lines example

thread1

sitename2.com

thread2

sitename1.com

thread3

sitename10.com

thread4

sitename20.com

thread5

sitename40.com

 

then after one is done to open the next line with the next define site and keep it at 5 threads till it's over . 

 

If you need more details for what I need please let me know and i will try to explain  the situation a bit better , or if you have a better idea how I should set up the bot send me a PM or post here on how much will this cost me . 

 

 

Thanks 

Link to post
Share on other sites

Hi.

 

If I understand it correctly, you don't have problems with threads directly.

 

Your challenge ist, that you want to distinguish between 70 sites. The logic for each site is stored in an individual define command.

And you have the name of the site in a variable. 

 

So finally your goal is to call a define command depending on a variable. 

This is not possible out of the box.

 

But it can be done with some plugins. 

"Run external code" is the way to go here.

 

So you have to store logic in individual variables. 

And then use something like:

http://www.ubotstudio.com/forum/index.php?/topic/14197-howtorun-external-scripts/

 

Or:

http://www.ubotstudio.com/forum/index.php?/topic/16097-sell-plugin-advanced-ubot-add-talent-to-your-program-allows-you-to-debug-programs-easier/

 

To run the external code.

 

Other than that you probably have to life with a lot of if then statements. 

It's not looking great, but you can write that very quickly in the code view of ubot studio. 

 

Dan

Link to post
Share on other sites

Dan thank you and you did understand my needs I can work with the run external code plug in I didn't know it's there I will try it right a way and see if it's going to work I will probably add the code from every individual site in to a database and pull the code as it's needed this will reduce the size of my bot which is huge right now I don't know how to repay you so I both your program ubot code safe :) if you have anything else on the market let me know :) 

Link to post
Share on other sites

different platforms but need the same data so you can't use the same code for all sites and just change the url let say they are all different

Link to post
Share on other sites

Dan thank you and you did understand my needs I can work with the run external code plug in I didn't know it's there I will try it right a way and see if it's going to work I will probably add the code from every individual site in to a database and pull the code as it's needed this will reduce the size of my bot which is huge right now I don't know how to repay you so I both your program ubot code safe :) if you have anything else on the market let me know :)

Thanks a lot for your business. But the information was for free :-)

Hopefully it will help you. 

 

Dan

Link to post
Share on other sites

I would set my threading and code up something like this:

 

I did this pretty quick so might need some adjustments just to give you an idea!

ui drop down("Threads", "2,3,4,5,6,7,8,9,10", #UI_Threads)
ui stat monitor("Threads Active: ", #Threads_Active)
save to file("{$special folder("Desktop")}\\Data.csv", "site1.com,site 1 data
site2.com,site 2 data
site3.com,site 3 data
site4.com,site 4 data
site5.com,site 5 data
site6.com,site 6 data
site7.com,site 7 data
site8.com,site 8 data
site9.com,site 9 data")
create table from file("{$special folder("Desktop")}\\Data.csv", &Data)
Start()
define Start {
    set(#Row, 0, "Global")
    set(#Threads_Active, 0, "Global")
    loop($table total rows(&Data)) {
        loop while($comparison(#Threads_Active, ">=", #UI_Threads)) {
            wait(1)
        }
        wait(0.5)
        Open Thread()
        increment(#Threads_Active)
    }
}
define Open Thread {
    thread {
        in new browser {
            Check Site()
            decrement(#Threads_Active)
        }
    }
}
define Check Site {
    set(#Row_Local, #Row, "Local")
    increment(#Row)
    set(#Site_Local, $table cell(&Data, #Row_Local, 0), "Local")
    if($comparison(#Site_Local, "=", "site1.com")) {
        then {
            Site_1()
        }
        else if($comparison(#Site_Local, "=", "site2.com")) {
            Site_2()
        }
        else if($comparison(#Site_Local, "=", "site3.com")) {
            Site_3()
        }
        else if($comparison(#Site_Local, "=", "site4.com")) {
            Site_4()
        }
        else if($comparison(#Site_Local, "=", "site5.com")) {
            Site_5()
        }
    }
}
divider
define Site_1 {
    load html("<h1>Site 1 Script</h1>")
    wait(10)
}
define Site_2 {
    load html("<h1>Site 2 Script</h1>")
    wait(10)
}
define Site_3 {
    load html("<h1>Site 3 Script</h1>")
    wait(10)
}
define Site_4 {
    load html("<h1>Site 4 Script</h1>")
    wait(10)
}
define Site_5 {
    load html("<h1>Site 5 Script</h1>")
    wait(10)
}

Hope that helps!

 

I think it would be better if you gave the site names an id or something similar in column 0, something like #SITE1,#SITE2,#SITE3 etc. That way it would be better when checking the comparison to run the define command, if you get what i mean...

 

Carl  :)

Link to post
Share on other sites

To get the data from the table you can do something like this, by passing in the "Local_Row" to the define command:

ui drop down("Threads", "2,3,4,5,6,7,8,9,10", #UI_Threads)
ui stat monitor("Threads Active: ", #Threads_Active)
save to file("{$special folder("Desktop")}\\Data.csv", "site1.com,site 1 data
site2.com,site 2 data
site3.com,site 3 data
site4.com,site 4 data
site5.com,site 5 data
site6.com,site 6 data
site7.com,site 7 data
site8.com,site 8 data
site9.com,site 9 data")
create table from file("{$special folder("Desktop")}\\Data.csv", &Data)
Start()
define Start {
    set(#Row, 0, "Global")
    set(#Threads_Active, 0, "Global")
    loop($table total rows(&Data)) {
        loop while($comparison(#Threads_Active, ">=", #UI_Threads)) {
            wait(1)
        }
        wait(0.5)
        Open Thread()
        increment(#Threads_Active)
    }
}
define Open Thread {
    thread {
        in new browser {
            Check Site()
            decrement(#Threads_Active)
        }
    }
}
define Check Site {
    set(#Row_Local, #Row, "Local")
    increment(#Row)
    set(#Site_Local, $table cell(&Data, #Row_Local, 0), "Local")
    if($comparison(#Site_Local, "=", "site1.com")) {
        then {
            Site_1(#Row_Local)
        }
        else if($comparison(#Site_Local, "=", "site2.com")) {
            Site_2(#Row_Local)
        }
        else if($comparison(#Site_Local, "=", "site3.com")) {
            Site_3(#Row_Local)
        }
        else if($comparison(#Site_Local, "=", "site4.com")) {
            Site_4(#Row_Local)
        }
        else if($comparison(#Site_Local, "=", "site5.com")) {
            Site_5(#Row_Local)
        }
    }
}
divider
define Site_1(#Row_Local) {
    set(#Row_Local, #Row_Local, "Local")
    load html("<h1>Site 1 Script</h1> {$table cell(&Data, #Row_Local, 1)}")
    wait(10)
}
define Site_2(#Row_Local) {
    set(#Row_Local, #Row_Local, "Local")
    load html("<h1>Site 2 Script</h1> {$table cell(&Data, #Row_Local, 1)}")
    wait(10)
}
define Site_3(#Row_Local) {
    set(#Row_Local, #Row_Local, "Local")
    load html("<h1>Site 3 Script</h1> {$table cell(&Data, #Row_Local, 1)}")
    wait(10)
}
define Site_4(#Row_Local) {
    set(#Row_Local, #Row_Local, "Local")
    load html("<h1>Site 4 Script</h1> {$table cell(&Data, #Row_Local, 1)}")
    wait(10)
}
define Site_5(#Row_Local) {
    set(#Row_Local, #Row_Local, "Local")
    load html("<h1>Site 5 Script</h1> {$table cell(&Data, #Row_Local, 1)}")
    wait(10)
}

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...