PDA

View Full Version : form help plz



bbri06
10-28-2006, 02:23 AM
i am having problems with my form and i was hoping i could get some help
here is the problem
how can i get wat is in the form into setting in the script(hope that makes sense)for example get what is typed in the username box into the username spot in declare players


{ BBRI06's Draynor Willow Chopper
VERSION 2

SETUP LINES 28-31
START BY DRAYNOR WILLOWS

FEATURES
1. SOME ANTI RANDOMS

THINGS TO ADD IN THE FEATURE
}




program autowcbankandchop;
{.include SRL/SRL.scar}
{.include/SRL/SRL/bank.scar}
{.include/SRL/SRL/Core/Mouseflag.scar}
{.include/SRL/SRL/Core/Object.scar}
{.include/SRL/SRL/Core/Color.scar}
{.include SRL/SRL/Skill/WoodCutting.scar}

var
a,b:integer;
banked:integer;
powerchop:boolean;
bbri06form : TForm;
username : TLabel;
password : TLabel;
timestobank : TLabel;
nicknamelabel : TLabel;
passwordbox : TEdit;
startbutton : TButton;
powerchopcheck : TCheckBox;
timestobankbox : TEdit;
usernamebox1 : TEdit;
timestobankbox1 : TEdit;
nicknamebox : TEdit;
username1,password1,nickname1 : string;

const
banksymbol=4634589;//reset numbers
fishingsymbol=16078084;//reset numbers
bankdepositbox=6713464;//the grey color of the bank deposit box



procedure ButtonClick(sender: TObject);
begin
WriteLn('You have clicked the button');
bbri06form.Caption:= bbri06form.Caption + '.';
bbri06form.ModalResult:= mrOk;
end;



procedure initform;
begin
bbri06form := CreateForm;
bbri06form.Left := 566;
bbri06form.Top := 112;
bbri06form.Width := 375;
bbri06form.Height := 151;
bbri06form.Caption := 'SETUP BBRI06 DRAYNOR CHOPPER';
bbri06form.Color := clBtnFace;
bbri06form.Font.Color := clWindowText;
bbri06form.Font.Height := -11;
bbri06form.Font.Name := 'MS Sans Serif';
bbri06form.Font.Style := [];
bbri06form.Visible := false;
bbri06form.PixelsPerInch := 96;
username := TLabel.Create(bbri06form);
username.Parent := bbri06form;
username.Left := 22;
username.Top := 17;
username.Width := 61;
username.Height := 13;
username.Caption := ' username';
password := TLabel.Create(bbri06form);
password.Parent := bbri06form;
password.Left := 22;
password.Top := 45;
password.Width := 60;
password.Height := 13;
password.Caption := ' password';
timestobank := TLabel.Create(bbri06form);
timestobank.Parent := bbri06form;
timestobank.Left := 123;
timestobank.Top := 74;
timestobank.Width := 63;
timestobank.Height := 13;
timestobank.Caption := 'times to bank';
nicknamelabel := TLabel.Create(bbri06form);
nicknamelabel.Parent := bbri06form;
nicknamelabel.Left := 37;
nicknamelabel.Top := 101;
nicknamelabel.Width := 49;
nicknamelabel.Height := 13;
nicknamelabel.Caption := ' nickname';
passwordbox := TEdit.Create(bbri06form);
passwordbox.Parent := bbri06form;
passwordbox.Left := 93;
passwordbox.Top := 40;
passwordbox.Width := 121;
passwordbox.Height := 21;
passwordbox.TabOrder := 9;
passwordbox.passwordchar:='*';
startbutton := TButton.Create(bbri06form);
startbutton.Parent := bbri06form;
startbutton.OnClick := @ButtonClick;
startbutton.Left := 243;
startbutton.Top := 19;
startbutton.Width := 90;
startbutton.Height := 35;
startbutton.Caption := 'START!';
startbutton.TabOrder := 10;
powerchopcheck := TCheckBox.Create(bbri06form);
powerchopcheck.Parent := bbri06form;
powerchopcheck.Left := 38;
powerchopcheck.Top := 72;
powerchopcheck.Width := 97;
powerchopcheck.Height := 17;
powerchopcheck.Caption := ' powercut?';
powerchopcheck.TabOrder := 11;
timestobankbox := TEdit.Create(bbri06form);
timestobankbox.Parent := bbri06form;
timestobankbox.Left := 1101;
timestobankbox.Top := -80;
timestobankbox.Width := 18;
timestobankbox.Height := 21;
timestobankbox.TabOrder := 12;
usernamebox1 := TEdit.Create(bbri06form);
usernamebox1.Parent := bbri06form;
usernamebox1.Left := 94;
usernamebox1.Top := 13;
usernamebox1.Width := 121;
usernamebox1.Height := 21;
usernamebox1.TabOrder := 14;
timestobankbox1 := TEdit.Create(bbri06form);
timestobankbox1.Parent := bbri06form;
timestobankbox1.Left := 190;
timestobankbox1.Top := 71;
timestobankbox1.Width := 24;
timestobankbox1.Height := 21;
timestobankbox1.TabOrder := 13;
nicknamebox := TEdit.Create(bbri06form);
nicknamebox.Parent := bbri06form;
nicknamebox.Left := 95;
nicknamebox.Top := 96;
nicknamebox.Width := 121;
nicknamebox.Height := 21;
nicknamebox.TabOrder := 14;
nicknamebox.Text := '3 letters from username';
end;



