SCAR Code:
program TheAlchemyTable;
{.include SRL/SRL.scar}
var
frmDesign : TForm;
PriceofNatureLabel : TLabel;
ItemPriceLabel : TLabel;
RewardLabel : TLabel;
PriceThingy : TMemo;
CalculateButton, CloseButton : TButton;
Edit1 : TEdit;
Edit2 : TEdit;
Edit3 : TEdit;
function Add:extended;
begin
Result:= StrToInt(Edit1.text) + StrToInt(Edit2.Text);
end;
function Dothestuff:extended;
begin
Result:= StrToInt(Edit3.text) - Add;
end;
procedure CalculateThem(Sender: TObject);
begin
PriceThingy.Lines.Clear;
PriceThingy.Lines.Add('It costs '+ floattostr(Add)+' gp total for each load.');
PriceThingy.Lines.Add(' ');
PriceThingy.Lines.Add('You are going to gain/lose'+ floattostr(DotheStuff)+' gps per alch');
end;
procedure CloseTheForm(sender: TObject);
begin
frmDesign.ModalResult := mrOk;
end;
procedure InitForm;
begin
frmDesign := CreateForm;
with frmDesign do
begin
Left := 250;
Top := 114;
Width := 330;
Height := 171;
Caption := 'Alchemy Table';
Color := clBtnFace;
Font.Color := clWindowText;
Font.Height := -11;
Font.Name := 'MS Sans Serif';
Font.Style := [];
PixelsPerInch := 96;
end;
PriceofNatureLabel := TLabel.Create(frmDesign);
with PriceofNatureLabel do
begin
Parent := frmDesign;
Left := 8;
Top := 24;
Width := 71;
Height := 13;
Caption := 'Price of Nature';
end;
ItemPriceLabel := TLabel.Create(frmDesign);
with ItemPriceLabel do
begin
Parent := frmDesign;
Left := 8;
Top := 56;
Width := 95;
Height := 13;
Caption := 'Price of Item to Alch';
end;
RewardLabel := TLabel.Create(frmDesign);
with RewardLabel do
begin
Parent := frmDesign;
Left := 8;
Top := 88;
Width := 74;
Height := 13;
Caption := 'Alcemy Reward';
end;
PriceThingy := TMemo.Create(frmDesign);
with PriceThingy do
begin
Parent := frmDesign;
Left := 224;
Top := 8;
Width := 89;
Height := 121;
with PriceThingy.Lines do
begin
Add('king of the nites!'); //Change this to whatever you want it to say.
end;
ReadOnly := True;
TabOrder := 8;
end;
CalculateButton := TButton.Create(frmDesign);
with CalculateButton do
begin
Parent := frmDesign;
Left := 5;
Top := 112;
Width := 121;
Height := 17;
Caption := 'Calculate';
TabOrder := 9;
OnClick := @CalculateThem;
end;
CloseButton := TButton.Create(frmDesign);
with CloseButton do
begin
Parent := frmDesign;
Left := 145;
Top := 112;
Width := 55;
Height := 17;
Caption := 'Close';
TabOrder := 13;
OnClick := @CloseTheForm;
end;
Edit1 := TEdit.Create(frmDesign);
with Edit1 do
begin
Parent := frmDesign;
Left := 120;
Top := 48;
Width := 81;
Height := 21;
TabOrder := 10;
Text := '';
end;
Edit2 := TEdit.Create(frmDesign);
with Edit2 do
begin
Parent := frmDesign;
Left := 120;
Top := 16;
Width := 81;
Height := 21;
TabOrder := 11;
Text := '';
end;
Edit3 := TEdit.Create(frmDesign);
with Edit3 do
begin
Parent := frmDesign;
Left := 120;
Top := 80;
Width := 81;
Height := 21;
TabOrder := 12;
Text := '';
end;
end;
procedure SafeInitForm;
var
V : TVariantArray;
begin
SetArrayLength(V, 0);
ThreadSafeCall('InitForm', V);
end;
procedure ShowInitFormModal;
begin
frmDesign.ShowModal;
end;
procedure SafeShowInitFormModal;
var
V : TVariantArray;
begin
SetArrayLength(V, 0);
ThreadSafeCall('ShowInitFormModal', V);
end;
procedure MainInitForm;
begin
SafeInitForm;
SafeShowInitFormModal;
FreeForm(frmDesign);
end;
begin
ClearDebug;
MainInitForm;
end.