help :)

Discussion in 'Code Snippets and Tutorials' started by ceneret0023, Oct 4, 2008.

  1. ceneret0023

    ceneret0023 Level III

    Joined:
    Jun 10, 2007
    Messages:
    663
    Likes Received:
    15
    Location:
    under a rock
    ok so i'm making a scar script that will turn expons igloo aber into a multi igloo aber that i can turn on when i leave for school for like 8 hours :)

    my biggest problem is efficiency xD i want to tell scar to check for a bitmap of the yes and tell it if it finds it to check 30 pixels lower, but i want to know if theres an efficient way to make this check for 10 buys without having to do 10 different procedures and hopefully make it smaller code :) also i need this to restart all the variables when i loop back through it 4 or 5 times... any help?


    one last thing is there a way to loop through the code and tell it if x=3 to use the third username? if so how cuz that would cut the code down by a ton :)

    thanks so much :)
     
  2. tharoux

    tharoux Level IV

    Joined:
    Dec 30, 2006
    Messages:
    2,733
    Likes Received:
    126
    Location:
    In front of my PC, Montreal
    If the fields with the value yes are always at the same place but space apart by 30 pixels, you can do a loop using while i and increment that "i" and use it to see where the fields are.
    ie: (that's not the real code, I'm just typing this to give you a general idea)
    while i < 10 do
    begin
    if findbitmapin(bitmap, mousx,mousy,100,i*30,150,(I*30)+30)

    so at the first shot "0" it will search 100,0,150,30
    at "1" it will search 100,30,150,60 and so on...

    and for your last point, you can use an array.
    let's say you put "hi","bye","neopets" in the array, using array[1] will give you "bye". and you can code what's between the bracket with a variable... Hope everything is clear, I just woke up :lol:
     
  3. ceneret0023

    ceneret0023 Level III

    Joined:
    Jun 10, 2007
    Messages:
    663
    Likes Received:
    15
    Location:
    under a rock
    yea i kinda get the idea of what you mean i'll go try to make it work and i'll post back if i need more help :)
     
  4. Dusk412

    Dusk412 Level I

    Joined:
    Aug 2, 2008
    Messages:
    88
    Likes Received:
    9
    If you want a variable x to correspond to each username, make the usernames an array. Then do like Username[x] to call it. So when x is 0 it uses username 0, etc. Good luck :D.
     
  5. chelsea1

    chelsea1 Level IV

    Joined:
    Nov 26, 2006
    Messages:
    2,538
    Likes Received:
    31
    Location:
    London
    i'll post my one which i made for adam as a coding example

    if there's anything you don't understand, please pm me and i'll try and help you

    i have put several comments in, just to tell you why i am doing certain things to help you

    adam, post here or pm me if you don't want this up

    Code (Text):
    1. {.Script Info:
    2. # ScriptName  = Adam's Igloo Setup
    3. # Author      = chelsea1
    4. # Description = Sets up Adam's Igloo abers
    5. # Version     = 1
    6. # Date        = 6th August 2008
    7. # Comments    = Open as many igloo's as you need, imput the usernames and passwords,
    8. # Comments    = make sure the igloos are all open and maximised and run the script.
    9. # Comments    = Also make sure your igloo list is on the desktop and that it's called igloolist.txt
    10. /Script Info}
    11. program Adam_Igloo_Setup;
    12.  
    13. var
    14. igloosymbol, x, y : integer;
    15. authorized, x1, y1 : integer;
    16. info, x2, y2 : integer;
    17. loadlist, x3, y3 : integer;
    18. desktop, x4, y4 : integer;
    19. settings, x5, y5 : integer;
    20. minimize, x6, y6 : integer;
    21. i : integer;
    22. users:Array[1..8]of string;
    23. passes:Array[1..8]of string;
    24.  
    25. { setup player }
    26.  
    27. const
    28. nfuser = 'xxxx';
    29. nfpass = 'xxxx';
    30. NumberOfAccounts = 8;
    31. FileName = 'igloolist.txt';
    32. minwait = '2';
    33. maxwait = '4';
    34.  
    35. procedure Accounts;
    36. begin
    37.  
    38.   //set all user names and passwords correctly please
    39.  
    40.   users[1]:= 'x';
    41.   users[2]:= 'xx';
    42.   users[3]:= 'xxx';
    43.   users[4]:= 'xxxx';
    44.   users[5]:= 'xxxxx';
    45.   users[6]:= 'xxxxxx';
    46.   users[7]:= 'xxxxxxx';
    47.   users[8]:= 'xxxxxxxx';
    48.  
    49.   passes[1]:= 'x';
    50.   passes[2]:= 'xx';
    51.   passes[3]:= 'xxx';
    52.   passes[4]:= 'xxxx';
    53.   passes[5]:= 'xxxxx';
    54.   passes[6]:= 'xxxxxx';
    55.   passes[7]:= 'xxxxxxx';
    56.   passes[8]:= 'xxxxxxxx';
    57.  
    58. end;
    59.  
    60. { End Setup }
    61.  
    62.  
    63.  
    64. procedure declaredtms;    //just some bitmaps and dtms which i use to find things, like the start button and such
    65. begin
    66. igloosymbol := DTMFromString('78DA639461606048614001BF4FDB806946289' +
    67.        'F11A4260B554DECA43FA86AC4814406AA9A6231715435A240221E' +
    68.        '55CD81030750D400008F4008CF');
    69. authorized := BitmapFromString(58, 13, 'beNrlk9tygjAURfn/f3' +
    70.        'Naq+KNKlchF/AXenI2OcYIPui0L82syexkkKzZxGJxvXZgGByc2+v' +
    71.        'QzDH0dUAZkBPWFkRvz4I1pxidMQeh13vCeKzazfF/bJMk+W1bOuKJ' +
    72.        'bcLjiS0bvmjrjn7VFuEvbd/p9tHWefJNEOHQHDnxA7bBcrSVHdiiz' +
    73.        '2iWAVtZiu3dM+/ZTnYLYfdO3y2ExxOnbgJs3WO+WwiHdzWy7W0HBu' +
    74.        'tsB3sh+KCGQLC2IpDZp+pNSbgdDsjW5JhDNxb4hiHnI4CqUfvkfli' +
    75.        'Vuse6FEhGgBU04h+yIasW+MQys1LsRlYwpDBmbxjY7qVV993Zlmbh' +
    76.        'uS16EzFqacLN78g9NCY3o+0pttWZtOdn0qAaDxAL9UI3ZL+zBmF26' +
    77.        'BK4fW5MenNK+hy2LaWJm1EZGL+yCv4y6ladancEZd1uwxeqdkNES3' +
    78.        '1Zhc/QEjs0K5VpdSIouNwdQZQd7eGe3Rxdm07TbIi2WQesYurlE5o' +
    79.        'qbeqtZ+OoQlKhLtcPrISq/IqoyyVRFUzpqItP5oOo8hEsbzvFYpYf' +
    80.        'DsNp2g==');
    81. info := DTMFromString('78DA6394656060306140050673C1142394CB2' +
    82.        '88FA9A666D6095435CA986AAEBCF88FAA460253CDDDF7686AA481' +
    83.        '840E9A7B183C50D580DCAC8DAEC616D3CD68E614746D4155A3012' +
    84.        '4EC50D5886B06A0AAD1C45413955E87A2060087F90F34');
    85. loadlist := BitmapFromString(64, 15, 'beNrVkssOwyAMBPn/D82h' +
    86.        'pC2PBKVpDrWKhCwMzl5dzQFvx0sUxS/X9TXNeX5McxzFNKVk4yQQ5' +
    87.        'xwuI+tIcnv1vkcQKsFlZB0vVMxtCyBUIpP6Q5LhumyTPUoDkfMbhN' +
    88.        'ZnY/dXSxBH35qZjBfIv2Q8tjN/VzMHSZS7OlJ6glDJbKxnJFEKFV+' +
    89.        'ajRhRqGQ21jOSKIXKFdJkrCD82+gSxOGaIg9rWyifKgRvnIdpVr8Y' +
    90.        '5gcleo26');
    91. desktop := BitmapFromString(58, 58, 'beNrtmHlQU3cewPf90dmy3' +
    92.        'Xa2h3Vm25kuu3WZadfFmRZcS1egrLhLK8pR2W1RDkEoyhFErrVGBM' +
    93.        'PEIkEURRxu5FABBWISyEEkCQmEmwSCgRiOyJkgIZiYkN/+Mtg0fay' +
    94.        'Mu+Wh08mbz2Tee/n+8j75nd/f06p1WitWrFh5bgzJJqkcCeEqL+4c' +
    95.        '0zeB7BPf0C+WPJyfee5igl45pWVwRcwniXKAwPRMYYVdEWawZDl8R' +
    96.        'dNDcPsBcEoWJhPyxaKeJc38hok18u6R2eL4TFboaZp3ImVPUpMfkR' +
    97.        'dySXixVVHUN0tTgWKpLq11wb9K4XZZFt+oI/DACn87KfQNSmLQqfO' +
    98.        'qaYzcqqiihKxmv4QGrwTKzkiKL4EXmC3MZCvyOmYbVaBaAYhCzcmW' +
    99.        'hb3FCvfc0YOlClzVKIk+xZIsqDQGiPsFWSTNEMcCEFi3Hn7R5IZby' +
    100.        'rkpLFT/HkXG35ZdEsw2zoEyOSgcAaltupDbqj2Fil05o/vz5Sl1Yy' +
    101.        'T6BGtQqdIsAaNuNfC+XcpgKMVwhA4ck7C1/SKWViYDYUzgTzXhVaP' +
    102.        'bnydlDcwYl5eenS650p4og8Xt47G13RpYj28HnvVPeD/1nlI9b1xW' +
    103.        'rwFrfInUowtk6TunNeabnfdn/pwhd/xOts3jRG3NjZlpBRa2Hx6sP' +
    104.        '84FzjUmtpCmajsmjIZ5S0bmF1hji6fatfuoj13rlvdQQLIAFA2CVC' +
    105.        'GA/USv4pgjCzljm3BdW90TS0sLFRP3sbD94EB9igA43AD2JbqQEql' +
    106.        'RP2fGtU7vRTPieIDUC1gKAA+tHqh1YFoDHiyCyqHvbS2KvHZEaO+M' +
    107.        'y/3Sp736OpwWtI8W1tfWNaz+NB/YlYMPiFLlwqRRP20G2gKLw1JVp' +
    108.        'gLlErPtk/h2sdgjnECws2v7/LcVm19mXq948GB03W2T2OCVVAVTLD' +
    109.        'fqJy2xtEWpSpWgSPTEVrmgKGwZsU3u9kwo5PF4RFtbkf97jR+9kR4' +
    110.        'U0Cbgrq+tw1fX4ptBYIFo+fEECrPtatX+KVDQb7L9U0o/JPSaon7A' +
    111.        'kFVOp9FoV/H4K7+2ybSxiQwOZDJo62vr+HV5HN1w6tbAsk6OYsUWq' +
    112.        'i7qwMyPVbNYKgeCZHu6BE+eZclAZR8gsnVumRLXsAzvf4X6eHsFBw' +
    113.        'VkkTJ6ezrW13a7f0UaU3uqVrSslaGAtiuqc0s/Uj16mbYrS1rRqWk' +
    114.        'aBtd6jYlktSNx+O1jXTHl/cjh9i3OOBwuqqryWn9fl0q5zutvJIH6' +
    115.        'LVWDN9kOo4C2q1Wz04J8Y2Lwd1Ql3caj1SrbpE5IAVs8p5LCIkiI4' +
    116.        'H2XpOzzmZLB/kdLD9d9BoshNvllS/fligyPhlBAW5RqBJ701mtIQq' +
    117.        'z7O0miPyS02p9i0Dt4lkW2ZUg2OaXnXDwvG5FgMd/izjZ5kYZczkN' +
    118.        'bMQpoa6naMwnwfLDzFijnywpZkqsCHRxl2vuXLIvA39n0CeEsMX1I' +
    119.        'IsLI1uPsgHcufJYIBbSVz/+gyh8H3DHwSTVwvAFSeKB2AHxv+0ORb' +
    120.        'YTet3acIZxJHRzow8KWVMx1I4j2XxEZlnpRQFuUKmMEnO8wpROHm8' +
    121.        'C3d022j+7nmOOrBd0IToypbW1T90fHBb6X+/SaLhTQFqXaOAzqBkH' +
    122.        'yXVMqe46/YntxJXhmtuv1Y11IjAhT2zpm35ZQ1u9P9Oo1QhTQdrUq' +
    123.        '7AB5neC7VkASrNhmrwTvvSBEwkxgalvP6n8viPFmbI9B04YC2kJPS' +
    124.        '9U0PohmaHAU0TnqzTvM0+NtEdqJQhhZzW9HDvGRIB4Ea9t3A+jvJo' +
    125.        'kMi60ooK0ZPLWZSC7mshMXu8KWhlJ04/mPZ+tWwmZn+LbH+cjXzSb' +
    126.        '+ycDUFu6mN/s3bo7tDszjz05zDWqOmeHJ9uv8GhEnStMfp5Vl6hQl' +
    127.        '+nmGZQCjm5dJ5ruc4SH7yMiu68hfS2y2Z328OxKuudJ7Yixs4Yrzq' +
    128.        '91Vb4bxEB/qtpOtUnmLXs0281jZYHkJv61u5UaX8V1S2Ig3Bdl9E/' +
    129.        'm0+I2/pNruPO7kEe7zVUhERHhaagqVUj81OY7RnveXuypfDWg2Pfo' +
    130.        'fNa+HtdC77+rVTDPw8hyZuzeT87sIOvLFbeSzipe2X3p7B97O5dhn' +
    131.        'nmGHggNhVgANc3Nzqm9WNbPofb2dMK3F7n3CS24VrwRzENfyJ3zZi' +
    132.        'L/JiS7luuAZpgp0vwGb+FXH9HeckmEre/kFh4cfTkiIgwtWQcFVuG' +
    133.        'EU8DkD4t5RuRTuxdQLc1i/6/jN51UvB3Fgm5pwKkJ2FCDOZYhDHmz' +
    134.        'iPzrjXD0P+x88FBV1FI8/cSGbBJMrJrOxs0MA19aJcRnc22KRvayV' +
    135.        'kB+oRLzuIB9fsXHIhBW41S3awzc0NCQ4NjYaju78/Lz6uloupxk2M' +
    136.        'cxVYIfcgApcAzavO/ZkTkBI9JEj3/w7ORGO6LLSIhq1Ae5T4EQ0Pj' +
    137.        'YyNzu5ke+11gbmzDDJh7sSdjOju6t9WDoAhwkWO9b1YlGthBMv/LS' +
    138.        '+47XyIvMLi+N/LfhcbP8/gdXBG+CPesSzP/FFs13dQywv/+sJ6nz1' +
    139.        '5U/8R0+zXd1DUF+hbj5j2Z/YBGvYrq6Qp9Xzi2C7dvxzr9u1z5/mu' +
    140.        'cYJFrZP6//POMrWGHHrPso2fla32lqxYuVnxX8AO7B3FA==');
    141. settings := DTMFromString('78DA631467646038CC80027E7EFC0DA619A17' +
    142.        'C46909A03A86ADE5DFE8CAA4612C83A8AAAE6E9A1D7A86A4480AC' +
    143.        '23A86ABE3DFF89AA4602C83A89AAE6D8D233A86A1430DD7362F93' +
    144.        '94C353B50D5BC3DFF09550D2BA67B5E1C7F87AA860DC8DA85AAE6' +
    145.        'C3CDAF98E1B31D55CDAF4F7F50D52801595B50D57CBCFD0D53CD4' +
    146.        '5543507171C4755A30C645D4655737BD743143500ADA22D04');
    147. minimize := BitmapFromString(19, 18, 'beNptku1P21UUxxlxmrmI' +
    148.        'ThxC6OgKtOtYy4BVcWV1ApOWAZXnjUELlNH210f6AL9SSnno2ERhw' +
    149.        '02zSJao8YWJiTExJrroYG/8B/SlJmyFFt+Ywa/3nHtrYvTW19yc3F' +
    150.        'fnk/P9fs8x//hH6p/QOhtZoX03sCOOpig0TcGlCLwdylVDIFfnPIR' +
    151.        'XjYuorxO55ZnO8eTX36WpB2zt2+zH32WXvmKTD5jvPnPepfY1artN' +
    152.        'h1eo9UM68D72L2HnIrbG4OIk1LmliqHtmqFfxtfo/e+z6z/8vfx1N' +
    153.        'vo5C64z7yecZeN3cuzoKrV8QAduYXcC2+PYLEK9T1IPbx9veXj1Jn' +
    154.        'Jk9Zvs3Jcs8Clz3WPXb1Mrb75Jexexax7bYnA5lhPPx+mDROeRqka' +
    155.        '3i00/dS/i9Gcs9kWOcnzERri2JdqzgB0z2CJCYwj0fvKWj/eTOg+p' +
    156.        'dZMaYV9j2znR/jMPhPua+H+WbYUN8kHzlFNGEd8Jcgp0XlLjJlqBa' +
    157.        'ATQClAtSJqxFAdbpoE74tT4HWZdplcStDOOl6exeRIMAXjTR8664Y' +
    158.        'wAagecskOVEzSCVGXbkbU/4iDfhW01J3LwFvdFzTE0RrAxDPoA6Hx' +
    159.        'E6wa1AJUOKLeD0gGnndLpsZ3StkcXgoSHxqOzLOcC4e7McTRGoTEC' +
    160.        '+jDogqDxwykPVLjwpIDlTlAKktKWLmnbqPeRrgW8spSj+N+9kDsD4' +
    161.        'ww2TmODCLowaIKo8mO5F8vcKHehwpVR2NJFrRt1btI2C70J7L9B+x' +
    162.        'KUh9wxj6ZZbIrhhSjqIqidQlWIKgJU5keZF2UuIhtNv2raPGMnfEf' +
    163.        'mOeRITwK7OLhATXPYPIeGOL4RQ22UqkSqCNPSAC320WIXKRrefdn4' +
    164.        'WGnLGELENAPmefz3oKeNUdU0OynSkhAt8tNCgbxi+fPFS5tllgzPn' +
    165.        'B926wwcDM5SZZSViez1EDvmpS/ZydGB3ecbHxcPZKqdRB8gTeLBYF' +
    166.        'WMVUbZCZEdD7ECDzsyRg737+Zf3HytP6O05W7pfIAYwmAIY8MknJ+' +
    167.        'CehHqIqiJUKVI5VO0JEiP+dhRJz08QvJ70ocMGwWdf8kGn6nH9s46' +
    168.        '986593We/VqPVOuVqv1S1YSknMjI/ZkSLyl0ES7yhZFM/rW9vI5kn' +
    169.        'v6h2rpV+N5Wad+W4lpSOfRUZXlSOfS0wppUWJNl1mTpcKrImiq0pA' +
    170.        'sGU0eupp/rTR8yJ/Pe/U3+H/OySPc=');
    171. end;
    172.  
    173. procedure mainloop;
    174. begin
    175. finddtm(igloosymbol,x,y,0,0,1278,768);
    176. clickmouse(x,y,true);
    177. wait(500);
    178. clickmouse(x+173,y+52,true);
    179. wait(500);
    180. sendkeys(nfuser);
    181. keydown(9);  // tab
    182. wait(10);
    183. keyup(9);    // tab
    184. wait(100);
    185. sendkeys(nfpass);
    186. wait(100);
    187. keydown(9);  // tab
    188. wait(10);
    189. keyup(9);    // tab
    190. wait(100);
    191. keydown(13); // enters auth details
    192. wait(10);
    193. keyup(13);
    194. repeat
    195. wait(1000);  // waits to auth
    196. until(findbitmap(authorized,x1,y1))
    197. keydown(9);  // tab
    198. wait(10);
    199. keyup(9);    // tab
    200. wait(100);
    201. sendkeys(users[i]);
    202. wait(100);
    203. keydown(9);  // tab
    204. wait(10);
    205. keyup(9);    // tab
    206. wait(100);
    207. sendkeys(passes[i]);
    208. wait(100);
    209. keydown(9);  // tab
    210. wait(10);
    211. keyup(9);    // tab
    212. wait(100);
    213. keydown(13); // enter
    214. wait(10);
    215. keyup(13);   // enter login details
    216. repeat
    217. wait(100);
    218. until(finddtm(info,x2,y2,0,0,1000,1000))
    219. clickmouse(x2+70,y2+110,true); // close window
    220. wait(500);
    221. finddtm(igloosymbol,x,y,0,0,1278,768);
    222. clickmouse(x+100,y+60,true);
    223. wait(500);
    224. findbitmap(loadlist,x3,y3);
    225. clickmouse(x3,y3,true);
    226. wait(500);
    227. findbitmap(desktop,x4,y4)
    228. clickmouse(x4,y4,true);
    229. wait(500);
    230. sendkeys(filename);
    231. wait(500);
    232. keydown(13); // enter
    233. wait(10);
    234. keyup(13);   // loads list
    235. wait(5000);
    236. clickmouse(x3+200,y3-210,true); // closes window
    237. wait(500);
    238. finddtm(igloosymbol,x,y,0,0,1278,768);
    239. clickmouse(x+122,y+67,true);
    240. wait(500);
    241. sendkeys(minwait);
    242. keydown(9);  // tab
    243. wait(10);
    244. keyup(9);    // tab
    245. wait(100);
    246. sendkeys(maxwait);
    247. wait(100);
    248. finddtm(settings,x5,y5,0,0,1000,1000);
    249. clickmouse(x5+300,y5-33,true);
    250. wait(100);
    251. finddtm(igloosymbol,x,y,0,0,1278,768);
    252. clickmouse(x+15,y+60,true); // starts igloo
    253. wait(1000);
    254. findbitmap(minimize,x6,y6);
    255. clickmouse(x6,y6,true);
    256. wait(2000);
    257. end;
    258.  
    259.  
    260. begin
    261. wait(5000);
    262. i:=1;
    263. declaredtms;
    264. accounts;
    265. for i := 1 to NumberOfAccounts do
    266. mainloop;
    267. end.
     
    Zer0 likes this.