SOLVED
I'm having problems using TComboBox in my auto curser.
I've added a second location and want to have a drop-down menu to pick which npc to curse.

What I want to do, is run the procedure CastCurseMonk if that option is selected, and the procedure CastCurseSkeleton if that's selected.
I had a look at rjj95's fletching script and tried using it below, but without any success. I think I might be needing something in the mainloop?
Simba Code:
Program TheAutoCurser;
{$DEFINE SMART}
{$I SRL/SRL.Simba}
{$I P07Include.Simba}
(********************************************************)
(* TheAutoCurser - Made by Sequence *)
(********************************************************)
(* 1. Specify how many casts you want to do. *)
(* 2. Start the script, and enter login info *)
(* 3. Be sure to stand at the Monk of Zamorak *)
(* in the cage at Varrock Castle *)
(********************************************************)
var
x, y, MonkColor, SkeletonColor1, SkeletonColor2, Casts, I : Integer;
CastsDone, CastsPerHour, TimeGone : Integer;
DsgnForm : TForm;
Username, Password, CurseCasts : TEdit;
StartBtn : TButton;
NPCCombo : TComboBox;
SelectNPC : String;
const
ScriptVersionNumber = '1.21';
default = 'Calibri';
procedure DTM;
begin
Casts := 2000; //Change to specify how many casts you want to do.
MonkColor := 3488916;
SkeletonColor1 := 8885140;
SkeletonColor2 := 9804448;
end;
procedure LogOutPlayer;
begin
P07_TabInventoryTab(11);
Wait(RandomRange(400, 700));
P07_MouseBox(575, 362, 706, 388, mouse_left);
TerminateScript;
end;
procedure ProgressReport;
begin
ClearDebug;
TimeGone := (GetTimeRunning/1000);
CastsPerHour :=(3600*(CastsDone))/((TimeGone));
begin
Writeln('********************************************************');
Writeln(' TheAutoCurser - Made by Sequence ');
Writeln('********************************************************');
Writeln(' Time running: ' + MsToTime((GetTimeRunning), Time_Short));
Writeln(' Casts: ' + IntToStr(CastsDone) + ' ');
Writeln(' Casts p/h: ' + IntToStr(CastsPerHour) + ' ');
Writeln('********************************************************');
end;
end;
procedure CheckFriends;
begin
P07_TabInventoryTab(9);
Wait(RandomRange(300, 500));
MMouse(RandomRange(X - 10, X + 10), RandomRange(y - 10, y + 10), 0, 0);
Wait(RandomRange(2000, 3000));
end;
procedure CheckInventory;
begin
P07_TabInventoryTab(4);
Wait(RandomRange(200, 600));
end;
Function AntiBan : Boolean;
begin
case random(300) of
0: P07_HoverSkill('magic', random(5000));
1: P07_MakeCompassDegree(RandomRange(140, 170));
2: P07_MakeCompassDegree(RandomRange(190, 220));
3: MMouse(random(650), random(350), 0, 0);
4: CheckInventory;
5: CheckFriends;
end;
end;
procedure CastCurseMonk;
begin
case LowerCase(SelectNPC) of
'monk':
begin
repeat
If (Not FindColorSpiralTolerance(x, y, MonkColor, 176, 84, 393, 320, 20)) then
LogOutPlayer
else begin
P07_MakeCompassEast;
P07_MakeCameraAngleHigh;
Wait(RandomRange(200, 350));
P07_CastSpell(12);
Wait(RandomRange(900, 1100));
MMouse(RandomRange(X - 3, X + 3), RandomRange(y - 3, y + 3), 0, 0);
ClickMouse2(mouse_left);
ProgressReport;
AntiBan;
Inc(CastsDone);
end;
Until(I = Casts);
end;
end;
end;
procedure CastCurseSkeleton;
begin
case LowerCase(SelectNPC) of
'skeleton':
begin
repeat
P07_MakeCompassDegree(20);
P07_MakeCameraAngleLow;
begin
Wait(RandomRange(200, 350));
P07_CastSpell(12);
Wait(randomRange(500, 700));
if P07_FindObjCustom(x, y, ['Skeleton', 'Ske', 'ton', 'Skelet', 'leton'], [SkeletonColor1, SkeletonColor2], 14) then
begin
ClickMouse2(mouse_left);
Wait(RandomRange(400, 600));
Inc(CastsDone);
end
else
begin
Wait(RandomRange(1034, 1503));
if (Not P07_FindObjCustom(x, y, ['Skeleton', 'Ske', 'ton', 'Skelet', 'leton'], [8885140, 9804448], 14)) then
WriteLn('NPC Not found, terminating script...');
Wait(RandomRange(100, 300));
Mouse(992, 293, random(5), random(5), true);
Wait(RandomRange(500, 1000));
LogOutPlayer;
Wait(RandomRange(500, 1000));
TerminateScript;
end;
end;
ProgressReport;
AntiBan;
Inc(I);
until(I = Casts);
end;
end;
end;
procedure AutoUpdateScript;
var
NewFile : Integer;
OnlineVersion, NewScript, NewFileName : String;
begin
begin
Writeln('Checking TheAutoCurser VersionNumber');
OnlineVersion := GetPage('http://07scape-theautocurser.googlecode.com/svn/trunk/TheAutoCurser/AutoScriptUpdate.txt');
Writeln('Local : ' + ScriptVersionNumber + ' / Latest : ' + OnlineVersion);
if (Trim(OnlineVersion) > ScriptVersionNumber) then
begin
Writeln('New TheAutoCurser Version Available! Updating...');
NewScript := GetPage('http://07scape-theautocurser.googlecode.com/svn/trunk/TheAutoCurser/TheAutoCurser.simba');
NewFileName := AppPath + 'Scripts\TheAutoCurser v' + OnlineVersion + '.simba';
NewFile := RewriteFile(NewFileName, true);
try
WriteFileString(NewFile, NewScript);
except
begin
Writeln('Fatal error writing to ' + NewFileName + '!');
TerminateScript;
end;
end;
CloseFile(NewFile);
Writeln('New TheAutoCurser Version Downloaded Please Restart Simba!');
Writeln('TheAutoCurser version ' + OnlineVersion + ' has been added to your Simba/Scripts folder.');
TerminateScript;
end else
writeln('You already have version ' + OnlineVersion + ' of TheAutoCurser');
end;
end;
procedure StartUp;
begin
ClearDebug;
AutoUpdateScript;
P07_AutoUpdateMe;
SetupP07Include;
ActivateClient;
Wait(2000);
If (Not P07_LoggedIn) Then
P07_LogInPlayer;
DTM;
end;
procedure YourClickProcedure(Sender: TObject);
begin
// ShowMessage('click');
end;
procedure SetNPC;
begin
case NPCCombo.ITEMINDEX of
0:
Begin
Writeln('You have choosen to curse the Monk of Zamorak');
SelectNPC := 'Monk';
End;
1:
Begin
Writeln('You have choosen to curse Skeletons in Varrock Sewer');
SelectNPC := 'Skeleton';
End;
End;
End;
procedure SaveSettings(Sender: TObject);
begin
DsgnForm.ModalResult := mrOk;
P07_PlayerName := Username.TEXT;
P07_PlayerPass := Password.TEXT;
SetNPC;
DsgnForm.CLOSE;
end;
procedure InitForm;
begin
//DsgnForm
DsgnForm:=TForm.Create(nil);
with DsgnForm do
begin
Caption:='TheAutoCurser - by Sequence';
Left:=93;
Top:=163;
Width:=320;
Height:=144;
Font.Name:=default;
Font.Color:=clDefault;
Font.Size:=11;
end;
//Username
Username:=TEdit.Create(DsgnForm);
with Username do
begin
Parent:=DsgnForm;
Text:='Username';
Left:=10;
Top:=10;
Width:=300;
Height:=23;
Font.Name:=default;
Font.Color:=clDefault;
Font.Size:=11;
end;
//Password
Password:=TEdit.Create(DsgnForm);
with Password do
begin
Parent:=DsgnForm;
Text:='Password';
Left:=10;
Top:=43;
Width:=300;
Height:=23;
Font.Name:=default;
Font.Color:=clDefault;
Font.Size:=11;
Password.PASSWORDCHAR:='*';
Password.MAXLENGTH:=20;
end;
//NPCCombo\\
NPCCombo:=TComboBox.Create(DsgnForm);
with NPCCombo do
begin
Caption:='Select NPC and Location';
Parent:=DsgnForm;
Left:=10;
Top:=76;
Width:=300;
Height:=23;
Items.Add('Monk of Zamorak - Varrock Castle');
Items.Add('Skeleton - Varrock Sewer');
Text := Items[0];
OnClick:=@YourClickProcedure;
Font.Name:=default;
Font.Color:=clDefault;
Font.Size:=11;
end;
//StartBtn
StartBtn := TButton.Create(DsgnForm);
with StartBtn do
begin
Parent:=DsgnForm;
Caption:='Save Settings';
Left:=10;
Top:=109;
Width:=300;
Height:=25;
OnClick:=@SaveSettings;
Font.Color:=clDefault;
Font.Size:=11;
end;
end;
procedure SafeInitForm;
var
v: TVariantArray;
begin
setarraylength(V, 0);
ThreadSafeCall('InitForm', v);
end;
procedure ShowFormModal;
begin
DsgnForm.ShowModal;
DsgnForm.Free;
end;
procedure SafeShowFormModal;
var
v: TVariantArray;
begin
SetArrayLength(V, 0);
ThreadSafeCall('ShowFormModal', v);
end;
Begin
SetupSRL;
SafeInitForm;
SafeShowFormModal;
StartUp;
end.
The working script if anyone need it as an example:
Simba Code:
Program TheAutoCurser;
{$DEFINE SMART}
{$I SRL/SRL.Simba}
{$I P07Include.Simba}
(********************************************************)
(* TheAutoCurser - Made by Sequence *)
(********************************************************)
(* 1. Specify how many casts you want to do. *)
(* 2. Start the script, and enter login info *)
(* 3. Be sure to stand at the Monk of Zamorak *)
(* in the cage at Varrock Castle *)
(********************************************************)
var
x, y, MonkColor, SkeletonColor1, SkeletonColor2, Casts, I : Integer;
CastsDone, CastsPerHour, TimeGone : Integer;
DsgnForm : TForm;
Username, Password : TEdit;
StartBtn : TButton;
NPCLocSetting : Integer;
NPCCombo : TComboBox;
const
ScriptVersionNumber = '1.3';
default = 'Calibri';
procedure DTM;
begin
Casts := 2000; //Change to specify how many casts you want to do.
MonkColor := 3488916;
SkeletonColor1 := 8885140;
SkeletonColor2 := 9804448;
end;
procedure LogOutPlayer;
begin
P07_TabInventoryTab(11);
Wait(RandomRange(400, 700));
P07_MouseBox(575, 362, 706, 388, mouse_left);
TerminateScript;
end;
procedure CheckFriends;
begin
P07_TabInventoryTab(9);
Wait(RandomRange(300, 500));
MMouse(650, 270, 3, 3);
Wait(RandomRange(2000, 3000));
end;
procedure CheckInventory;
begin
P07_TabInventoryTab(4);
Wait(RandomRange(200, 600));
end;
procedure ProgressReport;
begin
ClearDebug;
TimeGone := (GetTimeRunning/1000);
CastsPerHour :=(3600*(CastsDone))/((TimeGone));
begin
Writeln('********************************************************');
Writeln(' TheAutoCurser - Made by Sequence ');
Writeln('********************************************************');
Writeln(' Time running: ' + MsToTime((GetTimeRunning), Time_Short));
Writeln(' Casts: ' + IntToStr(CastsDone) + ' ');
Writeln(' Casts p/h: ' + IntToStr(CastsPerHour) + ' ');
Writeln('********************************************************');
end;
end;
procedure AutoUpdateScript;
var
NewFile : Integer;
OnlineVersion, NewScript, NewFileName : String;
begin
begin
Writeln('Checking TheAutoCurser VersionNumber');
OnlineVersion := GetPage('http://07scape-theautocurser.googlecode.com/svn/trunk/TheAutoCurser/AutoScriptUpdate.txt');
Writeln('Local : ' + ScriptVersionNumber + ' / Latest : ' + OnlineVersion);
if (Trim(OnlineVersion) > ScriptVersionNumber) then
begin
Writeln('New TheAutoCurser Version Available! Updating...');
NewScript := GetPage('http://07scape-theautocurser.googlecode.com/svn/trunk/TheAutoCurser/TheAutoCurser.simba');
NewFileName := AppPath + 'Scripts\TheAutoCurser v' + OnlineVersion + '.simba';
NewFile := RewriteFile(NewFileName, true);
try
WriteFileString(NewFile, NewScript);
except
begin
Writeln('Fatal error writing to ' + NewFileName + '!');
TerminateScript;
end;
end;
CloseFile(NewFile);
Writeln('New TheAutoCurser Version Downloaded Please Restart Simba!');
Writeln('TheAutoCurser version ' + OnlineVersion + ' has been added to your Simba/Scripts folder.');
TerminateScript;
end else
writeln('You already have version ' + OnlineVersion + ' of TheAutoCurser');
end;
end;
procedure StartUp;
begin
ClearDebug;
SetupP07Include;
AutoUpdateScript;
P07_AutoUpdateMe;
//P07_DeclarePlayer;
ActivateClient;
Wait(2000);
If (Not P07_LoggedIn) Then
P07_LogInPlayer;
//P07_MakeCameraAngleHigh;
//P07_MakeCompassEast;
DTM;
end;
Function AntiBan : Boolean;
begin
case random(300) of
0: P07_HoverSkill('magic', random(5000));
1: P07_MakeCompassDegree(RandomRange(140, 170));
2: P07_MakeCompassDegree(RandomRange(190, 220));
3: MMouse(random(650), random(350), 0, 0);
4: CheckInventory;
5: CheckFriends;
end;
end;
procedure CastCurse;
begin
if P07_TabInventoryTab(7) then
begin
P07_MouseBox(661, 258, 673, 269, mouse_left)
end;
end;
procedure CastCurseMonk;
begin
P07_MakeCompassEast;
P07_MakeCameraAngleHigh;
WriteLn('You have choosen to curse the Monk of Zamorak in Varrock Castle');
repeat
If (Not FindColorSpiralTolerance(x, y, MonkColor, 176, 84, 393, 320, 20)) then
LogOutPlayer
else begin
P07_MakeCompassEast;
P07_MakeCameraAngleHigh;
Wait(RandomRange(200, 350));
P07_CastSpell(12);
Wait(RandomRange(800, 1000));
MMouse(RandomRange(X - 3, X + 3), RandomRange(y - 3, y + 3), 0, 0);
ClickMouse2(mouse_left);
ProgressReport;
AntiBan;
Inc(CastsDone);
end;
Until(I = Casts);
end;
procedure CastCurseSkeleton;
begin
repeat
P07_MakeCompassDegree(20);
P07_MakeCameraAngleLow;
WriteLn('You have choosen to curse Skeletons at the Varrock sewer');
begin
Wait(RandomRange(200, 350));
P07_CastSpell(12);
Wait(randomRange(500, 700));
if P07_FindObjCustom(x, y, ['Skeleton', 'Ske', 'ton', 'Skelet', 'leton'], [SkeletonColor1, SkeletonColor2], 14) then
begin
ClickMouse2(mouse_left);
Wait(RandomRange(400, 600));
Inc(CastsDone);
end
else
begin
Wait(RandomRange(1034, 1503));
if (Not P07_FindObjCustom(x, y, ['Skeleton', 'Ske', 'ton', 'Skelet', 'leton'], [8885140, 9804448], 14)) then
WriteLn('NPC Not found, terminating script...');
Wait(RandomRange(100, 300));
Mouse(992, 293, random(5), random(5), true);
Wait(RandomRange(500, 1000));
LogOutPlayer;
Wait(RandomRange(500, 1000));
TerminateScript;
end;
end;
ProgressReport;
AntiBan;
Inc(I);
until(I = Casts);
end;
procedure CastCurseGlobal;
begin
case NPCLocSetting of
0: CastCurseMonk;
1: CastCurseSkeleton;
end;
end;
procedure SaveSettings(Sender: TObject);
begin
DsgnForm.ModalResult := mrOk;
P07_PlayerName := Username.TEXT;
P07_PlayerPass := Password.TEXT;
NPCLocSetting := NPCCombo.ITEMINDEX;
DsgnForm.CLOSE;
end;
procedure YourClickProcedure(Sender: TObject);
begin
//ShowMessage('click');
end;
procedure InitForm;
begin
//DsgnForm
DsgnForm:=TForm.Create(nil);
with DsgnForm do
begin
Caption:='TheAutoCurser - by Sequence';
Left:=93;
Top:=163;
Width:=320;
Height:=144;
Font.Name:=default;
Font.Color:=clDefault;
Font.Size:=11;
end;
//Username
Username:=TEdit.Create(DsgnForm);
with Username do
begin
Parent:=DsgnForm;
Text:='Username';
Left:=10;
Top:=10;
Width:=300;
Height:=23;
Font.Name:=default;
Font.Color:=clDefault;
Font.Size:=11;
end;
//Password
Password:=TEdit.Create(DsgnForm);
with Password do
begin
Parent:=DsgnForm;
Text:='Password';
Left:=10;
Top:=43;
Width:=300;
Height:=23;
Font.Name:=default;
Font.Color:=clDefault;
Font.Size:=11;
Password.PASSWORDCHAR:='*';
Password.MAXLENGTH:=20;
end;
//NPCCombo\\
NPCCombo:=TComboBox.Create(DsgnForm);
with NPCCombo do
begin
Caption:='Select NPC and Location';
Parent:=DsgnForm;
Left:=10;
Top:=76;
Width:=300;
Height:=23;
Items.Add('Monk of Zamorak - Varrock Castle');
Items.Add('Skeleton - Varrock Sewer');
Text := Items[0];
OnClick:=@YourClickProcedure;
Font.Name:=default;
Font.Color:=clDefault;
Font.Size:=11;
end;
//StartBtn
StartBtn := TButton.Create(DsgnForm);
with StartBtn do
begin
Parent:=DsgnForm;
Caption:='Save Settings';
Left:=10;
Top:=109;
Width:=300;
Height:=25;
OnClick:=@SaveSettings;
Font.Color:=clDefault;
Font.Size:=11;
end;
end;
procedure SafeInitForm;
var
v: TVariantArray;
begin
setarraylength(V, 0);
ThreadSafeCall('InitForm', v);
end;
procedure ShowFormModal;
begin
DsgnForm.ShowModal;
end;
procedure SafeShowFormModal;
var
v: TVariantArray;
begin
SetArrayLength(V, 0);
ThreadSafeCall('ShowFormModal', v);
end;
Begin
SetupSRL;
SafeInitForm;
SafeShowFormModal;
StartUp;
CastCurseGlobal;
end.