brusacco 20 Posted September 29, 2013 Report Share Posted September 29, 2013 Hello, 1) I have a list of 10 users in a CSV file. 2) All users are loaded into a table and each row launch a new thread(login, etc) 3) Each thread scraps some data and post to a site(this info is in the table too, from the CSV) The CSV is like this: user, url, category So we have the username, the pass is harcoded, the url to scrape, and the category to post it My question is this: The tables are global?The "Define" command, its params are pased by reference o by value?The login one works file ... But the poster, seems to screw the table somehow ... or the listscell(&users, #counter, 1) is the origin url to scrape tocell(&users, #counter, 2) is the category to post it in my site create table from file("orders.txt", &users) set(#counter, 0, "Global") loop($table total rows(&users)) { thread { in new browser { Login Pinterest($table cell(&users, #counter, 0), "single password here") Poster($table cell(&users, #counter, 1), $table cell(&users, #counter, 2)) } increment(#counter) } } Inside the defined POSTER I build a list of scraped values, are those list local to each thread? I have set them to "LOCAL" but I cant find documentation about scopes of variables to get it right. Seems to me that each thread is overwriting the "LOCAL" list ... of the other threads Thanks. Quote Link to post Share on other sites
HelloInsomnia 1103 Posted September 29, 2013 Report Share Posted September 29, 2013 I'm not sure if this will fully answer your question but it may help you to understand better: Global means it is seen and used by everything. So when you have a global table each thread can see everything in the table and interact with it. Local means that only that one thread can see it. So when you have a local list for example you don't need to clear it because it is being created and at the end of the thread it is destroyed. No other thread can interact with it so that means if you want to keep the data you need to eventually add it to a global list or save it out in each instance of the threads. Quote Link to post Share on other sites
brusacco 20 Posted September 29, 2013 Author Report Share Posted September 29, 2013 Thanks a lot for the reply ... and how about the DEFINE commands?The parameters are passed as values or reference? Thanks Quote Link to post Share on other sites
HelloInsomnia 1103 Posted September 29, 2013 Report Share Posted September 29, 2013 Values. Take a look at this: set(#number, 0, "Global") add num(10) define add num(#number) { set(#number, 50, "Global") } You will see that the #number changes because it is global if it were local it would not show up because it would be local to the command or thread. Just like I did here, you can see that #number will remain 0 but it is returned as 50 because it is set to local (but you won't see it change to 50 in the debugger) set(#number, 0, "Global") set(#result, $add num(#number), "Global") define $add num(#number) { set(#number, 50, "Local") return(#number) } Quote Link to post Share on other sites
brusacco 20 Posted September 29, 2013 Author Report Share Posted September 29, 2013 Thanks a lot for your help I'll make some more code and get the resuts. Quote Link to post Share on other sites
bestmacros 60 Posted September 29, 2013 Report Share Posted September 29, 2013 note that "local" parameter will work only inside define Quote Link to post Share on other sites
UBotDev 276 Posted September 29, 2013 Report Share Posted September 29, 2013 The problem with your code is that you increment "#counter" inside the thread, so it stays the same till thread finishes (that's why most if not all threads use value 0 as "#counter). Instead you should move "#counter" outside from the thread and wrap the whole thread node in define command and pass #counter value as parameter. If you don't pass "#counter" as parameter, the thread could use a wrong value, since you would first spawn a thread which takes almost zero time, and then you would increment "#counter" (outside thread), which would then be used by thread you spawned (for example, when you start bot "#counter" has value 0, but as soon as thread is spawned, that global variable value changes to 1, and 1 is the value that is used inside first thread, where bot should be using "counter = 0" ). Quote Link to post Share on other sites
brusacco 20 Posted September 29, 2013 Author Report Share Posted September 29, 2013 UbotDev.com, yes eventualy I came up with that ... Now I have 10 instances running like a charm.Thanks for all the help ... I just get the PRO, so I'm new in Ubot threads ... Quote Link to post Share on other sites
brusacco 20 Posted September 29, 2013 Author Report Share Posted September 29, 2013 I also note that here in the forum still says "License: Standard" Quote Link to post Share on other sites
UBotDev 276 Posted September 30, 2013 Report Share Posted September 30, 2013 UbotDev.com, yes eventualy I came up with that ... Now I have 10 instances running like a charm.Thanks for all the help ... I just get the PRO, so I'm new in Ubot threads ...OK, nice....according to your previous reply I thought that it's still unclear to you, that's why I wanted to explain. Good luck with your projects! I also note that here in the forum still says "License: Standard" I didn't even notice that... however, I believe you need to change that manually. Quote Link to post Share on other sites
brusacco 20 Posted September 30, 2013 Author Report Share Posted September 30, 2013 OK, nice....according to your previous reply I thought that it's still unclear to you, that's why I wanted to explain. Good luck with your projects! I didn't even notice that... however, I believe you need to change that manually. Indeed, It was .. thanks for all the clarifications. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.