nemolorn Posted June 8, 2012 Share Posted June 8, 2012 (edited) Having a bit of trouble with the Loop, First time trying to manipulate an Array and adding a timer-type function to it. First, in the actual Program, where I'm having my main problem, I want to check each array, in a random order, and change them each from 'Ready' to 'Done'. When they are All Changed to 'Done', I need to record that all three are 'Done', then wait until at least 30 seconds has passed from the first change from 'Ready' to 'Done' After the 30 seconds have passed, I need to repeat the process 2 more times, with at least 30 seconds passing between each cycle. So the script must last at least 1 and a half minutes. The three identified Bugs I'm running into in this script are 1) It's only checking 2 of the 3 WORDS before saying it's checked and changed all three to 'Done' 2) Sometimes when it repeats the first loop, it will not Reset the WORDS back to 'Ready' 3) Sometimes it will not record a new Stime when starting a new run cycle, so the final run starts immediately, instead of waiting the 30 seconds. ** Wait function won't work for my final product, because the Timing will need to be Actual Time of Day and Day of Week Sensative. Haven't figured how to implement that yet. The "Practical" Application will be to Co-ordinate 64-128 bots, cycling their login and actions in a random order, but also ensuring that each accomplishes their Task by the end of the day Applied to RS2 might be to log in a bot, walking them to a mine location, logging off, then onto another bot to move them to a Yew, logging off, logging into a third bot who makes a run to the bank to deposit runes before logging into the second bot to cut the yet then back to the third bot to find more runes, finally going back to the first bot who will just start to mine. Completely Impractical for RS, but I hope that helps explain the non-sequential Order of Operations As a secondary note, If you can help make this a bit more streamlined, in the Function NLSAC, I'm essentially trying to Change the information in the Array After I access it. I.E. 'Ready' - 'Set' - 'Go' - 'Wait' And put it back in an array, so that the other two arrays are dynamically aware of the change to respond at each change, with a measured delay(3-5 minutes, so removed for testing) I.E. Name1 changes to 'Set' Alerts Name2 to change to 'Go' and Name3 to change to 'Ready' [scar]program NLSRandomEntry; //Written by Janilabo 3-11-2012 function TSAToParts(TSA: TStringArray; partSize: Integer): array of TStringArray; var i, i2, r, h, d: Integer; begin h := High(TSA); if (h >= 0) and (partSize > 0) then if partSize <= h then begin Inc(h); r := (h div partSize); if (r * partSize) < h then Inc®; SetLength(Result, r); for i := 0 to (r - 1) do for i2 := 0 to (partSize - 1) do begin SetLength(Result, partSize); if d < h then begin Result[i2] := TSA[d]; Inc(d); end else begin SetLength(Result, i2); Exit; end; end; end else Result := [TSA]; end; // Originally Written by Janilabo 3-11-2012. // Modified into a funtion by Nemolorn 6-8-2012 function NLSAC(TSA:TStringArray):TstringArray; var h, h2, i, i2: Integer; s: ansistring; T2DSA: array of TStringArray; begin T2DSA := TSAToParts(TSA, 9); SetLength(TSA, 0); begin h2 := High(T2DSA); for i2 := 0 to h2 do s := s + T2DSA[i2] + ', '; SetLength(T2DSA, 0); if (i = h) then Begin IF Startswith('Ready, ',s) = True Then s := Replace(s,'Ready, ','Done, '); WriteLn(Copy(s, 0, Length(s) - 2) + '.') Result := Explode(', ', (Replace((GetDebugLine(GetDebugLineCount-1)),'.',''))); end else Begin IF Startswith('Ready, ',s) = True Then s := Replace(s,'Ready, ','Done, '); WriteLn(s); end; s := ''; end; SetLength(T2DSA, 0); end; var WORDS: array of TStringArray; Stime,NTime,WTime:Double; w,z,i,Run : integer; begin Repeat SetArrayLength(WORDS, 3); WORDS[0] := ['Ready','Name1','Action']; WORDS[1] := ['Ready','Name2','Action']; WORDS[2] := ['Ready','Name3','Action']; Stime := Now; WTime := 0000.00040013659; // Approx 30 seconds Ntime := STime + WTime; Writeln(TimeToStr(Stime)); Repeat begin w:=3; z:=3; i:=Random(z); IF InStrArr('Ready',WORDS,false) = True Then Begin writeln('WORDS['+InttoStr(i)+']'); WORDS := NLSAC(WORDS); end Else IF InStrArr('Done',WORDS,false) = True Then; end; until InStrArr('Ready',WORDS[0],false) AND InStrArr('Ready',WORDS[1],false) = FALSE; run := run+1; Writeln(run) Repeat Wait(1000) until Ntime< Now; until Run = 3; end.[/scar] Edited June 8, 2012 by nemolorn Quote Link to comment Share on other sites More sharing options...
LordJashin Posted June 8, 2012 Share Posted June 8, 2012 (edited) Having a bit of trouble with the Loop, First time trying to manipulate an Array and adding a timer-type function to it. So let me guess. You are going to try to bot over proxy's on RS, and you want a system that randomizes everything. Mainly, login, and the botting. You need to slow down with this, work on your knowledge of SCAR so you don't run into errors with your scripting. Break it into steps. There's no way in hell you are getting 64-128 bots cycling with SCAR off proxies. Afaik. Before you worry about that script. SCAR can't control multiple S.M.A.R.T's, it isn't feasible because SCAR does not have multi-threading afaik. So you could have one SCAR running for each S.M.A.R.T client. Then have like a form for running time, script, etc. If I were you though I'd worry about getting a script perfected for Runescape before trying to run multiple bots with different/ or same script running for runescape. If you are trying to do this with anything besides S.M.A.R.T it is impossible. EDIT: I'm still confused here, so you want arrays that are aware of the changes of their counterparts? If this is for RS, this will probably require multi-threading if the arrays are each bot. Edited June 8, 2012 by LordJashin Quote Link to comment Share on other sites More sharing options...
nemolorn Posted June 8, 2012 Author Share Posted June 8, 2012 (edited) No, I haven't played RS in over a year, Just drew the analogy since that was a familiar medium. It's for a PHP based game, you log in, push 3-9 buttons - depending on your level, occupation, and wealth they may appear in different places, or have pop-ups - then log out. You can get it done manually in about 5 minutes. However, The anti-bot process they use, if they notice multiple people doing the same actions in the same order for more than 3 days, they may send them a warning, or simply eradicate them immediately. We tested it with Non-bot players a few months back. I honestly have no Idea now to use S.M.A.R.T., and it's not incorporated in any stage of the completed script. Mostly Findbitmap, FindClient, Movemousesmooth, Clickmousesmooth. And it doesn't need to multi-thread. Step 1 - Log into account from Array Step 2 - Perform Random Action from options in Array Step 3 - Log out and change array to reflect which option was completed Repeat until all actions(3-9 actions) from all accounts have been completed IF There is time left between the start of the first log in and the end of the time limit, they will move individual inventory to 1 predetermined location. The Reason why the IRL Time Dependancy is Key over a Wait Function, is I have 4 computers that will need to run this script in sync to spread the memory load over a different array of proxies, but during emergencies(Attack or Political Treason) All of them in certain areas will need to act at the same time. *EDIT: I'm still confused here, so you want arrays that are aware of the changes of their counterparts? If this is for RS, this will probably require multi-threading if the arrays are each bot. Again, this isn't for RS2, This is for a php image game, nothing with moving graphics yet. But if there is a scripting competition coming up and around, I'll have to log in and see how much has changed and maybe try my hand, once I figure out what S.M.A.R.T. is. I'll try and explain it with Whack-A-Mole You start playing at noon. You have 3 Whack-a-Mole games sitting side by side. Every 10 seconds 1 Mole will pop out of 1 hole in one of the 3 games and stay up until it is hit. If you hit the mole before ten seconds pass, you still have to wait the full 10 seconds for the next mole to come out of it's hole. If you take 30 seconds to hit the mole, the next mole will pop up instantly. After hitting that mole, it won't come back up until ALL the moles in all three games have been hit once. When all the moles in 1 game are hit, the lights flash on the game until the same qualifier of all the moles in the other adjacent games are hit as well When All three Whack-a-moles realize that all the moles have been hit, they all have their lights flashing, They reset. If you happen to hit all the moles before 12:05 pm, you will incur a bonus round of all the moles popping up at once, where you just wail away until time runs out. I hope you understand that better, I had my kid cousin help me with that analogy Edited June 8, 2012 by nemolorn Quote Link to comment Share on other sites More sharing options...
LordJashin Posted June 8, 2012 Share Posted June 8, 2012 (edited) Applied to RS2 might be to log in a bot, walking them to a mine location, logging off, then onto another bot to move them to a Yew, logging off, logging into a third bot who makes a run to the bank to deposit runes before logging into the second bot to cut the yet then back to the third bot to find more runes, finally going back to the first bot who will just start to mine. Completely Impractical for RS, but I hope that helps explain the non-sequential Order of Operations You need to be more straight forward next time. Probably scared others from replying. I directed my response toward RS because that's what I thought you were going for. If you said anything about a web based game other than RS that would've totally changed my response. [sMART] S.M.A.R.T is a runescape client you can have on your computer. It can be minimized, and still be botting while you do other things. So with that you can run multiple SMARTS, but you would need multiple SCAR's running to control each one separately. What I was saying was if you wanted one script to control multiple SCAR bot's that would be impossible because SCAR cannot do 2 things at the same time, like control 2 SMART Runescape clients and bot and chop wood at the same time. [/sMART] The analogies you've been making are fine, its just to reproduce them with SCAR if there is one discrepancy you might have to change something. This is why I prefer steps, so I can try to understand what you are trying to do, and if it makes sense possibly help you out. [APPA] So if you read what I said about S.M.A.R.T, basically one computer can have many scripts running that bot on Runescape ( one could do mining, another account wood cutting, etc ). This is possible because of SMART, it is minimizable. Your game is also web based, there is a way to do this same thing on your game. Using APPA, you have basically a minimizable Internet Explorer that can have a bot running on it while it is minimized. This could work for you, I'm not sure if each individual APPA can have a different proxy set. Even so you might be using a program on your computer that directs all the internet into a proxy, not just that specific browser. I think APPA does have some proxy commands though. [/APPA] APPA aside, about this game...Is it static, is there always the same options, actions, etc? So if you want to read the page to see what option was picked, or whatever. You can either save the page and look through its source code with GetPage(); in SCAR or use SCAR's OCR screen reading functions. You want 4 computers to be in sync with each other. That's a tough one, you would have to make some system for them to post to a file on the web maybe. So maybe like... Computer 1 says: target destroyed Computer 2 Responds: Selecting Next target etc. EDIT: So this game is like Civilization/army based. Probably all text based too. PHP, nah I bet you could read the page, and figure out what happened. Unless it is all images. Maybe PM me a screen shot of the game, or tell me what it is, and I can investigate that. Also I don't think you need any anti-bot mouse movements, unless they record mouse movements somehow or you click and drag something. You said their anti-bot system was based on the actions selected or w/e. About the array's, you would probably have to use the arrays to post to the web file so your other bots on other computers could read it. Randomizing the login's, and having them read the file and act upon/change it, that's one way of doing it... Edited June 8, 2012 by LordJashin Quote Link to comment Share on other sites More sharing options...
nemolorn Posted June 9, 2012 Author Share Posted June 9, 2012 (edited) The game is mostly Static. First I should explain the Banning functions that I've come across. Each character is given a sequential ID number. Each IP can Sustain no more than 5 accounts, and each of these accounts must be declared, and can never perform military action. But if you only have 2 accounts, they must still be declared, but can never meet and cannot take the same order of actions, but are only limited to not performing military actions on the same day. Also, if per chance multiple people that share similar traits(Same signup IP, Similar Email address, Same Likes, Same Password, Same profession) OR Perform the same operations in the same order, or perform the same operation "too quickly" before the a like identified character, can also be targeted. Breaking any of these can lead to investigation(losing ability to act for a day) and Death(If they suspect you of cheating) They don't record mouse movements, but they can detect if you are accessing the site directly through the Raw Address, or if you are using the normal routine of pushing the buttons. I've broken this down into 5 stages of development 1) Creation of accounts and datamining(85% complete) 2) Randomization script(85% Stage I'm looking for help with) 3) Action Scripts(45% Complete, but further development stalled for 14 days until level up) 4) Market Manipulation(Coding Pending) 5) New Character Creation Bot(Starting today, 9-14 day process because of annoying "training" process As for images The Game is mostly static. Same place to each, Same place to pray. Getting a Job is about the only option that isn't always static. You can get a contract from another player, but that form changes depending on who is hiring, or if anyone is allowed to hire during that time slot(This is where multiple computers and RL timing come in, One computer will post jobs here and the other computer will take the jobs, also the Stage 3 of my process) The other job option, to get a contract from the principality, is static to your physical location. So each account has a Specific SSID that determines where they can get a "government" job. Further, Once they have that location, they can have up to 6 different choices that aren't sequential, and may be supporting foriegn powers if you don't know which is a local job and which is a foreign job. Coding in the game, there is no way to "know" which buttons are local or foreign, the Leader of the local group usually sends out an IG message every few days informing the people which of these options need to be worked, or need to be ignored. Finally, we have buying and selling. Each transfer can take up to 30 minutes, and the local leader has the ability to change all the prices at once with the click of a button, which makes this bit of code annoying, because, again, this needs to co-ordinate with another computer, so that a real player doesn't buy up the transfer items before time.(Stage 4) ---------- I found the Kink in my Code posted earlier, I just needed to move where the repeat started and change my second repeat clause. Posting this here while I look into randomizing and qualifying the actions *Action[1..3] = Finished action[1.3], Qualify IF EquipmentStatus/Replacement Null,good, broken, being repaired, and If I need to purchase a replacement [scar]begin Repeat SetArrayLength(WORDS, 4); //include the name of the Menus at the beginning (File, Edit, etc) WORDS[0] := ['Ready','Name1', 'proxy location', 'action1', 'action2', 'action3', 'EquipmentStatus', 'Replacement']; WORDS[1] := ['Ready','Name2', 'proxy location', 'action1', 'action2', 'action3', 'EquipmentStatus', 'Replacement']; WORDS[2] := ['Ready','Name3', 'proxy location', 'action1', 'action2', 'action3', 'EquipmentStatus', 'Replacement']; WORDS[3] := ['Ready','Name4', 'proxy location', 'action1', 'action2', 'action3', 'EquipmentStatus', 'Replacement']; Stime := Now; WTime := 0000.00040013659; // Approx 30 seconds Ntime := STime + WTime; Writeln(TimeToStr(Stime)); Repeat begin w:=2; z:=2; i:=Random(z); IF InStrArr('Ready',WORDS,false) = True Then Begin writeln('WORDS['+InttoStr(i)+']'); WORDS := NLSAC(WORDS); end Else IF InStrArr('Done',WORDS,false) = True Then; end; until InStrArr('Done',WORDS[0],false) AND InStrArr('Done',WORDS[1],false) = True; run := run+1; Writeln(run) Repeat Wait(10) until Ntime< Now; until Run = 3; end.[/scar] As for being straightforward, I'm a politician in this game, so I am rarely straightforward about anything. Edited June 9, 2012 by nemolorn Quote Link to comment Share on other sites More sharing options...
LordJashin Posted June 9, 2012 Share Posted June 9, 2012 (edited) I've broken this down into 5 stages of development 1) Creation of accounts and datamining(85% complete) 2) Randomization script(85% Stage I'm looking for help with) 3) Action Scripts(45% Complete, but further development stalled for 14 days until level up) 4) Market Manipulation(Coding Pending) 5) New Character Creation Bot(Starting today, 9-14 day process because of annoying "training" process You seem to be very motivated to script for this game, so you will probably get it done one way or another. I'm still confused to hell about what you're coding. The Randomization has to be built into the main script, I don't see how it can be separate. When you pick an action or w/e you have to be random about it. If I were you I would first get information about the game in the script ( like arrays of the actions/classes/w/e u can ) built into the script, not read off from the game. Then have it so you can configure what character your playing as. Maybe Wizards have different options from Warriors or something. The randomization would just be picking a random action from the array. Get the floor down, then build code that will read what your character has ( equips ). It really depends on what you want the character to be able to do. If you want it to go hit stuff based on its inventory, and equips. Or maybe you have to have an equip for the actions, but it breaks every once and a while. So you have to check if its there, and if it breaks get a new one? Well my main point is, to break this all down into many functions that do roughly one thing only. Like you could have one for posting to a web page, and one for reading from it. And have both change global booleans that you can utilize when choosing actions to pick. Good luck with this, also how is this WTime := 0000.00040013659; // Approx 30 seconds 30 seconds? Edit: A politician with whack-a-mole pretensions Edited June 9, 2012 by LordJashin Quote Link to comment Share on other sites More sharing options...
nemolorn Posted June 9, 2012 Author Share Posted June 9, 2012 (edited) You'll see in the updated bit of code, I've changed the WORDS arrays to : ['Ready','Name4', 'proxy location', 'action1', 'action2', 'action3', 'EquipmentStatus', 'Replacement']; Ready - Describes whether all actions have been completed. Each action depends on the development of the character. Action one and two have the same variables until level 2. I don't have any level 2 characters right now >_>. Employ or Engage Action 3(and 4) is reserved for level 2+ characters, so "ignored". Equipmentstatus has Null, Equiped, Empty. Only about 1/4 of the characters need equipment. If they have Equipment, they should also have a replacement, because they can take up to 6 days to acquire. Once I have these working, I have to add 'Cact' which would determine if the character has been engaged in actions 1-4, and if he hasn't, to engage in a longer set of variables, which I should have completed by sunday. These are the base actions. There are more, pop-ups, one time events, and reading I'll need to figure out, but I've included a pause script so that it alerts me and waits for me to finish those tasks manually right now, until I figure out how to automate them as well. Then, Voting, which practically applies to me as stuffing the ballot As for the WTime, it's a Double type variable, meaning I can use that to add a set amount of time to the start time. by changing that variable, I can tell my script to wait until a certain time of day to do something else. For testing, I am just having it wait 30 seconds between each run, but will ultimately need to increase this wait to 45 minutes or possibly longer. Once This is more workable, I can add another Double Variable to tell my script to wait until a certain time of day to even start, and to be finished by a certain time of day. Double is the same Class?Type? as the Time, and Now constants. Edited June 9, 2012 by nemolorn Quote Link to comment Share on other sites More sharing options...