Doom989 Posted September 3, 2014 Share Posted September 3, 2014 (edited) Hello everyone. I've wrote this here script to detect when I type, for example, 'rtd 1d4' it then rolls one 4 sided die then outputs the result. Probably doesn't look like it, but I put a lot of work into this lol. I come to you to ask for suggestions. Is there a shorter way to achieve this? Thanks var x,y,i,b,v,f,g, //Integers custom, //Customized roll RD, //rtd 1d RD2D, //rtd 2d D2,D3,D4,D5,D6,D7,D8,D9, DD2,DD3,DD4,DD5,DD6,DD7,DD8,DD9 :integer; procedure Setup; begin custom := TSCARBitmap.Create(''); RD := TSCARBitmap.Create(''); D2 := TSCARBitmap.Create(''); D3 := TSCARBitmap.Create(''); D4 := TSCARBitmap.Create(''); D5 := TSCARBitmap.Create(''); D6 := TSCARBitmap.Create(''); D7 := TSCARBitmap.Create(''); D8 := TSCARBitmap.Create(''); D9 := TSCARBitmap.Create(''); RD2D := TSCARBitmap.Create(''); DD2 := TSCARBitmap.Create(''); DD3 := TSCARBitmap.Create(''); DD4 := TSCARBitmap.Create(''); DD5 := TSCARBitmap.Create(''); DD6 := TSCARBitmap.Create(''); DD7 := TSCARBitmap.Create(''); DD8 := TSCARBitmap.Create(''); DD9 := TSCARBitmap.Create(''); end; procedure Customs; begin if FindBitmap(x,y,custom,68,238,359,271) then begin WriteLn('We rollin'); wait(300); i := 1+Random(10); b := 1+Random(10); v := 1+Random(10); f := 1+Random(10); g := 1+Random(10); typetextEx('Roll 5d10 Result: '+inttostr(i),True,False); typetextEx('+ '+inttostr(b),True,False); typetextEx('+ '+inttostr(v),True,False); typetextEx('+ '+inttostr(f),True,False); typetextEx('+ '+inttostr(g),True,False); typetextEx(' = '+inttostr(i+b+v+f+g),True,False); PressVKey(VK_RETURN); wait(3000); end; end; procedure Singles; begin if FindBitmap(x,y,RD,68,238,359,271) then begin if FindBitmap(x,y,D2,68,238,359,271) then begin WriteLn('We rollin'); wait(300); i := 1+Random(2); typetextEx('Roll 1d2 Result: '+inttostr(i),True,False); PressVKey(VK_RETURN); wait(3000); end; if FindBitmap(x,y,D3,68,238,359,271) then begin WriteLn('We rollin'); wait(300); i := 1+Random(3); typetextEx('Roll 1d3 Result: '+inttostr(i),True,False); PressVKey(VK_RETURN); wait(3000); end; if FindBitmap(x,y,D4,68,238,359,271) then begin WriteLn('We rollin'); wait(300); i := 1+Random(4); typetextEx('Roll 1d4 Result: '+inttostr(i),True,False); PressVKey(VK_RETURN); wait(3000); end; if FindBitmap(x,y,D5,68,238,359,271) then begin WriteLn('We rollin'); wait(300); i := 1+Random(5); typetextEx('Roll 1d5 Result: '+inttostr(i),True,False); PressVKey(VK_RETURN); wait(3000); end; if FindBitmap(x,y,D6,68,238,359,271) then begin WriteLn('We rollin'); wait(300); i := 1+Random(6); typetextEx('Roll 1d6 Result: '+inttostr(i),True,False); PressVKey(VK_RETURN); wait(3000); end; if FindBitmap(x,y,D7,68,238,359,271) then begin WriteLn('We rollin'); wait(300); i := 1+Random(7); typetextEx('Roll 1d7 Result: '+inttostr(i),True,False); PressVKey(VK_RETURN); wait(3000); end; if FindBitmap(x,y,D8,68,238,359,271) then begin WriteLn('We rollin'); wait(300); i := 1+Random(8); typetextEx('Roll 1d8 Result: '+inttostr(i),True,False); PressVKey(VK_RETURN); wait(3000); end; if FindBitmap(x,y,D9,68,238,359,271) then begin WriteLn('We rollin'); wait(300); i := 1+Random(9); typetextEx('Roll 1d9 Result: '+inttostr(i),True,False); PressVKey(VK_RETURN); wait(3000); end; end; end; procedure Doubles; begin if FindBitmap(x,y,RD2D,68,238,359,271) then begin if FindBitmap(x,y,DD2,68,238,359,271) then begin WriteLn('We rollin'); wait(300); i := 1+Random(2); b := 1+Random(2); typetextEx('Roll 2d2 Result: '+inttostr(i),True,False); typetextEx(' + '+inttostr(b),True,False); typetextEx(' = '+inttostr(b+i),True,False); PressVKey(VK_RETURN); wait(300); end; if FindBitmap(x,y,DD3,68,238,359,271) then begin WriteLn('We rollin'); wait(300); i := 1+Random(3); b := 1+Random(3); typetextEx('Roll 2d3 Result: '+inttostr(i),True,False); typetextEx(' + '+inttostr(b),True,False); typetextEx(' = '+inttostr(b+i),True,False); PressVKey(VK_RETURN); wait(300); end; if FindBitmap(x,y,DD4,68,238,359,271) then begin WriteLn('We rollin'); wait(300); i := 1+Random(4); b := 1+Random(4); typetextEx('Roll 2d4 Result: '+inttostr(i),True,False); typetextEx(' + '+inttostr(b),True,False); typetextEx(' = '+inttostr(b+i),True,False); PressVKey(VK_RETURN); wait(300); end; if FindBitmap(x,y,DD5,68,238,359,271) then begin WriteLn('We rollin'); wait(300); i := 1+Random(5); b := 1+Random(5); typetextEx('Roll 2d5 Result: '+inttostr(i),True,False); typetextEx(' + '+inttostr(b),True,False); typetextEx(' = '+inttostr(b+i),True,False); PressVKey(VK_RETURN); wait(300); end; if FindBitmap(x,y,DD6,68,238,359,271) then begin WriteLn('We rollin'); wait(300); i := 1+Random(6); b := 1+Random(6); typetextEx('Roll 2d6 Result: '+inttostr(i),True,False); typetextEx(' + '+inttostr(b),True,False); typetextEx(' = '+inttostr(b+i),True,False); PressVKey(VK_RETURN); wait(300); end; if FindBitmap(x,y,DD7,68,238,359,271) then begin WriteLn('We rollin'); wait(300); i := 1+Random(7); b := 1+Random(7); typetextEx('Roll 2d7 Result: '+inttostr(i),True,False); typetextEx(' + '+inttostr(b),True,False); typetextEx(' = '+inttostr(b+i),True,False); PressVKey(VK_RETURN); wait(300); end; if FindBitmap(x,y,DD8,68,238,359,271) then begin WriteLn('We rollin'); wait(300); i := 1+Random(8); b := 1+Random(8); typetextEx('Roll 2d8 Result: '+inttostr(i),True,False); typetextEx(' + '+inttostr(b),True,False); typetextEx(' = '+inttostr(b+i),True,False); PressVKey(VK_RETURN); wait(300); end; if FindBitmap(x,y,DD9,68,238,359,271) then begin WriteLn('We rollin'); wait(300); i := 1+Random(9); b := 1+Random(9); typetextEx('Roll 2d9 Result: '+inttostr(i),True,False); typetextEx(' + '+inttostr(b),True,False); typetextEx(' = '+inttostr(b+i),True,False); PressVKey(VK_RETURN); wait(300); end; end; end; begin Setup; Wait(1000); repeat wait(200); Doubles; wait(200); Singles; wait(200); Customs; until false; end. Edited September 3, 2014 by Doom989 Quote Link to comment Share on other sites More sharing options...
/LL/TSOOCRUZ/ Posted September 4, 2014 Share Posted September 4, 2014 Hi doom989, you think you can help me out with relogin? Need a relogin script(Username\Password window color: 13388544). Thanks for attention. Quote Link to comment Share on other sites More sharing options...
Doom989 Posted September 4, 2014 Author Share Posted September 4, 2014 Err..I'm not sure what you mean. Quote Link to comment Share on other sites More sharing options...
/LL/TSOOCRUZ/ Posted September 5, 2014 Share Posted September 5, 2014 I need a relogin script, help plx? Quote Link to comment Share on other sites More sharing options...