procedure SafeInitForm;
var
v: TVariantArray;
begin
setarraylength(V, 0);
ThreadSafeCall('InitForm', v);
end;



procedure ShowFormModal;
begin
bbri06form.ShowModal;
end;



procedure SafeShowFormModal;
var
v: TVariantArray;
begin
setarraylength(V, 0);
ThreadSafeCall('ShowFormModal', v);
end;



procedure setupall;
begin
username1:=usernamebox1.text;
password1:=passwordbox.text;
nickname1:=nicknamebox.text;
if(powerchopcheck.state=cbchecked)then
powerchop:=true;
if(powerchopcheck.state=cbchecked)then
powerchop:=false;
end;



Procedure DeclarePlayers;
begin
HowManyPlayers :=2; // Set Number of Players here.
NumberOfPlayers(HowManyPlayers); // Sets the Players Array Length;
CurrentPlayer:=0; // CurrentPlayer = Array Index

Players[0].Name :='username1';
Players[0].Pass :='password1';
Players[0].Nick :='nickname1';
Players[0].Active:=True;

Players[1].Name :='';
Players[1].Pass :='';
Players[1].Nick :='';
Players[1].Active:=false;

end;


procedure setup;
begin
DeclarePlayers;
LoginPlayer;
end;

procedure findtrees;
begin
setupsrl;
activateclient;
makecompass('west')
if(findobj(a,b,'Deposit Bank Deposit Box',bankdepositbox,1))then
mouse(a,b,10,10,true)
wait(1000+random(100))
mouse(431,41,10,10,true)
if(findmmcolor(a,b,fishingsymbol))then
mouse(a,b,10,10,true)
WaitTillFlag;
if(findnormalrandoms)then
srlrandomsreport;
end;



procedure bankfind;
begin
clickmmcolortol(banksymbol,50)
WaitTillFlag
if(findnormalrandoms)then
srlrandomsreport;
openbank3;
deposit(2,28,2)
closebank;
bankscreen;
if(bankscreen=false)and(powerchop=false)then
banked:=banked+1
wait(1000+random(500))
begin
findtrees;
end
if(bankscreen=true)and(powerchop=true)then
wait(1000+random(500))
begin
findtrees;
end
end;


procedure drop;
begin
dropto(2,28)
end;




procedure chop;
begin
repeat
findfight;
if(findfight=true)then
begin
bankfind;
end
findobj(a,b,'Chop',3962992,1)
mouse(a,b,20,20,true)
wait(5000+random(1000))
findhead;
if(findnormalrandoms)then
srlrandomsreport;
if(InChat('wc lvls') or InChat('wc lvls?') or InChat('woodcut lvls') or Inchat('woodcutting lvls'))then
begin
TypeSend(IntToStr(GetSkillLevel('woodcutting')))
end
until(invfull)
if(invfull=true)and(powerchop=false)then
begin
bankfind;
end
if(invfull=true)and(powerchop=true)then
begin
drop;
end
end;



begin
safeinitform;
safeshowformmodal;
setupsrl;
repeat
setup;
chop;
until(banked=1)
writeln('-@-@-@-@-@-@-@-@-@-@-@-@-@-@')
writeln('---BBRI06 DRAYNOR CHOPPER---')
writeln('WORKED FOR :'+scripttime2(2))
writeln('BANKED '+inttostr(banked)+ ' TIME');
writeln('-@-@-@-@-@-@-@-@-@-@-@-@-@-@')
end.


thanks
~bbri06

