Simba Code:
{Player Form}
{Loads of Help from Daniel, Masterkill and dgby714}
type
TFormPlayer = record
Name, Pass, Nick, Pin, STAT_ID, STAT_PASS, Bank :String;
Herb, Second, Task, World :Integer;
Debug :Boolean;
end;
{Main Form Globals}
var
PharmForm :TFORM;
PharmPlayer :TFormPlayer;
PButton :array [0..3] of Tbutton;
PLabel :array [0..11] of TLABEL;
PEdit :Array [0..6] of TEDIT;
PCombo, PCombo1, PCombo2, PCombo3, PCombo4 :TCOMBOBOX;
PImage :Array[0..2] of TIMAGE;
PGroup :array[0..4] of TGROUPBOX;
PStart :boolean;
ComboText, ComboText1, ComboText2 :TStringArray;
procedure FormKill(Const S :String);
begin
ShowMessage(S);
TerminateScript;
end;
procedure LeftClick(Sender: TObject);
var
I :integer;
begin
case sender of
PButton[0]:
begin
for I := 0 to 13 do
if PCombo.TEXT = ComboText[i] then
PharmPlayer.Herb := i;
for I := 0 to 15 do
if Pcombo2.TEXT = ComboText2[i] then
PharmPlayer.Second := i;
for i := 0 to 2 do
if PCombo1.TEXT = ComboText1[i] then
PharmPlayer.Task := i;
if not (PEdit[0].TEXT = '') then
PharmPlayer.Name := PEdit[0].TEXT
else
FormKill('No Username Specified');
if not (PEdit[1].TEXT = '') then
PharmPlayer.Pass := PEdit[1].TEXT
else
FormKill('No Password Specified');
if not (PEdit[2].TEXT = '') then
PharmPlayer.Nick := PEdit[2].TEXT;
if not (PEdit[3].TEXT = '') then
PharmPlayer.Pin := PEdit[3].TEXT;
if not (PEdit[4].TEXT = '') then
PharmPlayer.STAT_ID := PEdit[4].TEXT;
if not (PEdit[5].TEXT = '') then
PharmPlayer.STAT_PASS := PEdit[5].TEXT;
PharmPlayer.World := StrToInt(PEdit[6].TEXT);
PharmPlayer.Debug := StrToBool(PCombo3.TEXT);
PharmPlayer.Bank := PCombo4.TEXT;
PStart := True;
PharmForm.ModalResult:= mrOk;
end;
PButton[1]: begin PharmForm.MODALRESULT:= mrOk; end;
PButton[2]:
begin
WriteINI('Player', 'Name', PEdit[0].TEXT, 'Player_Data');
WriteINI('Player', 'Pass', PEdit[1].TEXT, 'Player_Data');
WriteINI('Player', 'Nick', PEdit[2].TEXT, 'Player_Data');
WriteINI('Player', 'Pin', PEdit[3].TEXT, 'Player_Data');
WriteINI('Stats', 'User', PEdit[4].TEXT, 'Player_Data');
WriteINI('Stats', 'Pass', PEdit[5].TEXT, 'Player_Data');
WriteINI('Player', 'Herb', PCombo.TEXT, 'Player_Data');
WriteINI('Player', 'Task', PCombo1.TEXT, 'Player_Data');
WriteINI('Player', 'Second', PCombo2.TEXT, 'Player_Data');
WriteINI('Script', 'Debug', PCombo3.TEXT, 'Player_Data');
WriteINI('Script', 'World', PEdit[6].TEXT, 'Player_Data');
WriteINI('Script', 'Bank', PCombo4.TEXT, 'Player_Data');
end;
PButton[3]:
begin
PEdit[0].TEXT := ReadINI('Player', 'Name', 'Player_Data');
PEdit[1].TEXT := ReadINI('Player', 'Pass', 'Player_Data');
PEdit[2].TEXT := ReadINI('Player', 'Nick', 'Player_Data');
PEdit[3].TEXT := ReadINI('Player', 'Pin', 'Player_Data');
PEdit[4].TEXT := ReadINI('Stats', 'User', 'Player_Data');
PEdit[5].TEXT := ReadINI('Stats', 'Pass', 'Player_Data');
PCombo.TEXT := ReadINI('Player', 'Herb', 'Player_Data');
PCombo1.TEXT := ReadINI('Player', 'Task', 'Player_Data');
PCombo2.TEXT := ReadINI('Player', 'Second', 'Player_Data');
PCombo3.Text := ReadINI('Script', 'Debug', 'Player_Data');
PEdit[6].TEXT := ReadINI('Script', 'World', 'Player_Data');
PCombo4.TEXT := ReadINI('Script', 'Bank', 'Player_Data');
end;
end;
end;
procedure InitPForm;
var
I, B, W, H :integer;
LCap, BLoc, PGC, BCap :Tstringarray;
PGH, PGW, PGT, PGl, TIW, TIT, TIL, TIH :TIntegerArray;
begin
Lcap := ['Player Name', 'Player Pass', 'Player Nick', 'Player Pin', 'Stats User',
'Stats Pass', 'Player Task', 'Which Herb', 'Secondary', 'Bank', 'World', 'Debug On'];
ComboText := ['Guam', 'Marrentill', 'Tarromin', 'Harralander', 'Ranarr',
'Toadflax', 'Irit', 'Wergali', 'Avantoe', 'Kwuarm', 'Snapdragon',
'Cadantine', 'Lantadyne', 'Dwarf Weed', 'Torsol'];
ComboText1 := ['Clean Only', 'Unfinished', 'Potions'];
ComboText2 := ['Eye of Newt','Ground Unicorn Horn','Limpwurt Root',
'Red Spider egg','Choclate Dust','White Berries','Toad Legs',
'Snape Grass','Mort Myre Fungi','Kebbit Teeth Dust',
'Wimpy Feather','Blue Dragon Scale','Wine of Zamorak',
'Potato Cactus','Jangerberries','Crushed Bird Nest', 'Ashes'];
BLoc := ['BGND.jpg', 'BANNER.jpg', 'CAPE.jpg'];
TIW := [600, 500, 47];
TIL := [0, 50, 505];
TIT := [0, 10, 242];
TIH := [335, 100, 84];
PGC := ['Player Data', 'Script Setup', 'SRL Stats Setup'];
PGL := [15, 230, 230];
PGT := [115, 115, 246];
PGH := [130, 130, 70];
PGW := [200, 356, 230];
PharmForm := Tform.Create(nil);
with PharmForm do
begin
Left := 100;
Top := 100;
Width := 600;
Height := 335;
COLOR := 4144959;
BORDERSTYLE := bsNone;
end;
{=============================== BackGround Images ============================}
for i := 0 to 2 do
begin
PImage[i] := TIMAGE.Create(PharmForm);
with Pimage[i] do
begin
Parent := PharmForm;
Top := TIT[i];
Left := TIL[i];
Height := TIH[i];
Width := TIW[i];
end;
B := LoadBitmap(ScriptPath + BLoc[i]);
GetBitmapSize(B, W, H);
DrawBitmap(B,PImage[i].CANVAS,0,0);
FreeBitmap(b);
end;
{================================ Group Boxes =================================}
for i := 0 to 2 do
begin
PGroup[i] := TGROUPBOX.Create(PharmForm);
with PGroup[i] do
begin
Parent := PharmForm;
Top := PGT[i];
left := PGL[i];
Height := PGH[i];
Width := PGW[i];
CAPTION := PGC[i];
FONT.Style := [FSBOLD];
FONT.Size := 10;
end;
end;
{================================== LABELS ====================================}
for i := 0 to 11 do
begin
if InIntArray([0, 1, 2, 3], i) then
Plabel[i] := TLABEL.Create(PGroup[0]);
if InIntArray([4, 5], i) then
Plabel[i] := TLABEL.Create(PGroup[2])
else
Plabel[i] := TLABEL.Create(PGroup[1]);
with PLabel[i] do
begin
Height := 20;
Width := 50;
FONT.Style := [FSBOLD];
FONT.Color := clRed;
{========================= Label 0..3 (Player Setup) ==========================}
if InIntArray([0, 1, 2, 3], i) then
begin
Parent := PGroup[0];
top := 0 + (i * 30);
Left := 5;
end;
{========================== Label 4 & 5(Stats Setup) ==========================}
if InIntArray([4, 5], i) then
begin
Parent := PGroup[2];
top := 5;
left := 30 + ((i - 4) * 110);
end;
{========================== Label 6..8(Herb & Make) ===========================}
if InIntArray([6, 7, 8], i) then
begin
Parent := PGroup[1];
top := 5 + ((i - 6) * 30);
Left := 5;
end;
{===================== Label 9.. 11(Bank, World & Debug) ======================}
if InIntArray([9, 10, 11], i) then
begin
Parent := PGroup[1];
top := 5 + ((i - 9) * 30);
Left := 190;
end;
Caption := Lcap[i];
end;
end;
{=============================== TEdit Boxes ==================================}
for i := 0 to 6 do // TEdit Key
begin // [0] Name
PEdit[i] := TEDIT.Create(PharmForm); // [1] Pass
with PEdit[i] do // [2] Nick
begin // [3] Pin
Parent := PharmForm; // [4] Stats User
Height := 20; // [5] Stats Pass
Width := 100; // [6] World
top := 128 + (i * 30);
Left := 110;
if InIntArray([4, 5], i) then
begin
Parent := PGroup[2];
Top := 20;
left := 8 + ((i - 4) * 110);
end;
if i = 6 then
begin
Parent := PGroup[1];
Width := 90;
Top := 30;
Left := 260;
Caption := '53';
end;
if InIntArray([1, 3, 5], i) then
PASSWORDCHAR := '*';
if InIntArray([2, 3], i) then
MAXLENGTH := 4;
end;
end;
{================================== TButton ===================================}
BCAP := ['Start', 'Stop', 'Save', 'Load'];
for i := 0 to 3 do
begin
PButton[i] := TBUTTON.Create(PharmForm);
with PButton[i] do
begin
Parent := PharmForm;
Height := 20;
Width := 70;
Left := 30 + (i * 90);
Top := 290;
CAPTION := BCap[i];
ONCLICK := @LeftClick;
if InIntArray([2, 3], i) then
begin
Top := 260;
Left := 30 + ((i - 2) * 90);
end;
end;
end;
{================================= PComboxes ==================================}
PCombo := TComboBox.Create(PharmForm);
{=============================== Herb ComboBox ================================}
with PCombo do
begin
Parent := PGroup[1];
Top := 30;
Left := 80;
Width := 100;
Height := 20;
for i := 0 to 14 do
ITEMS.Add(ComboText[i]);
end;
{=============================== Task ComboBox ================================}
PCombo1 := TComboBox.Create(PharmForm);
with PCombo1 do
begin
Parent := PGroup[1];
Top := 0;
Left := 80;
Width := 100;
for i := 0 to 2 do
ITEMS.Add(ComboText1[i]);
end;
{============================= Secondary ComboBox =============================}
PCombo2 := TComboBox.Create(PharmForm);
with PCombo2 do
begin
Parent := PGroup[1];
Top := 60;
Left := 80;
Width := 100;
Height := 20;
for i := 0 to 16 do
ITEMS.Add(ComboText2[i]);
end;
{=============================== Debug ComboBox ===============================}
PCombo3 := TCOMBOBOX.Create(PGroup[1]);
with PCombo3 do
begin
Parent := PGroup[1];
Top := 60;
Left := 260;
Width := 90;
Height := 20;
ITEMS.Add('True');
ITEMS.Add('False');
Caption := 'False';
end;
{=============================== Debug ComboBox ===============================}
PCombo4 := TCOMBOBOX.Create(PGroup[1]);
with PCombo4 do
begin
Parent := PGroup[1];
Top := 0;
Left := 260;
Width := 90;
Height := 20;
ITEMS.Add('feb');
ITEMS.Add('fwb');
ITEMS.Add('veb');
ITEMS.Add('vwb');
ITEMS.Add('db');
ITEMS.Add('akb');
ITEMS.Add('ctb');
ITEMS.Add('clt');
ITEMS.Add('nab');
ITEMS.Add('sab');
ITEMS.Add('ynb');
ITEMS.Add('ngb');
ITEMS.Add('sgb');
ITEMS.Add('fgb');
ITEMS.Add('ge');
Caption := 'ge';
end;
end;
procedure SafeInitPForm;
var
v: TVariantArray;
begin
setarraylength(V, 0);
ThreadSafeCall('InitPForm', v);
end;
procedure ShowPFormModal;
begin
PharmForm.ShowModal;
end;
procedure SafeShowPFormModal;
var
v: TVariantArray;
begin
setarraylength(V, 0);
ThreadSafeCall('ShowPFormModal', v);
end;