YoHoJo
10-28-2006, 05:15 AM
here is an exampel from one of my old scits written with si.scar
procedure InitForm;
begin
frmDesign := CreateForm;
frmDesign.Left := 289;
frmDesign.Top := 161;
frmDesign.Width := 589;
frmDesign.Height := 395;
frmDesign.Caption := 'frmDesign';
frmDesign.Color := clBtnFace;
frmDesign.Font.Color := clWindowText;
frmDesign.Font.Height := -11;
frmDesign.Font.Name := 'WP MultinationalB Roman';
frmDesign.Font.Style := [fsBold, fsItalic];
frmDesign.Visible := False;
frmDesign.PixelsPerInch := 96;
Label1 := TLabel.Create(frmDesign);
Label1.Parent := frmDesign;
Label1.Left := 51;
Label1.Top := 30;
Label1.Width := 95;
Label1.Height := 24;
Label1.Alignment := taCenter;
Label1.Caption := 'User Name';
Label1.Font.Color := clWindowText;
Label1.Font.Height := -20;
Label1.Font.Name := 'MS Sans Serif';
Label1.Font.Style := [];
Label1.ParentFont := False;
Label2 := TLabel.Create(frmDesign);
Label2.Parent := frmDesign;
Label2.Left := 450;
Label2.Top := 30;
Label2.Width := 91;
Label2.Height := 24;
Label2.Alignment := taCenter;
Label2.Caption := 'Pass Word';
Label2.Font.Color := clWindowText;
Label2.Font.Height := -20;
Label2.Font.Name := 'Times';
Label2.Font.Style := [];
Label2.ParentFont := False;
Label3 := TLabel.Create(frmDesign);
Label3.Parent := frmDesign;
Label3.Left := 450;
Label3.Top := 47;
Label3.Width := 33;
Label3.Height := 14;
Label3.Caption := '(Its Bleeped Out)';
Label3.Font.Color := clWindowText;
Label3.Font.Height := -11;
Label3.Font.Name := 'Times';
Label3.Font.Style := [fsBold, fsItalic];
Label3.ParentFont := False;
Button1 := TButton.Create(frmDesign);
Button1.Onclick:=@Tutorial1;
Button1.Parent := frmDesign;
Button1.Left := 261;
Button1.Top := 261;
Button1.Width := 78;
Button1.Height := 25;
Button1.Caption := 'Start Chopping';
Button1.TabOrder := 8;
asdfUsername := TEdit.Create(frmDesign);
asdfUsername.Parent := frmDesign;
asdfUsername.Left := 41;
asdfUsername.Top := 60;
asdfUsername.Width := 121;
asdfUsername.Height := 30;
asdfUsername.Font.Color := clWindowText;
asdfUsername.Font.Height := -20;
asdfUsername.Font.Name := 'Times New Roman';
asdfUsername.Font.Style := [];
asdfUsername.ParentFont := False;
asdfUsername.TabOrder := 9;
asdfUsername.Text := '';
asdfPassword := TEdit.Create(frmDesign);
asdfPassword.Parent := frmDesign;
asdfPassword.Left := 440;
asdfPassword.Top := 60;
asdfPassword.Width := 121;
asdfPassword.Height := 29;
asdfPassword.Font.Color := clWindowText;
asdfPassword.Font.Height := -20;
asdfPassword.Font.Name := 'Wingdings 3';
asdfPassword.Font.Style := [fsBold, fsItalic];
asdfPassword.ParentFont := False;
asdfPassword.TabOrder := 10;
asdfPassword.Text := '';
end;

the lines which create the box in which username and password are type are
asdfUsername.Text := ''; and
asdfPassword.Text := '';

and latter in my script i have a procedure that "converts them"

procedure ConVert;
begin
username:=asdfusername.text
password:=asdfpassword.text
end;

used to login (with si.scar) would be:
SetAccount(1,UserName,PassWord);

but idk why you are doing this when you can just use the player form built into SRL so people can use MULTIPLE accounts.

tell me if you need any help.
whats easier to do is first make the script WITHOUT form and juse use consts
then add a form and convert

like when i frist made the script i had
const
Username='username'
Password='password'

then when i made the form i remove it from consts and did that i did up there ^
hope it hleped =/

bbri06
10-28-2006, 06:03 AM
i had a const i just thought forms would be more userfriendly thatts all and this may seem kinda nooby but i dont know how to use the built in srl player form

YoHoJo
10-28-2006, 06:09 AM
=p me niether.
id try learning that rather than making my own form.
learn palyer form and if u need any more consts make ur own form for that if needed.

eme well u shud put this at the top of your script

Procedure DeclarePlayers;
begin
HowManyPlayers :=2; // Set Number of Players here.
NumberOfPlayers(HowManyPlayers); // Sets the Players Array Length;
CurrentPlayer:=0; // CurrentPlayer = Array Index

Players[0].Name :='username1';
Players[0].Pass :='password1';
Players[0].Nick :='nickname1';
Players[0].Active:=True;

Players[1].Name :='';
Players[1].Pass :='';
Players[1].Nick :='';
Players[1].Active:=false;

end;

but since ur form only has 1 user and pass space it wouldnt work well.
if u ask me id rip out the form and just make the script work frist.
then i can help you more with this problem
just take our form for now and add const ant get it working

there shoud also be some code that says
password.TEXT:= '';
username.TEXT:= '';

which i dont see.
i think should just start it over later =)