SRL Archive - MSI Bugs

MSI Form ~ Bugs and Suggestions


Coh3n

2010-12-30 01:15:51

If you haven't read already, please read this thread.

This thread is for all bugs you may encounter while using the form, and also anything you would like to see changed. Don't be afraid to post your honest opinions either. ;) Keep in mind that this thread is for bugs and suggestions for the MSI Form only, if you are having problems with the script itself, please post in the Script didn't run thread.

Bugs:
  • Out of range when trying to delete the last player in the list.
  • Invalid boolean when you don't fill out one of the script settings' combo boxes.

Suggestions:
  • Ability to save multiple files (Save/Load specified files, rather than just one).
  • Display the first player by default in the panel's combo boxes.
  • A 'Group' feature that will use the same settings for each player in the group.
  • A CheckBox that will use the player's in a random order, rather than the order added.
  • A CheckBox to show/hide the player's passwords.
  • Drag and drop players in the player list.

Soon to come…
  • Player editing
  • Descriptions of how to setup certain components (Hint pointer).
  • Form dragging
  • Show only the valid locations for each script.
  • Have Settings.txt created automatically instead of added to the SVN (to avoid overriding).

Enjoy,
The MSI Team

Camaro'

2010-12-30 02:18:53

This is so awesome :) Can't wait to test it out.

Sgt Soul

2010-12-30 05:17:51

tested, and I don't know how it could really be much better :o

Furyan

2010-12-30 06:24:40

Works really well, good job ;).

Maybe a suggestion: you could add some explanatory text of some settings when you hover your mouse over them. For example the 'Level to Debug' etc. Would make it even more transparent for unexperienced people. Or some kind of 'Set Defaults' button, which would fill in some of the less personal settings to a value that would be reasonable.

Coh3n

2010-12-30 13:15:12

From: Furyan
Works really well, good job ;).

Maybe a suggestion: you could add some explanatory text of some settings when you hover your mouse over them. For example the 'Level to Debug' etc. Would make it even more transparent for unexperienced people. Or some kind of 'Set Defaults' button, which would fill in some of the less personal settings to a value that would be reasonable.

Oh sorry, I forgot to commit the Settings.txt file that holds the default script settings. Also, if you hit the ? in the top right corner, it will open the MSI setup guide in your browser.

And I'm not sure if you can have a message appear when hovering over a component. That's something to look into. I'll add it to the first post.

Nava2

2010-12-30 13:35:23

From: Coh3n
Oh sorry, I forgot to commit the Settings.txt file that holds the default script settings. Also, if you hit the ? in the top right corner, it will open the MSI setup guide in your browser.

And I'm not sure if you can have a message appear when hovering over a component. That's something to look into. I'll add it to the first post.


Most form components have the ``hint'' field, use that! :)

Dan Cardin

2010-12-30 14:04:41

for my list:

-can't edit names. (timer is probably the only way to do it without a working onclickitem) I completely forgot about that. An Edit button could also be added and once clicked, the selected player's info would show in the TEdits.
a button is possible, but it would be much nicer if it just did so when you selected a person.

-make back/combobox/forward an array and all have the same procedures to do stuff. Yeah that all should have been done in the beginning, but you know what, they all work right now, so I suggest leaving it the way it is. That being said, if you want to change them, be my guest.
i plan to.

-not loading smart/srl and hopefully msi until after the form closes. I actually looked into this today, and it's not really possible unless we used different variables/types. Right now, throughout the form I set MSI_Players (rather than a temporary "FormPlayers". Also, some functions (from MSI) for setting the magic skill are used and the Script/Location lists are obtained from MSI_Scripts and MSI_Locations (which are set in SetupMSI). When writing most of the functionality I tried my best to make it so the form stuff is updated when MSI's global variables are updated.
well loading srl/smart at least seems to be possible. I dont see the problem with including the consts file and the file containing the spells into msi and that being it personally. Though i guess i can see why it might not be the perfect solution, it think it would be better than adding the really large wait time loading stuff that might not be needed.

-change buttons to images This isn't hard, just may be time consuming making all the bitmaps. And honestly, I don't think it's that necessary because we can't make custom ListBoxes, so they would stand out regardless.
i agree to an extent, but i think that if someone were to make the bitmaps, they should definitely be added. The smaller the number of things that go out of the theme the better. If that werent the case, we might as well get rid of the close button and just use the native ones.

-shorten form in general (namely making the changing of images to their hovers not stupid complicated) How would you suggest doing it? Again, I suggest leaving this one alone simply because it works. There's no sense in changing something that's working fine.
I would be willing to bet there are loads of things to be shortened. Im almost positive a lot of the mousehovering stuff is overly complicated.

-either delete form dragging or make it work There is no code for form dragging? I got rid of it a long time ago, unless I forgot part of it.
ah, last time i looked there was some stuff. That was 4-5 days ago probably, so unless you got rid of ti before then, i think there is still some stuff.

-either delete the question mark button or make it work It does work. It opens the MSI setup guide in your browser.
Didnt know that.

-try changing certain things to arrays instead of consts Like what? The constants we have now represent the indexes of arrays..
A perfect example of ways to shorten the code. If they represent indexes of arrays…why not just use arrays? They're shorter. You wouldnt end up with annoying problems like we have now when you want to add something and stuff gets screwed up. Trust me it would make things a lot easier.

-i dont understand why the >> tab doesn't work in the same way as the other tabs It does? I'm pretty positive I committed it, but earlier today I added that tab to the panels array and it does the same animation as the rest of them.
Ah, well it was all separate and such before and didnt work in the same way, if that's fixed then great.

-i also dont understand how the script choosing in the checkboxlists work. What don't you understand? You just check off the scripts you want to use for each player.
There are just so many items in the list. I was under the impression that the goal was to only display checkboxes for stuff that was applicable to the selected scripts. Like on the 4th tab (including the >>) if i have draynor willows selected, then would varrok east actually be a valid location that the script could work with? If so then disregard my comment


EDIT: ohh, and fixing the loading and saving of players to have dialog boxes or at the very least, not error if the file you load doesn't exist.

mormonman

2010-12-30 14:08:48

Out of range error when you delete the last player to empty the playerlist.

Coh3n

2010-12-30 14:28:14

From: Nava2
Most form components have the ``hint'' field, use that! :)

Genius! I'll have to look into that.

From: Dan Cardin

i agree to an extent, but i think that if someone were to make the bitmaps, they should definitely be added. The smaller the number of things that go out of the theme the better. If that werent the case, we might as well get rid of the close button and just use the native ones.

I agree.

From: Dan Cardin
well loading srl/smart at least seems to be possible. I dont see the problem with including the consts file and the file containing the spells into msi and that being it personally. Though i guess i can see why it might not be the perfect solution, it think it would be better than adding the really large wait time loading stuff that might not be needed.

There'll have to be a wait regardless. I don't really see the difference if it's before or after the form loads. That's just me though. I think if we were to call MSI_LoadAllScripts, etc before the form came up, it may work. I'm not 100% sure though.

From: Dan Cardin

I would be willing to bet there are loads of things to be shortened. Im almost positive a lot of the mousehovering stuff is overly complicated.

Oh I'm sure they is, but right now it works and I have a hard time re-writing something that works.

From: Dan Cardin
A perfect example of ways to shorten the code. If they represent indexes of arrays…why not just use arrays? They're shorter. You wouldnt end up with annoying problems like we have now when you want to add something and stuff gets screwed up. Trust me it would make things a lot easier.
I don't know what you mean. There are arrays… the point of the constants are so throughout the script you can use Images[IMG_EXIT] rather than having to remember Images[11] for the exit image. You should be able to change the constants without there being an error, and in this case I don't think you can. When the constants are setup properly, I don't know how you think they're pointless. Maybe you just don't understand them, but that's just my opinion. When used properly, it makes knowing what's what 100% easier.

From: Dan Cardin

There are just so many items in the list. I was under the impression that the goal was to only display checkboxes for stuff that was applicable to the selected scripts. Like on the 4th tab (including the >>) if i have draynor willows selected, then would varrok east actually be a valid location that the script could work with? If so then disregard my comment

That's actually a good point, I didn't think of that. I suppose it wouldn't be that hard to change. :) The valid locations for each script are stored in the TScript record, so is should actually be easy.

From: Dan Cardin

EDIT: ohh, and fixing the loading and saving of players to have dialog boxes or at the very least, not error if the file you load doesn't exist.

What error do you get? If the file doesn't exists and message should say "You have to save players before you can load them". And I don't know what you mean when you say they should have dialog boxes.

From: mormonman
Out of range error when you delete the last player to empty the playerlist.

Hm, I didn't think you could delete the last player. I'll look into that as soon as I can.

I also updated the first post.

Dan Cardin

2010-12-30 17:46:14

the load should be after because what if it turns out that you dont want to run the script at all, but you want to just put all your players into the array, save, and exit. But you have to unnecessarily load smart, SRL and MSI. I dont know if you've commited it yet, but you should load smart and srl after because they're unnecessary. MSI can wait i suppose, but i would change it if i knew how.

I don't know what you mean. There are arrays… the point of the constants are so throughout the script you can use Images[IMG_EXIT] rather than having to remember Images[11] for the exit image. You should be able to change the constants without there being an error, and in this case I don't think you can. When the constants are setup properly, I don't know how you think they're pointless. Maybe you just don't understand them, but that's just my opinion. When used properly, it makes knowing what's what 100% easier.
i just think its much better. Its 100% shorter too. I would rather have it that much shorter on something that wont break than longer with something easier to read. Also trying to test the form or edit it, it takes like 4 seconds to load just to tell me if i have an error or not.

That's actually a good point, I didn't think of that. I suppose it wouldn't be that hard to change. The valid locations for each script are stored in the TScript record, so is should actually be easy.
yay

What error do you get? If the file doesn't exists and message should say "You have to save players before you can load them". And I don't know what you mean when you say they should have dialog boxes.
for saving i got " "" is not a valid boolean" and for loading i cant reproduce. By dialogs i mean, when you do "save as" on any application…that, or open.

EDIT: and from your code, all the stuff still does from IMG_TAB_NORM_1..IMG_TAB_NORM_5. I would have thought that if the >> tab was a tab it would be IMG_TAB_NORM_0..IMG_TAB_NORM_5

but you probably cant do that so easily because its after all the other tabs in the consts. unless im seeing something wrong here.

EDIT: and you seem to have included MSI_Form in Setup, so and msi_form includes Setup so….
and en extra "end;" in a globals function.

EDIT:
{$i MSI/MSI/Core/Setup.simba}

const
IMG_COUNT = 12;
IMG_BGND = 0;
IMG_X_NORM = 1;
IMG_Q_NORM = 2;
IMG_LOAD_TAB_NORM = 3;
IMG_SAVE_TAB_NORM = 4;
IMG_TAB_NORM_1 = 5;
IMG_TAB_NORM_2 = 6;
IMG_TAB_NORM_3 = 7;
IMG_TAB_NORM_4 = 8;
IMG_TAB_NORM_5 = 9;
IMG_TAB_NORM_0 = 10;
IMG_RUN_NORM = 11;

PANEL_COUNT = 6;

BITMAP_COUNT = 24;
BGND = 0;
X_NORM = 1;
X_HOVER = 2;
Q_NORM = 3;
Q_HOVER = 4;
LOAD_TAB_NORM = 5;
LOAD_TAB_HOVER = 6;
SAVE_TAB_NORM = 7;
SAVE_TAB_HOVER = 8;
TAB_NORM_1 = 9;
TAB_HOVER_1 = 10;
TAB_NORM_2 = 11;
TAB_HOVER_2 = 12;
TAB_NORM_3 = 13;
TAB_HOVER_3 = 14;
TAB_NORM_4 = 15;
TAB_HOVER_4 = 16;
TAB_NORM_5 = 17;
TAB_HOVER_5 = 18;
TAB_NORM_0 = 19;
TAB_HOVER_0 = 20;
BGND_PANEL = 21;
RUN_NORM = 22;
RUN_HOVER = 23;

// Form components
var
MainForm: TForm;
AnimTimer: TTimer;

tImages: array[0..IMG_COUNT - 1] of TImage;
frmBitmaps: array [0..BITMAP_COUNT - 1] of Integer;
isActiveImage: array[0..IMG_COUNT - 1] of Boolean;
isLeftTab: array[IMG_TAB_NORM_1..IMG_TAB_NORM_5] of Boolean;
panels: array [IMG_TAB_NORM_1..IMG_TAB_NORM_1 + PANEL_COUNT - 1] of TPanel;

Previous,Next: array [IMG_TAB_NORM_2..IMG_TAB_NORM_5] of TButton;
ChoosePlay: array [IMG_TAB_NORM_2..IMG_TAB_NORM_5] of TCombobox;

var
pBoxIndex: Integer; // Stores the index of the player displayed in the combo boxes relative to the combo box, not the MSI_Players array
ScriptReady: Boolean;

var // Panel 1: Player Management
checkList_Players: TCheckListBox;
edit_User, edit_Pass, edit_Pin: TEdit;
comboBox_Member: TComboBox;
btn_AddPlayer, btn_DeletePlayer: TButton;
panOne_Inst, label_Username, label_Pass, label_Pin, label_Member: TLabel;

var // Panel 3
CheckListBox_3: TCheckListBox;
inst_P3: TLabel;

var // Panel 4
CheckListBox_4: TCheckListBox;
inst_P4: TLabel;

var // Panel 5
inst_P5, timeTotal, timeBreak, loadsBreak, loadsTotal: TLabel;
time_Total_5, time_Break_5, loads_Break_5, loads_Total_5: TEdit;

var // Panel 6
inst_P6: TLabel;
ComboBox_Script_6: TComboBox;
nScript, pScript: TButton;

(**
* Converts a string to an integer array; for example,
* StrToIntArr(1,2,3,4) will result [1, 2, 3, 4]
*)
function StrToIntArr(Str: string): TIntegerArray;
var
i: Integer;
s: TStringArray;
begin
if (Str = '') then
Exit;

s := Explode(',', Str);

for i := 0 to High(s) do
try
SetLength(Result, Length(Result) + 1);
Result[High(Result)] := StrToInt(s[i]);
//Writeln('StrArrToIntArry['+IntToStr(High(Result))+']: '+IntToStr(Result[High(Result)]));
except
//Writeln('Invalid integer!');
end;
end;

(**
* Converts an integer array to a string; for example,
* IntArrToStr([1, 2, 3, 4]) will result '1,2,3,4'
*)
function IntArrToStr(Int: TIntegerArray): string;
var
i: Integer;
begin
if (Length(Int) <= 0) then
begin
Result := '';
Exit;
end;

for i := 0 to High(Int) do
if (i = High(Int)) then
Result := Result + IntToStr(Int[i])
else
Result := Result + IntToStr(Int[i]) + ',';

//Writeln(Result);
end;

// Get the player index from the player's name
function GetPlayerIndex(Username: string): Integer;
var
i: Integer;
begin
if (Username = '') then
Exit;

for i := 0 to High(MSI_Players) do
if (Lowercase(MSI_Players[i].Name) = Lowercase(Username)) then
begin
Result := i;
Exit;
end;
end;

// Prevents people from typing in combo boxes
procedure PreventTyping(Sender: TObject; var Key: Char);
begin
Key := Chr(VK_CANCEL);
end;

var // Intro Panel
intro_Inst, intro_Next: TLabel;

intro_Combos: array of TComboBox;
intro_Edits: array of TEdit;
intro_ComboLabels, intro_EditLabels: array of TLabel;
s: TStringArray;

procedure intro_CreateComponents();
var
i, j: Integer;
begin
intro_Inst := TLabel.Create(panels[IMG_TAB_NORM_0]);
with intro_Inst do
begin
Parent := panels[IMG_TAB_NORM_0];
SetBounds(70, 5, 100, 25);
Caption := 'Setup all the different script properties';
Font.Color := 2070783;
end;

intro_Next := TLabel.Create(panels[IMG_TAB_NORM_0]);
with intro_Next do
begin
Parent := panels[IMG_TAB_NORM_0];
SetBounds(25, 268, 100, 25);
Caption := 'Click the sliding panels to reveal player setup steps >>';
Font.Color := 2070783;
end;

for i := 0 to High(MSI_SetupVars) do
case i of
SETUP_DEBUG_SMART, SETUP_SAVE_DEBUG, SETUP_HUMAN_BREAK, SETUP_SWITCH_WORLDS:
begin
SetLength(intro_Combos, Length(intro_Combos) + 1);

intro_Combos[High(intro_Combos)] := TComboBox.Create(panels[IMG_TAB_NORM_0]);
with intro_Combos[High(intro_Combos)] do
begin
Parent := panels[IMG_TAB_NORM_0];
Text := 'True';
Items.Add('True');
Items.Add('False');
OnKeyPress := @PreventTyping;

for j := 0 to High(intro_Combos) do
SetBounds(100, 27 + (j * 35), 60, 20);
end;
end;

SETUP_BREAK_TIME, SETUP_DEBUG_LEVEL, SETUP_ANTIBAN_WAIT, SETUP_RANDOMS_WAIT,
SETUP_STATS_ID, SETUP_STATS_PASS:
begin
SetLength(intro_Edits, Length(intro_Edits) + 1);

intro_Edits[High(intro_Edits)] := TEdit.Create(panels[IMG_TAB_NORM_0]);
with intro_Edits[High(intro_Edits)] do
begin
Parent := panels[IMG_TAB_NORM_0];

for j := 0 to High(intro_Edits) do
SetBounds(252, 27 + (j * 35), 70, 20);
end;
end;
end;

SetLength(intro_EditLabels, Length(intro_Edits));
s := ['Break Time', 'Level to Debug', 'Antiban Wait', 'Randoms Wait', 'World',
'Stats ID', 'Stats Pass'];
for i := 0 to High(intro_EditLabels) do
begin
intro_EditLabels[i] := TLabel.Create(panels[IMG_TAB_NORM_0]);
with intro_EditLabels[i] do
begin
Parent := panels[IMG_TAB_NORM_0];
Caption := s[i];
Font.Color := 2070783;
Font.Size := 8;
SetBounds(intro_Edits[i].Left - (intro_Edits[i].Width + 12), intro_Edits[i].Top + 4, 50, 25);
end;
end;

SetLength(intro_ComboLabels, Length(intro_Combos));
s := ['Debug SMART', 'Save Debug', 'Human Breaking', 'Switch Worlds'];
for i := 0 to High(intro_ComboLabels) do
begin
intro_ComboLabels[i] := TLabel.Create(panels[IMG_TAB_NORM_0]);
with intro_ComboLabels[i] do
begin
Parent := panels[IMG_TAB_NORM_0];
Caption := s[i];
Font.Color := 2070783;
Font.Size := 8;
SetBounds(intro_Combos[i].Left - (intro_Combos[i].Width + 32), intro_Combos[i].Top + 4, 50, 25);
end;
end;

end;

procedure intro_Settings(Save: Boolean);
var
i, j: Integer;
s: string;
begin
for i := 0 to High(MSI_SetupVars) do
case i of
SETUP_DEBUG_SMART, SETUP_SAVE_DEBUG, SETUP_HUMAN_BREAK, SETUP_SWITCH_WORLDS:
begin
case i of
SETUP_DEBUG_SMART: s := 'Debug SMART';
SETUP_SAVE_DEBUG: s := 'Save Debug';
SETUP_HUMAN_BREAK: s := 'Human Breaking';
SETUP_SWITCH_WORLDS: s := 'Switch Worlds';
end;

for j := 0 to High(intro_ComboLabels) do
if (intro_ComboLabels[j].Caption = s) then
if (Save) then
begin
WriteINI('SETTINGS', s, intro_Combos[j].Text, PATH_SETTINGS);
MSI_SetupVars[i] := StrToBool(intro_Combos[j].Text);
//Writeln('SetupVar['+IntToStr(i)+'] := '+ToStr(MSI_SetupVars[i]));
end else
intro_Combos[j].Text := ReadINI('SETTINGS', s, PATH_SETTINGS);
end;

SETUP_BREAK_TIME, SETUP_DEBUG_LEVEL, SETUP_ANTIBAN_WAIT, SETUP_RANDOMS_WAIT,
SETUP_STATS_ID, SETUP_STATS_PASS:
begin
case i of
SETUP_BREAK_TIME: s := 'Break Time';
SETUP_DEBUG_LEVEL: s := 'Level to Debug';
SETUP_ANTIBAN_WAIT: s := 'Antiban Wait';
SETUP_RANDOMS_WAIT: s := 'Randoms Wait';
SETUP_STATS_ID: s := 'Stats ID';
SETUP_STATS_PASS: s := 'Stats Pass';
end;

for j := 0 to High(intro_EditLabels) do
if (intro_EditLabels[j].Caption = s) then
if (Save) then
begin
WriteINI('SETTINGS', s, intro_Edits[j].Text, PATH_SETTINGS);

if (i = SETUP_STATS_ID) or (i = SETUP_STATS_PASS) then
MSI_SetupVars[i] := intro_Edits[j].Text
else
MSI_SetupVars[i] := StrToInt(intro_Edits[j].Text);

//Writeln('SetupVar['+IntToStr(i)+'] := '+ToStr(MSI_SetupVars[i]));
end else
intro_Edits[j].Text := ReadINI('SETTINGS', s, PATH_SETTINGS);

end;
end;
end;

(*
SCRIPT SETUP COMPONENTS & OTHER
===============================

Written by: Coh3n
*)

(**
* Used to for TScriptSetup for each player
*)
const
LIST_COUNT = 6;
LIST_ROCKS = 0;
LIST_TREES = 1;
LIST_FISHSPOTS = 2;
LIST_SPELLS = 3;
LIST_STAFFS = 4;
LIST_DROP = 5;

EDIT_COUNT = 6;
EDIT_LOADS = 0;
EDIT_TIME = 1;
EDIT_LEVEL = 2;
EDIT_EXCEPTIONS = 3;
EDIT_ALCH_SLOTS = 4;
EDIT_PRIORITY = 5;

var
script_ListTexts, script_EditTexts: TStringArray;
script_Lists: array[0..LIST_COUNT - 1] of TCheckListBox;
script_ListLabels: array[0..LIST_COUNT - 1] of TLabel;
script_Edits: array[0..EDIT_COUNT - 1] of TEdit;
script_EditLabels: array[0..EDIT_COUNT - 1] of TLabel;
script_StaffType: TComboBox;

procedure script_CreateComponents(PanelIndex: Integer);
var
i, j: Integer;
begin
// TCheckListBoxes
for i := 0 to High(script_Lists) do
begin
script_Lists[i] := TCheckListBox.Create(Panels[PanelIndex]);
with script_Lists[i] do
begin
Parent := Panels[PanelIndex];
Width := 140;
Height := 80;
Left := 20;
Top := 75;
Visible := False;

case i of
LIST_ROCKS:
begin
end;

LIST_TREES:
begin
end;

LIST_FISHSPOTS:
begin
end;

LIST_SPELLS:
begin
end;

LIST_STAFFS:
begin
Left := 20 + Width + 15;
end;

LIST_DROP:
begin
Left := 20 + Width + 15;

for i := 0 to High(MSI_Items) do
begin
if (MSI_Items[i].Name = '') then
Continue;

Items.Append(Capitalize(MSI_Items[i].Name));
end;
end;
end;
end;
end;

// TLabels
script_ListTexts := ['Rocks', 'Trees', 'Fishing Spots', 'Spells', 'Staffs', 'Don''t Drop/Bank'];
for i := 0 to High(script_ListLabels) do
begin
script_ListLabels[i] := TLabel.Create(Panels[PanelIndex]);
with script_ListLabels[i] do
begin
Parent := Panels[PanelIndex];
Height := 25;
Width := script_Lists[i].Width;
Left := script_Lists[i].Left;
Top := script_Lists[i].Top - (Height - 5);
Caption := script_ListTexts[i];
Font.Color := 2070783;
Visible := script_Lists[i].Visible;
end;
end;

// TEdits
for i := 0 to High(script_Edits) do
begin
script_Edits[i] := TEdit.Create(Panels[PanelIndex]);
with script_Edits[i] do
begin
Parent := Panels[PanelIndex];
Height := 20;
Visible := False;

case i of
EDIT_LOADS, EDIT_TIME, EDIT_LEVEL:
begin
Width := 40;
Left := (script_Lists[0].Left + script_Lists[0].Width - (Width + 40));
Top := (script_Lists[0].Top + script_Lists[0].Height + 20) + ((15 + Height) * i);
Text := '0';
Enabled := False;
end;

EDIT_EXCEPTIONS, EDIT_ALCH_SLOTS, EDIT_PRIORITY:
begin
Width := 80;
Left := script_Lists[LIST_DROP].Left + (Width - 40);
Top := (script_Lists[0].Top + script_Lists[0].Height + 20) + ((15 + Height) * (i - 3));
end;
end;
end;
end;

// Edit TLabels
script_EditTexts := ['Loads', 'Time', 'Level', 'Exceptions', 'Alching Slots', 'Priority'];
for i := 0 to High(script_EditLabels) do
begin
script_EditLabels[i] := TLabel.Create(Panels[PanelIndex]);
with script_EditLabels[i] do
begin
Parent := Panels[PanelIndex];
Height := 25;
Width := (script_Edits[i].Width);
Left := script_Edits[i].Left - Width;
Top := (script_Edits[i].Top + 4);
Caption := script_EditTexts[i];
Font.Color := 2070783;
Visible := script_Edits[i].Visible;
end;
end;
end;

procedure script_HideComponents();
var
i: Integer;
begin
for i := 0 to High(script_Lists) do
script_Lists[i].Visible := False;

for i := 0 to High(script_Edits) do
script_Edits[i].Visible := False;

for i := 0 to High(script_ListLabels) do
script_ListLabels[i].Visible := False;

for i := 0 to High(script_EditLabels) do
script_EditLabels[i].Visible := False;
end;

procedure script_ShowComponents();
var
i, j, k: Integer;
default, lists, edits: TIntegerArray;
mode, index: Integer;
begin
script_HideComponents();

for i := 0 to High(MSI_Scripts) do
if (MSI_Scripts[i].Name = comboBox_Script_6.Text) then
begin
case MSI_Scripts[i].SkillConst of
SKILL_WOODCUTTING, SKILL_MINING, SKILL_FISHING:
begin
case MSI_Scripts[i].SkillConst of
SKILL_WOODCUTTING:
begin
lists :=[LIST_TREES, LIST_DROP];
default := MSI_Scripts[i].Defaults.Trees;
end;

SKILL_MINING:
begin
lists :=[LIST_ROCKS, LIST_DROP];
default := MSI_Scripts[i].Defaults.Rocks;
end;

SKILL_FISHING:
begin
lists :=[LIST_FISHSPOTS, LIST_DROP];
default := MSI_Scripts[i].Defaults.FishSpots;
end;
end;

// Lists and edits for Woodcutting, Mining and Woodcutting
edits := [EDIT_LOADS, EDIT_TIME, EDIT_EXCEPTIONS, EDIT_PRIORITY, EDIT_LEVEL];

script_Lists[lists[0]].CLEAR;

// Add the default objects to the TCheckListBox
for j := 0 to High(default) do
for k := 0 to High(MSI_Objects) do
if (default[j] = k) then
script_Lists[lists[0]].Items.Append(Capitalize(MSI_Objects[k].Name));

// Make lists visible
for j := 0 to High(lists) do
begin
script_Lists[lists[j]].Visible := True;
script_ListLabels[lists[j]].Visible := True;
end;

// Make edit boxes visible
for j := 0 to High(edits) do
begin
script_Edits[edits[j]].Visible := True;
script_EditLabels[edits[j]].Visible := True;
end;
end;

SKILL_MAGIC:
begin
// Sets up spells if not already done so
if (not SpellSetup) then
SetupSpells;

script_Lists[LIST_SPELLS].CLEAR;
script_Lists[LIST_STAFFS].CLEAR;

// Adds all the spells to the Spells list
for j := 0 to High(MSI_Scripts[i].Defaults.Spells) do
begin
mode := MSI_GetSpellMode(MSI_Scripts[i].Defaults.Spells[j], index);
script_Lists[LIST_SPELLS].Items.Append(Capitalize(SpellModes[mode][index].Name));
end;

// Adds all the staffs to the Staff list
for j := 0 to High(MSI_Items) do
if (Pos('staff', Lowercase(MSI_Items[j].Name)) > 0) then
script_Lists[LIST_STAFFS].Items.Append(Capitalize(MSI_Items[j].Name));

// Makes all the required components visible
script_Lists[LIST_SPELLS].Visible := True;
script_Lists[LIST_STAFFS].Visible := True;
script_ListLabels[LIST_SPELLS].Visible := True;
script_ListLabels[LIST_STAFFS].Visible := True;
script_Edits[EDIT_TIME].Visible := True;
script_EditLabels[EDIT_TIME].Visible := True;
script_EditLabels[EDIT_ALCH_SLOTS].Visible := True;
script_Edits[EDIT_ALCH_SLOTS].Visible := True;
end;
end;
end;
end;

procedure script_FillComponents(pIndex: Integer); // OnChange
var
i, j, k, lIndex, sIndex, skill, mode, index: Integer;
objects: TIntegerArray;
begin
for i := 0 to High(MSI_Scripts) do
if (comboBox_Script_6.Text = MSI_Scripts[i].Name) then
begin
sIndex := comboBox_Script_6.ITEMS.IndexOf(comboBox_Script_6.Text);
skill := MSI_Scripts[i].SkillConst;
//Writeln('Skill: '+MSI_Scripts[i].SkillName);
Break;
end;

//Writeln('Script Index: '+IntToStr(sIndex));

case skill of
SKILL_WOODCUTTING, SKILL_MINING, SKILL_FISHING:
begin
case skill of
SKILL_WOODCUTTING:
begin
lIndex := LIST_TREES;
objects := MSI_Players[pIndex].Scripts[sIndex].Trees;
end;

SKILL_MINING:
begin
lIndex := LIST_ROCKS;
objects := MSI_Players[pIndex].Scripts[sIndex].Rocks;
end;

SKILL_FISHING:
begin
lIndex := LIST_FISHSPOTS;
objects := MSI_Players[pIndex].Scripts[sIndex].FishSpots;
end;
end;

// Check off the objects in the list
//Writeln(ToStr(objects));
for i := 0 to High(objects) do
for j := 0 to (script_Lists[lIndex].Items.Count - 1) do
if (Lowercase(script_Lists[lIndex].Items.Strings[j]) = Lowercase(MSI_Objects[objects[i]].Name)) then
script_Lists[lIndex].Checked[j] := True;

// Check off all the dont drop items
for i := 0 to High(MSI_Players[pIndex].Scripts[sIndex].DontDrop) do
for j := 0 to (script_Lists[LIST_DROP].Items.Count - 1) do
if (Lowercase(script_Lists[LIST_DROP].Items.Strings[j]) = Lowercase(MSI_Items[MSI_Players[pIndex].Scripts[sIndex].DontDrop[i]].Name)) then
script_Lists[LIST_DROP].Checked[j] := True;

with MSI_Players[pIndex].Scripts[sIndex] do
begin
script_Edits[EDIT_LOADS].Text := IntToStr(Loads);
script_Edits[EDIT_LEVEL].Text := IntToStr(MaxLevel);
script_Edits[EDIT_PRIORITY].Text := IntArrToStr(Priority);
script_Edits[EDIT_EXCEPTIONS].Text := IntArrToStr(Exceptions);
end;
end;

SKILL_MAGIC:
begin
if (not SpellSetup) then
SetupSpells;

with MSI_Players[pIndex].Scripts[sIndex] do
begin
// Check off all the spells
for i := 0 to High(Spells) do
begin
mode := MSI_GetSpellMode(Spells[i], index);

for j := 0 to (script_Lists[LIST_SPELLS].ITEMS.Count - 1) do
if (Lowercase(SpellModes[mode][index].Name) = Lowercase(script_Lists[LIST_SPELLS].ITEMS.Strings[j])) then
script_Lists[LIST_SPELLS].Checked[j] := True;
end;

// Check off all the staffs
for i := 0 to High(Staffs) do
for j := 0 to (script_Lists[LIST_STAFFS].ITEMS.Count - 1) do
if (Lowercase(MSI_Items[Staffs[i]].Name) = Lowercase(script_Lists[LIST_STAFFS].ITEMS.Strings[j])) then
script_Lists[LIST_STAFFS].Checked[j] := True;

// Fill the AlchSlots edit
script_Edits[EDIT_ALCH_SLOTS].Text := IntArrToStr(MSI_Players[pIndex].Scripts[sIndex].AlchSlots);
end;
end;
end;

// Time is common for every script
with MSI_Players[pIndex].Scripts[sIndex] do
script_Edits[EDIT_TIME].Text := IntToStr(Time);

//Writeln('Filled Script Setup Components');
end;

procedure script_FillCombo();
var
i, pIndex: Integer;
begin
comboBox_Script_6.CLEAR;

pIndex := GetPlayerIndex(ChoosePlay[IMG_TAB_NORM_5].Text);

with MSI_Players[pIndex] do
for i := 0 to High(Scripts) do
comboBox_Script_6.Items.Append(MSI_Scripts[Scripts[i].Name].Name);
end;

(**
* Currently sets:
*
*)
procedure script_SetInfo();
var
i, j, skill, sIndex, pIndex, lIndex: Integer;
objects: TIntegerArray;
begin
if (comboBox_Script_6.Text = '') then
Exit;

for i := 0 to High(MSI_Scripts) do
if (comboBox_Script_6.Text = MSI_Scripts[i].Name) then
begin
sIndex := comboBox_Script_6.ITEMS.IndexOf(comboBox_Script_6.Text);
//Writeln('Script Index: '+IntToStr(sIndex));
skill := MSI_Scripts[i].SkillConst;
Break;
end;

pIndex := GetPlayerIndex(ChoosePlay[IMG_TAB_NORM_5].Text);
//Writeln('Player Index: '+IntToStr(pIndex));

case skill of
SKILL_WOODCUTTING, SKILL_MINING, SKILL_FISHING:
begin
case skill of
SKILL_WOODCUTTING:
lIndex := LIST_TREES;

SKILL_MINING:
lIndex := LIST_ROCKS;

SKILL_FISHING:
lIndex := LIST_FISHSPOTS;
end;

// Set the Trees, Rocks, and FishSpots depending on the skill
for i := 0 to script_Lists[lIndex].ITEMS.Count - 1 do
if (script_Lists[lIndex].Checked[i]) then
for j := 0 to High(MSI_Objects) do
if (Lowercase(MSI_Objects[j].Name) = Lowercase(script_Lists[lIndex].Items.Strings[i])) then
begin
case skill of
SKILL_WOODCUTTING:
with MSI_Players[pIndex].Scripts[sIndex] do
begin
SetLength(Trees, Length(Trees) + 1);
Trees[High(Trees)] := j;
ClearSameIntegers(Trees);
//Writeln('Player '+IntToStr(pIndex)+' Trees: '+ToStr(Trees));
end;

SKILL_MINING:
with MSI_Players[pIndex].Scripts[sIndex] do
begin
SetLength(Rocks, Length(Rocks) + 1);
Rocks[High(Rocks)] := j;
ClearSameIntegers(Rocks);
//Writeln('Player '+IntToStr(pIndex)+' Rocks: '+ToStr(Rocks));
end;

SKILL_FISHING:
with MSI_Players[pIndex].Scripts[sIndex] do
begin
SetLength(FishSpots, Length(FishSpots) + 1);
FishSpots[High(FishSpots)] := j;
ClearSameIntegers(FishSpots);
//Writeln('Player '+IntToStr(pIndex)+' FishSpots: '+ToStr(FishSpots));
end;
end;
end;

// Set the items to exclude from dropping/banking
for i := 0 to (script_Lists[LIST_DROP].ITEMS.Count - 1) do
if (script_Lists[LIST_DROP].Checked[i]) then
for j := 0 to High(MSI_Items) do
if (Lowercase(script_Lists[LIST_DROP].Items.Strings[i]) = Lowercase(MSI_Items[j].Name)) then
with MSI_Players[pIndex].Scripts[sIndex] do
begin
SetLength(DontDrop, Length(DontDrop) + 1);
DontDrop[High(DontDrop)] := j;
ClearSameIntegers(DontDrop);
end;

// Set the other script information
with MSI_Players[pIndex].Scripts[sIndex] do
begin
try
MaxLevel := StrToInt(script_Edits[EDIT_LEVEL].Text);
except
ShowMessage('Invalid max level! Please enter a number.');
end;

try
Loads := StrToInt(script_Edits[EDIT_LOADS].Text);
except
ShowMessage('Invalid loads! Please enter a number.');
end;

try
Time := StrToInt(script_Edits[EDIT_LOADS].Text);
except
ShowMessage('Invalid AnimTimer! Please enter a number.');
end;

try
Exceptions := StrToIntArr(script_Edits[EDIT_EXCEPTIONS].Text);
ClearSameIntegers(Exceptions);
except
ShowMessage('Invalid exceptions input!');
end;

try
Priority := StrToIntArr(script_Edits[EDIT_PRIORITY].Text);
ClearSameIntegers(Priority);
except
ShowMessage('Invalid priority input!');
end;
end;
end;

SKILL_MAGIC:
begin
if (not SpellSetup) then
SetupSpells;

// Set the Spells
for i := 0 to script_Lists[LIST_SPELLS].ITEMS.Count - 1 do
if (script_Lists[LIST_SPELLS].Checked[i]) then
with MSI_Players[pIndex].Scripts[sIndex] do
begin
SetLength(Spells, Length(Spells) + 1);
Spells[High(Spells)] := MSI_StrToSpell(script_Lists[LIST_SPELLS].ITEMS.Strings[i]);
ClearSameIntegers(Spells);
//Writeln('Player '+IntToStr(pIndex)+' Spells: '+ToStr(Spells));
end;

// Set the staffs
for i := 0 to script_Lists[LIST_STAFFS].ITEMS.Count - 1 do
if (script_Lists[LIST_STAFFS].Checked[i]) then
for j := 0 to High(MSI_Items) do
if (Lowercase(MSI_Items[j].Name) = Lowercase(script_Lists[LIST_STAFFS].ITEMS.Strings[i])) then
with MSI_Players[pIndex].Scripts[sIndex] do
begin
SetLength(Staffs, Length(Staffs) + 1);
Staffs[High(Staffs)] := j;
ClearSameIntegers(Staffs);
//Writeln('Player '+IntToStr(pIndex)+' Staffs: '+ToStr(Staffs));
end;

// Set the Alching Slots
MSI_Players[pIndex].Scripts[sIndex].AlchSlots := StrToIntArr(script_Edits[EDIT_ALCH_SLOTS].Text);
end;
end;

with MSI_Players[pIndex].Scripts[sIndex] do
try
Time := StrToInt(script_Edits[EDIT_TIME].Text);
except
ShowMessage('Invalid AnimTimer! Please enter a number.');
end;
end;

(*
END OF SCRIPT SETUP COMPONENTS
==============================
*)

procedure CheckOffScripts(PlayerIndex: Integer);
var
j, k: Integer;
begin
for j := 0 to High(MSI_Players[PlayerIndex].Scripts) do
for k := 0 to (CheckListBox_3.Items.Count - 1) do
if (Lowercase(MSI_Scripts[MSI_Players[PlayerIndex].Scripts[j].Name].Name) = Lowercase(CheckListBox_3.Items.Strings[k])) then
CheckListBox_3.Checked[k] := True;
end;

procedure CheckOffLocs(PlayerIndex: Integer);
var
j, k: Integer;
begin
with MSI_Players[PlayerIndex] do
for k := 0 to (CheckListBox_4.Items.Count - 1) do
if (Lowercase(MSI_Locations[Location].Name) = Lowercase(CheckListBox_4.Items.Strings[k])) then
begin
CheckListBox_4.Checked[k] := True;
Break;
end;
end;

procedure LoadOther(pIndex: Integer);
begin
time_Total_5.Text := IntToStr(MSI_Players[pIndex].TotalTime);
time_Break_5.Text := IntToStr(MSI_Players[pIndex].BreakTime);
loads_Break_5.Text := IntToStr(MSI_Players[pIndex].BreakLoads);
loads_Total_5.Text := IntToStr(MSI_Players[pIndex].TotalLoads);

time_Total_5.Enabled := True;
time_Break_5.Enabled := True;
loads_Break_5.Enabled := True;
loads_Total_5.Enabled := True;
end;

procedure LoadPlayersToPanels(s: string);
var
i, j, k, pIndex: Integer;
begin
s := Capitalize(s);

for i := IMG_TAB_NORM_2 to IMG_TAB_NORM_5 do
ChoosePlay[i].Items.Append(s);
end;

function SetScriptConsts(): TIntegerArray;
var
i, j: Integer;
begin
for i := 0 to (CheckListBox_3.Items.Count - 1) do
if (CheckListBox_3.Checked[i]) then
for j := 0 to High(MSI_Scripts) do
begin
if (MSI_Scripts[j].Name = '') then
Continue;

if (Lowercase(CheckListBox_3.Items.Strings[i]) = Lowercase(MSI_Scripts[j].Name)) then
begin
SetLength(Result, Length(Result) + 1);
Result[High(Result)] := MSI_Scripts[j].Constant;
end;
end;

for i := 0 to High(MSI_Players) do
if (Lowercase(ChoosePlay[IMG_TAB_NORM_2].Text) = Lowercase(MSI_Players[i].Name)) then
begin
SetLength(MSI_Players[i].Scripts, Length(Result));

for j := 0 to High(MSI_Players[i].Scripts) do
begin
MSI_Players[i].Scripts[j].Name := Result[j];
//Writeln(IntToStr(MSI_Players[i].Scripts[j].Name));
end;

Break;
end;

//Writeln('Scripts: ' + ToStr(Result));
end;

function SetLocConsts(): Integer;
var
i, j: Integer;
begin
for i := 0 to (CheckListBox_4.Items.Count - 1) do
if (CheckListBox_4.Checked[i]) then
for j := 0 to High(MSI_Locations) do
begin
if (MSI_Locations[j].Name = '') then
Continue;

if (Lowercase(ChoosePlay[IMG_TAB_NORM_3].Items.Strings[i]) = Lowercase(MSI_Locations[j].Name)) then
begin
Result := MSI_Locations[j].Constant;
Break;
end;
end;

for i := 0 to High(MSI_Players) do
if (Lowercase(ChoosePlay[IMG_TAB_NORM_3].Text) = Lowercase(MSI_Players[i].Name)) then
begin
MSI_Players[i].Location := Result;
//Writeln('Location: ' + ToStr(MSI_Players[i].Location));
Break;
end;

end;

procedure SetOther();
var
i: Integer;
begin
for i := 0 to High(MSI_Players) do
if (Lowercase(ChoosePlay[IMG_TAB_NORM_4].Text) = Lowercase(MSI_Players[i].Name)) then
with MSI_Players[i] do
begin
try
TotalTime := StrToInt(time_Total_5.Text);
except
ShowMessage('Total AnimTimer must be a number!');
Exit;
end;

try
BreakTime := StrToInt(time_Break_5.Text);
except
ShowMessage('Break after (AnimTimer) must be a number!');
Exit;
end;

try
BreakLoads := StrToInt(loads_Break_5.Text);
except
ShowMessage('Break after (loads) must be a number!');
Exit;
end;

try
TotalLoads := StrToInt(loads_Total_5.Text);
except
ShowMessage('Total loads must be a number!');
Exit;
end;

Break;
end;

//Writeln('Others set!');
end;

procedure SavePlayers();
var
i, j, k: Integer;
s: string;
begin
intro_Settings(True);

WriteINI('Number of Players', 'NumberOfPlayers', IntToStr(Length(MSI_Players)), PATH_PLAYER);

for i := 0 to High(MSI_Players) do
with MSI_Players[i] do
begin
s := '';
Active := checkList_Players.Checked[i];
SetLocConsts;
script_SetInfo;

WriteINI(IntToStr(i), 'Name', Name, PATH_PLAYER);
WriteINI(IntToStr(i), 'Pass', Pass, PATH_PLAYER);
WriteINI(IntToStr(i), 'Nick', Nick, PATH_PLAYER);
WriteINI(IntToStr(i), 'Pin', Pin, PATH_PLAYER);
WriteINI(IntToStr(i), 'Active', BoolToStr(Active), PATH_PLAYER);
WriteINI(IntToStr(i), 'Member', BoolToStr(Member), PATH_PLAYER);
WriteINI(IntToStr(i), 'Location', IntToStr(Location), PATH_PLAYER);
WriteINI(IntToStr(i), 'BreakTime', IntToStr(BreakTime), PATH_PLAYER);
WriteINI(IntToStr(i), 'BreakLoads', IntToStr(BreakLoads), PATH_PLAYER);
WriteINI(IntToStr(i), 'TotalTime', IntToStr(TotalTime), PATH_PLAYER);
WriteINI(IntToStr(i), 'TotalLoads', IntToStr(TotalLoads), PATH_PLAYER);

WriteINI(IntToStr(i), 'NumberOfScripts', IntToStr(Length(Scripts)), PATH_PLAYER);
for j := 0 to High(Scripts) do
begin
// Set for all skills
WriteINI(IntToStr(i), 'Script'+IntToStr(j)+'.Name', IntToStr(Scripts[j].Name), PATH_PLAYER);
WriteINI(IntToStr(i), 'Script'+IntToStr(j)+'.Time', IntToStr(Scripts[j].Time), PATH_PLAYER);

case MSI_Scripts[Scripts[j].Name].SkillConst of
SKILL_WOODCUTTING, SKILL_FISHING, SKILL_MINING:
begin
// DontDrop
if (Length(Scripts[j].DontDrop) > 0) then
WriteINI(IntToStr(i), 'Script'+IntToStr(j)+'.DontDrop', IntArrToStr(Scripts[j].DontDrop), PATH_PLAYER);

// Exceoptions
if (Length(Scripts[j].Exceptions) > 0) then
WriteINI(IntToStr(i), 'Script'+IntToStr(j)+'.Exceptions', IntArrToStr(Scripts[j].Exceptions), PATH_PLAYER);

// Priority
if (Length(Scripts[j].Priority) > 0) then
WriteINI(IntToStr(i), 'Script'+IntToStr(j)+'.Priority', IntArrToStr(Scripts[j].Priority), PATH_PLAYER);

// Level and Loads
WriteINI(IntToStr(i), 'Script'+IntToStr(j)+'.MaxLevel', IntToStr(Scripts[j].MaxLevel), PATH_PLAYER);
WriteINI(IntToStr(i), 'Script'+IntToStr(j)+'.Loads', IntToStr(Scripts[j].Loads), PATH_PLAYER);

// Trees, Rocks, and FishSpots
case MSI_Scripts[Scripts[j].Name].SkillConst of
SKILL_WOODCUTTING:
WriteINI(IntToStr(i), 'Script'+IntToStr(j)+'.Trees', IntArrToStr(Scripts[j].Trees), PATH_PLAYER);

SKILL_MINING:
WriteINI(IntToStr(i), 'Script'+IntToStr(j)+'.Rocks', IntArrToStr(Scripts[j].Rocks), PATH_PLAYER);

SKILL_FISHING:
WriteINI(IntToStr(i), 'Script'+IntToStr(j)+'.FishSpots', IntArrToStr(Scripts[j].FishSpots), PATH_PLAYER);
end;
end;

SKILL_MAGIC:
begin
// Staffs
if (Length(Scripts[j].Staffs) > 0) then
WriteINI(IntToStr(i), 'Script'+IntToStr(j)+'.Staffs', IntArrToStr(Scripts[j].Staffs), PATH_PLAYER);

// Spells
if (Length(Scripts[j].Spells) > 0) then
WriteINI(IntToStr(i), 'Script'+IntToStr(j)+'.Spells', IntArrToStr(Scripts[j].Spells), PATH_PLAYER);

// AlchSlots
if (Length(Scripts[j].AlchSlots) > 0) then
WriteINI(IntToStr(i), 'Script'+IntToStr(j)+'.AlchSlots', IntArrToStr(Scripts[j].AlchSlots), PATH_PLAYER);
end;
end;
end;
end;

ShowMessage('Saved Players!');
end;

procedure LoadPlayers();
var
i, j: Integer;
nPlayers, s, p: string;
begin
if (not FileExists(PATH_PLAYER)) then
begin
ShowMessage('Players need to be saved before they can be loaded!');
Exit;
end;

nPlayers := ReadINI('Number of Players', 'NumberOfPlayers', PATH_PLAYER);
SetLength(MSI_Players, StrToInt(nPlayers));

for i := 0 to High(MSI_Players) do
with MSI_Players[i] do
begin
Name := ReadINI(IntToStr(i), 'Name', PATH_PLAYER);
Pass := ReadINI(IntToStr(i), 'Pass', PATH_PLAYER);
Nick := ReadINI(IntToStr(i), 'Nick', PATH_PLAYER);
Pin := ReadINI(IntToStr(i), 'Pin', PATH_PLAYER);
Active := StrToBool(ReadINI(IntToStr(i), 'Active', PATH_PLAYER));
Member := StrToBool(ReadINI(IntToStr(i), 'Member', PATH_PLAYER));
Location := StrToInt(ReadINI(IntToStr(i), 'Location', PATH_PLAYER));
BreakTime := StrToInt(ReadINI(IntToStr(i), 'BreakTime', PATH_PLAYER));
BreakLoads := StrToInt(ReadINI(IntToStr(i), 'BreakLoads', PATH_PLAYER));
TotalTime := StrToInt(ReadINI(IntToStr(i), 'TotalTime', PATH_PLAYER));
TotalLoads := StrToInt(ReadINI(IntToStr(i), 'TotalLoads', PATH_PLAYER));

if (Member) then
begin
comboBox_Member.Text := 'True';
s := '[P2P] '
end else begin
comboBox_Member.Text := 'False';
s := '[F2P] ';
end;

if (Pin <> '') then
p := 'Pin';

checkList_Players.Items.Append(s + Capitalize(Name) + ' (' + Pass + ')' + p + Pin);
checkList_Players.Checked[i] := Active;

LoadPlayersToPanels(Name);

SetLength(Scripts, StrToInt(ReadINI(IntToStr(i), 'NumberOfScripts', PATH_PLAYER)));
for j := 0 to High(Scripts) do
begin
Scripts[j].Name := StrToInt(ReadINI(IntToStr(i), 'Script'+IntToStr(j)+'.Name', PATH_PLAYER));
Scripts[j].Time := StrToInt(ReadINI(IntToStr(i), 'Script'+IntToStr(j)+'.Time', PATH_PLAYER));

try
Scripts[j].Trees := StrToIntArr(ReadINI(IntToStr(i), 'Script'+IntToStr(j)+'.Trees', PATH_PLAYER));
Scripts[j].Rocks := StrToIntArr(ReadINI(IntToStr(i), 'Script'+IntToStr(j)+'.Rocks', PATH_PLAYER));
Scripts[j].FishSpots := StrToIntArr(ReadINI(IntToStr(i), 'Script'+IntToStr(j)+'.FishSpots', PATH_PLAYER));
Scripts[j].Spells := StrToIntArr(ReadINI(IntToStr(i), 'Script'+IntToStr(j)+'.Spells', PATH_PLAYER));
Scripts[j].DontDrop := StrToIntArr(ReadINI(IntToStr(i), 'Script'+IntToStr(j)+'.DontDrop', PATH_PLAYER));
Scripts[j].Exceptions := StrToIntArr(ReadINI(IntToStr(i), 'Script'+IntToStr(j)+'.Exceptions', PATH_PLAYER));
Scripts[j].Priority := StrToIntArr(ReadINI(IntToStr(i), 'Script'+IntToStr(j)+'.Priority', PATH_PLAYER));
Scripts[j].AlchSlots := StrToIntArr(ReadINI(IntToStr(i), 'Script'+IntToStr(j)+'.AlchSlots', PATH_PLAYER));
Scripts[j].Loads := StrToInt(ReadINI(IntToStr(i), 'Script'+IntToStr(j)+'.Loads', PATH_PLAYER));
Scripts[j].MaxLevel := StrToInt(ReadINI(IntToStr(i), 'Script'+IntToStr(j)+'.MaxLevel', PATH_PLAYER));
except
//Writeln('INI Doesn''t Exist!');
end;
end;
end;

tImages[IMG_LOAD_TAB_NORM].Enabled := False;
btn_DeletePlayer.Enabled := (Length(MSI_Players) > 1);
ShowMessage('Loaded Players!');
end;

procedure OnMouseMove(Sender: TObject; Shift: TShiftState; x, y: Integer);
var
x1, y1, hi, i, j, bmp, xdif, ydif, h: Integer;
BoundL, BoundT: Extended;
imgSwap, bmpArr, imgArr: Array of Integer;
begin
bmpArr := [ X_NORM, Q_NORM, LOAD_TAB_NORM,
SAVE_TAB_NORM, TAB_NORM_1, TAB_NORM_2,
TAB_NORM_3, TAB_NORM_4, TAB_NORM_5, TAB_NORM_0, RUN_NORM ];

imgArr := [ IMG_X_NORM, IMG_Q_NORM, IMG_LOAD_TAB_NORM,
IMG_SAVE_TAB_NORM, IMG_TAB_NORM_1, IMG_TAB_NORM_2,
IMG_TAB_NORM_3, IMG_TAB_NORM_4, IMG_TAB_NORM_5, IMG_TAB_NORM_0, IMG_RUN_NORM ];

hi := High(bmpArr);
case Sender of
tImages[IMG_BGND], Panels[IMG_TAB_NORM_1],
Panels[IMG_TAB_NORM_2], Panels[IMG_TAB_NORM_3], Panels[IMG_TAB_NORM_4],
Panels[IMG_TAB_NORM_5], Panels[IMG_TAB_NORM_0]:
begin
for i := 0 to hi do
begin
if (not isActiveImage[imgArr[i]]) then
Continue;

bmp := frmBitmaps[bmpArr[i]];
DrawBitmap(bmp, tImages[imgArr[i]].Canvas, 0, 0);
isActiveImage[imgArr[i]] := False;
end;
end;
end;

for h := 0 to hi do
case Sender of
tImages[imgArr[h]]:
begin
imgSwap := [imgArr[h], frmBitmaps[bmpArr[h] + 1]];
if (not isActiveImage[imgSwap[0]]) then
begin
DrawBitmap(imgSwap[1],tImages[imgSwap[0]].Canvas,0,0);
isActiveImage[imgSwap[0]] := True;
for i := 0 to hi do
begin
if (Sender = tImages[imgArr[i]]) then
Continue;

if (not isActiveImage[imgArr[i]]) then
Continue;

if (i = imgSwap[0] - 1) then
Continue;

bmp := frmBitmaps[bmpArr[i]];
DrawBitmap(bmp, tImages[imgArr[i]].Canvas, 0, 0);
isActiveImage[imgArr[i]] := False;
end;
end;
end;
end;
end;

const
MAX_MOVE = 315;

var
accel, pMoved, senderTab, pan: integer;
onLeft: Boolean;

procedure OnTimerEnabled(Sender: TObject);
var
i, e, d, hi, lo: Integer;
begin
accel := accel + 2;
pMoved := pMoved + accel;

if (senderTab = IMG_TAB_NORM_0) then
begin
panels[IMG_TAB_NORM_0].Width := panels[IMG_TAB_NORM_0].Width + accel;

for i := IMG_TAB_NORM_1 to IMG_TAB_NORM_5 do
begin
if (not isLeftTab[i]) then
Continue;

tImages[i].Left := tImages[i].Left + accel;

if (pMoved >= MAX_MOVE) then
begin
isLeftTab[i] := False;
AnimTimer.Enabled := False;
tImages[i].Left := tImages[i].Left - 5;
end;
end;
end else
begin
if (onLeft) then
for i := senderTab to IMG_TAB_NORM_5 do
begin
if (i = senderTab) or (not isLeftTab[i]) then
Continue;

tImages[i].Left := tImages[i].Left + accel;

if (pMoved >= MAX_MOVE) then
begin
isLeftTab[i] := False;
AnimTimer.Enabled := False;
tImages[i].Left := tImages[i].Left - 5;
end;

//Writeln(BoolToStr(isLeftTab[i]));
end
else begin
panels[IMG_TAB_NORM_0].Width := panels[IMG_TAB_NORM_0].Width - accel;

for i := senderTab downto IMG_TAB_NORM_1 do
begin
if (isLeftTab[i]) then
Continue;

tImages[i].Left := tImages[i].Left - accel;

if (pMoved >= MAX_MOVE) then
begin
isLeftTab[i] := True;
AnimTimer.Enabled := False;
tImages[i].Left := tImages[i].Left + 5;
end;

end;
end;
end;

for i := IMG_TAB_NORM_1 to IMG_TAB_NORM_5 do
begin
panels[i].left := tImages[i].left + tImages[i].width + 2
if i <> IMG_TAB_NORM_5 then
panels[i].width := tImages[i + 1].left - panels[i].left - 2
else
panels[i].width := MainForm.width - panels[i].left - 10;
end;

if (senderTab = IMG_TAB_NORM_0) then
if (pMoved >= MAX_MOVE) then
panels[IMG_TAB_NORM_0].Width := panels[IMG_TAB_NORM_0].Width - 10;
end;

procedure OnTabClick(Sender: TObject);
var
i: integer;
begin
if not AnimTimer.ENABLED then
begin
accel := 0;
pMoved := 0;
AnimTimer.enabled := true;
pan := senderTab;

if (Sender = tImages[IMG_TAB_NORM_0]) then
senderTab := IMG_TAB_NORM_0;

for i := IMG_TAB_NORM_1 to IMG_TAB_NORM_5 do
if (Sender = tImages[i]) then
begin
senderTab := i;
if (isLeftTab[senderTab]) then
onLeft := True
else
onLeft := False;
end;
end;
end;

procedure OnClickEvents(Sender: TObject); // OnClick
var
i, j, t: integer;
bmpArr, tScripts: TIntegerArray;
begin
for i := IMG_TAB_NORM_1 to IMG_TAB_NORM_5 do
if (isLeftTab[i]) then
Inc(t);

for i := IMG_TAB_NORM_1 to IMG_TAB_NORM_5 do
case Sender of
tImages[i]:
begin
if (isLeftTab[i]) then
if (t <= (i - (IMG_TAB_NORM_5 - IMG_TAB_NORM_1))) then
Exit;

OnTabClick(Sender);

if (not isLeftTab[i]) then
begin
bmpArr := [TAB_NORM_1, TAB_NORM_2, TAB_NORM_3, TAB_NORM_4, TAB_NORM_5];
DrawBitmap(frmBitmaps[bmpArr[i-IMG_TAB_NORM_1]], tImages[i].Canvas, 0, 0);
end;
end;
end;

case Sender of
tImages[IMG_X_NORM]:
begin
for i := 0 to BITMAP_COUNT - 1 do
FreeBitmap(frmBitmaps[i]);

MainForm.ModalResult := mrOk;
end;

tImages[IMG_Q_NORM]: OpenWebPage('http://villavu.com/forum/showthread.php?t=57723');

tImages[IMG_TAB_NORM_0]:
begin
if (t <= 0) then
Exit;

OnTabClick(Sender);
end;

tImages[IMG_SAVE_TAB_NORM]:
begin
DrawBitmap(frmBitmaps[SAVE_TAB_NORM],tImages[IMG_SAVE_TAB_NORM].Canvas, 0, 0);
SetScriptConsts;
SetLocConsts;
SetOther;
SavePlayers;
end;

tImages[IMG_LOAD_TAB_NORM]:
begin
DrawBitmap(frmBitmaps[LOAD_TAB_NORM],tImages[IMG_LOAD_TAB_NORM].Canvas, 0, 0);
LoadPlayers;
end;

tImages[IMG_RUN_NORM]:
begin
ScriptReady := True;

intro_Settings(True);
script_SetInfo();
SetScriptConsts();
SetLocConsts();
SetOther();
SavePlayers();

MainForm.ModalResult := mrOk;
end;
comboBox_Script_6:
script_SetInfo;
end;
end;

{******************************************************************************}
{ Name: function GenerateNick(Username: string): string; }
{ By: Coh3n }
{ Description: Generates the players nickname based on their username }
{******************************************************************************}
function GenerateNick(Username: string): string;
var
i, j: Integer;
s: TStringArray;
begin
s := Explode(' ', Username);
for i := 0 to High(s) do
if (Length(s[i]) >= 4) then
begin
for j := 2 to 4 do
Result := Result + s[i][j];

Break;
end;

//Writeln('Username: ' + Username);
//Writeln('Nickname: ' + Result);
end;

{******************************************************************************}
{ Name: procedure AddPlayer(); }
{ By: Coh3n }
{ Description: Adds a player to the player array. Called when the Add Player }
{ button is pressed }
{******************************************************************************}
procedure AddPlayer();
var
h: Integer;
begin
SetLength(MSI_Players, Length(MSI_Players) + 1);
btn_DeletePlayer.Enabled := (Length(MSI_Players) > 1);

h := High(MSI_Players);
with MSI_Players[h] do
begin
Name := edit_User.Text;
Pass := edit_Pass.Text;
Nick := GenerateNick(Name);
Pin := edit_Pin.Text;
Active := checkList_Players.Checked[checkList_Players.ItemIndex];
Member := StrToBool(comboBox_Member.Text);

//Writeln(Name);
//Writeln(Pass);
//Writeln(Nick);
//Writeln(Pin);
//Writeln(BoolToStr(Active));
//Writeln(BoolToStr(Member));
end;

//Writeln('Player Length: ' + IntToStr(Length(MSI_Players)));
end;

{******************************************************************************}
{ Name: procedure RemovePlayer(); }
{ By: Masterkill & Coh3n }
{ Description: Removes a player from the player array. Called when the Remove }
{ Player button is pressed }
{******************************************************************************}
procedure RemovePlayer();
var
i: Integer;
begin
//Writeln(IntToStr(checkList_Players.ItemIndex));
if (not (checkList_Players.ItemIndex = High(MSI_Players))) then
if (checkList_Players.ItemIndex + 1 = High(MSI_Players)) then
MSI_Players[checkList_Players.ItemIndex] := MSI_Players[High(MSI_Players)]
else
for i := checkList_Players.ItemIndex to High(MSI_Players) - 1 do
MSI_Players[i] := MSI_Players[i + 1];

btn_DeletePlayer.Enabled := (Length(MSI_Players) > 1);

SetLength(MSI_Players, Length(MSI_Players) - 1);
//Writeln('Player Length: ' + IntToStr(Length(MSI_Players)));
end;

procedure PanelOneClicks(Sender: TObject); // OnChange
var
sel, i: integer;
s, p: string;
begin
case sender of
btn_AddPlayer:
begin
if (StrToBool(comboBox_Member.Text)) then
s := '[P2P] '
else
s := '[F2P] ';

if (edit_Pin.Text <> '') then
p := 'Pin';

checkList_Players.Items.Append(s + Capitalize(edit_User.Text) + ' (' + edit_Pass.Text + ')' + p + edit_Pin.Text);

// Add player to the combo box on other panels
LoadPlayersToPanels(edit_User.Text);

checkList_Players.Checked[checkList_Players.items.Count - 1] := true;
checkList_Players.ItemIndex := checkList_Players.Items.Count - 1;

AddPlayer();

edit_User.Text := '';
edit_Pass.Text := '';
edit_Pin.Text := '';
end;

btn_DeletePlayer:
begin
if checkList_Players.ItemIndex >= 0 then
sel := checkList_Players.ItemIndex;
checkList_Players.Items.Delete(sel);
for i := IMG_TAB_NORM_2 to IMG_TAB_NORM_5 do
ChoosePlay[i].Items.Delete(sel);
if sel = 0 then
sel := 1;
checkList_Players.ItemIndex := sel - 1;

RemovePlayer();

edit_User.Text := '';
edit_Pass.Text := '';
edit_Pin.Text := '';
end;
end;
end;

procedure PanelFiveClicks(Sender: TObject); // OnChange
var
pIndex, i: Integer;
begin
case sender of
ComboBox_Script_6:
begin
script_ShowComponents();

for i := 0 to script_Lists[LIST_DROP].ITEMS.Count - 1 do
if (script_Lists[LIST_DROP].Checked[i]) then
script_Lists[LIST_DROP].Checked[i] := False;

pIndex := GetPlayerIndex(ChoosePlay[IMG_TAB_NORM_5].Text);
script_FillComponents(pIndex);
end;

nScript:
if ComboBox_Script_6.ITEMINDEX < ComboBox_Script_6.ITEMS.Count then
ComboBox_Script_6.ItemIndex := ComboBox_Script_6.ItemIndex + 1;

pScript:
if ComboBox_Script_6.ITEMINDEX > 0 then
ComboBox_Script_6.ItemIndex := ComboBox_Script_6.ItemIndex - 1;
end;
end;



procedure PlayerControls(Sender: TObject);
var i, pIndex: integer;
begin
for i := IMG_TAB_NORM_2 to IMG_TAB_NORM_5 do
case sender of
ChoosePlay[i]: pBoxIndex := ChoosePlay[i].ItemIndex;
Previous[i]: if ChoosePlay[i].ItemIndex > 0 then
ChoosePlay[i].ItemIndex := ChoosePlay[i].ItemIndex - 1;
Next[i]: if ChoosePlay[i].ItemIndex < ChoosePlay[i].Items.Count then
ChoosePlay[i].ItemIndex := ChoosePlay[i].ItemIndex + 1;
end;
case sender of
ChoosePlay[IMG_TAB_NORM_2]: SetScriptConsts;
ChoosePlay[IMG_TAB_NORM_3]: SetLocConsts;
ChoosePlay[IMG_TAB_NORM_4]: SetOther();
ChoosePlay[IMG_TAB_NORM_5]: script_SetInfo();
Next[IMG_TAB_NORM_2]:
if ChoosePlay[IMG_TAB_NORM_2].ItemIndex < ChoosePlay[IMG_TAB_NORM_2].Items.Count then
begin
pBoxIndex := ChoosePlay[IMG_TAB_NORM_2].ItemIndex;
SetScriptConsts;
pIndex := GetPlayerIndex(ChoosePlay[IMG_TAB_NORM_2].Items.Strings[pBoxIndex]);
CheckOffScripts(pIndex);

ChoosePlay[IMG_TAB_NORM_2].ItemIndex := ChoosePlay[IMG_TAB_NORM_2].ItemIndex + 1;

for i := 0 to CheckListBox_3.Items.Count - 1 do
CheckListBox_3.Checked[i] := False;
end;
end;
end;

procedure PlayerCUpdate(Sender: TObject);
var i, pIndex: integer;
begin
case sender of
ChoosePlay[IMG_TAB_NORM_2]:
begin
for i := 0 to CheckListBox_3.ITEMS.Count - 1 do
CheckListBox_3.Checked[i] := False;

pIndex := GetPlayerIndex(ChoosePlay[IMG_TAB_NORM_2].Text);
CheckOffScripts(pIndex);
CheckListBox_3.Enabled := True;
end;
ChoosePlay[IMG_TAB_NORM_3]:
begin
for i := 0 to CheckListBox_4.ITEMS.Count - 1 do
CheckListBox_4.Checked[i] := False;

pIndex := GetPlayerIndex(ChoosePlay[IMG_TAB_NORM_3].Text);

CheckOffLocs(pIndex);
CheckListBox_4.Enabled := True;
end;
ChoosePlay[IMG_TAB_NORM_4]:
begin
pIndex := GetPlayerIndex(ChoosePlay[IMG_TAB_NORM_4].Text);
LoadOther(pIndex);
end;
ChoosePlay[IMG_TAB_NORM_5]:
begin
SetScriptConsts();
script_FillCombo();
script_HideComponents();
end;
end;
end;



// Used to display a background image on the panels
var
bgndPanel: TImage;
a, b: Integer;

procedure InitForm;
var
i, pan: Integer;
consts: TintegerArray;
bmpArr: TStringArray;
xy: TPointArray;
visibl: array of boolean;
wh: TPoint;
begin
bmpArr := ['BGND','X_NORM','X_HOVER','Q_NORM','Q_HOVER','LOAD_TAB_NORM','LOAD_TAB_HOVER','SAVE_TAB_NORM','SAVE_TAB_HOVER','TAB_NORM_1','TAB_HOVER_1','TAB_NORM_2','TAB_HOVER_2','TAB_NORM_3','TAB_HOVER_3','TAB_NORM_4','TAB_HOVER_4','TAB_NORM_5','TAB_HOVER_5','TAB_NORM_0','TAB_HOVER_0', 'BGND_PANEL', 'RUN_NORM', 'RUN_HOVER'];
for i := 0 to High(frmBitmaps) do
frmBitmaps[i] := LoadBitmap(ScriptPath + 'Bitmaps\' + bmpArr[i] + '.png');

MainForm := TForm.Create(nil);
MainForm.SetBounds({L} 100, {T} 100, {W} 600, {H} 400);
MainForm.Position := poScreenCenter;
MainForm.BorderStyle := bsNone;

AnimTimer := TTimer.Create(MainForm);
with AnimTimer do
begin
ONTIMER := @OnTimerEnabled;
INTERVAL := 10;
ENABLED := false;
end;

xy := [Point(0, 0), Point(575, 7), Point(557, 7), Point(7, 69), Point(81, 69), Point(386, 100), Point(427, 100), Point(468, 100), Point(509, 100), Point(550, 100), Point(8, 222), Point(519, 69) ];
SetArrayLength(visibl, GetArrayLength(xy));
consts := [BGND, X_NORM, Q_NORM, LOAD_TAB_NORM, SAVE_TAB_NORM, TAB_NORM_1, TAB_NORM_2, TAB_NORM_3, TAB_NORM_4, TAB_NORM_5, TAB_NORM_0, RUN_NORM ];

for i := 0 to IMG_COUNT - 1 do
begin
tImages[i] := TImage.Create(MainForm)
with tImages[i] do
begin
Parent := MainForm;
GetBitmapSize(frmBitmaps[consts[i]], wh.x, wh.y);
SetBounds(xy[i].x, xy[i].y, wh.x, wh.y);
OnMouseMove := @OnMouseMove;
OnClick := @OnClickEvents;
isActiveImage[i] := False;
end;
DrawBitmap(frmBitmaps[consts[i]], tImages[i].canvas, 0, 0);
end;

for i := low(panels) to high(panels) do
begin
panels[i] := TPanel.Create(MainForm);
panels[i].parent := MainForm;
GetBitmapSize(frmBitmaps[consts[i]], wh.x, wh.y);
panels[i].SetBounds(xy[i].x + wh.x, xy[i].y, 0, wh.y);
panels[i].BevelWidth := 0;

if (i = High(panels)) then
panels[i].SetBounds(10 + tImages[IMG_TAB_NORM_0].Width, 100,
tImages[IMG_TAB_NORM_1].Left - (tImages[IMG_TAB_NORM_0].Left + tImages[IMG_TAB_NORM_0].Width) - 4,
tImages[IMG_TAB_NORM_1].Height);

bgndPanel := TImage.Create(panels[i]);
bgndPanel.Parent := panels[i];
bgndPanel.Visible := True;
GetBitmapSize(frmBitmaps[BGND_PANEL], a, b);
bgndPanel.SetBounds(0, 0, a, b);
DrawBitmap(frmBitmaps[BGND_PANEL], bgndPanel.Canvas, 0, 0);
end;

pan := IMG_TAB_NORM_1;

checkList_Players := TCheckListBox.Create(panels[pan]);
checkList_Players.Parent := panels[pan];
checkList_Players.SetBounds(10, 55, 225, 220);

label_Username := TLabel.Create(panels[pan]);
label_Username.Parent := panels[pan];
label_Username.Setbounds(245,55,50,13);
label_Username.Caption := 'Username';
label_Username.Font.Color := 2070783;

edit_User := TEdit.Create(panels[pan]);
edit_User.Parent := panels[pan];
edit_User.SetBounds(label_Username.left,label_Username.top + label_Username.height + 5,83,21);

label_Pass := TLabel.Create(panels[pan]);
label_Pass.Parent := panels[pan];
label_Pass.Setbounds(label_Username.left, edit_User.top + edit_User.height + 10,32,13);
label_Pass.Caption := 'Password';
label_Pass.Font.Color := 2070783;

edit_Pass := TEdit.Create(panels[pan]);
edit_Pass.Parent := panels[pan];
edit_Pass.SetBounds(label_Username.left,label_Pass.top + label_Pass.height + 5,83,21);

label_Pin := TLabel.Create(panels[pan]);
label_Pin.Parent := panels[pan];
label_Pin.Setbounds(label_Username.left, edit_Pass.top + edit_Pass.height + 10,32,13);
label_Pin.Caption := 'Pin';
label_Pin.Font.Color := 2070783;

edit_Pin := TEdit.Create(panels[pan]);
edit_Pin.Parent := panels[pan];
edit_Pin.SetBounds(label_Username.left, label_Pin.top + label_Pin.height + 5, 83, 21);
edit_Pin.MaxLength := 4;

label_Member := TLabel.Create(panels[pan]);
label_Member.Parent := panels[pan];
label_Member.Setbounds(label_Username.left, edit_Pin.top + edit_Pin.height + 10,32,13);
label_Member.Caption := 'Members';
label_Member.Font.Color := 2070783;

comboBox_Member := TComboBox.Create(panels[pan]);
comboBox_Member.Parent := panels[pan];
comboBox_Member.SetBounds(label_Username.left, label_Member.top + label_Member.height + 5, 83, 21);
comboBox_Member.OnKeyPress := @PreventTyping;
comboBox_Member.Items.Add('True');
comboBox_Member.Items.Add('False');
comboBox_Member.Text := 'False';

btn_AddPlayer := TButton.Create(panels[pan]);
btn_AddPlayer.Parent := panels[pan];
btn_AddPlayer.Setbounds(22,22,95,25);
btn_AddPlayer.Caption := 'Add Player';
btn_AddPlayer.ONCLICK := @PanelOneClicks;

btn_DeletePlayer := TButton.Create(panels[pan]);
btn_DeletePlayer.Parent := panels[pan];
btn_DeletePlayer.SetBounds(btn_AddPlayer.left+btn_AddPlayer.width+10,btn_AddPlayer.top,btn_AddPlayer.width,btn_AddPlayer.height);
btn_DeletePlayer.Caption := 'Remove Player';
btn_DeletePlayer.OnClick := @PanelOneClicks;
btn_DeletePlayer.Enabled := (Length(MSI_Players) > 1);

panOne_Inst := TLabel.Create(panels[pan]);
panOne_Inst.Parent := panels[pan];
panOne_Inst.SetBounds(50,3,73,25);
panOne_Inst.Caption := 'Input player information and click Add Player';
panOne_Inst.Font.Color := 2070783;


for i := low(Previous) to high(Previous) do
begin
Previous[i] := TButton.Create(panels[i]);
Previous[i].Parent := panels[i];
Previous[i].SetBounds(35,24,73,25);
Previous[i].Caption := 'Previous';
Previous[i].OnClick := @PlayerControls;
//Previous[i].Visible := False;

ChoosePlay[i] := TComboBox.Create(panels[i]);
ChoosePlay[i].Parent := panels[i];
ChoosePlay[i].SetBounds(Previous[i].left + Previous[i].width + 5,Previous[i].top,115,21);
ChoosePlay[i].OnChange := @PlayerCUpdate;
ChoosePlay[i].OnKeyPress := @PreventTyping;
ChoosePlay[i].OnClick := @PlayerControls;

Next[i] := TButton.Create(panels[i]);
Next[i].Parent := panels[i];
Next[i].SetBounds(ChoosePlay[i].left + ChoosePlay[i].width + 5, ChoosePlay[i].top,75,25);
Next[i].Caption := 'Next';
Next[i].OnClick := @PlayerControls;
//Next[i].Visible := False;
end;


pan := IMG_TAB_NORM_2;

inst_P3 := TLabel.Create(panels[pan]);
inst_P3.Parent := panels[pan];
inst_P3.SetBounds(60,3,73,25);
inst_P3.Caption := 'Choose a script(s) for each player to use';
inst_P3.Font.Color := 2070783;

CheckListBox_3 := TCheckListBox.Create(panels[pan]);
CheckListBox_3.Parent := panels[pan];
CheckListBox_3.SetBounds(10, 55, 315, 220);
for i := 0 to High(MSI_Scripts) do
begin
if (MSI_Scripts[i].Name = '') then
Continue;

CheckListBox_3.Items.Add(Capitalize(MSI_Scripts[i].Name));
end;

CheckListBox_3.Enabled := False;




pan := IMG_TAB_NORM_3;

CheckListBox_4 := TCheckListBox.Create(panels[pan]);
CheckListBox_4.Parent := panels[pan];
CheckListBox_4.SetBounds(10, 55, 315, 220);
for i := 0 to High(MSI_Locations) do
begin
if (MSI_Locations[i].Name = '') or (MSI_Locations[i].Name = 'Lost') then
Continue;

CheckListBox_4.Items.Append(Capitalize(MSI_Locations[i].Name));
end;
CheckListBox_4.Enabled := False;

inst_P4 := TLabel.Create(panels[pan]);
inst_P4.Parent := panels[pan];
inst_P4.SetBounds(85, 3, 73, 25);
inst_P4.Caption := 'Set a location for each player';
inst_P4.Font.Color := 2070783;




pan := IMG_TAB_NORM_4;

inst_P5 := TLabel.Create(panels[pan]);
inst_P5.Parent := panels[pan];
inst_P5.SetBounds(38, 3, 73, 25);
inst_P5.Caption := 'Set all other required information for each player';
inst_P5.Font.Color := 2070783;

time_Total_5 := TEdit.Create(panels[pan]);
time_Total_5.Parent := panels[pan];
time_Total_5.SetBounds(180, 60, 83, 21);
time_Total_5.Text := '0';
time_Total_5.Enabled := False;

loads_Total_5 := TEdit.Create(panels[pan]);
with loads_Total_5 do
begin
Parent := panels[pan];
SetBounds(time_Total_5.Left, time_Total_5.Top + time_Total_5.Height + 10, 83, 21);
Text := '0';
Enabled := False;
end;

time_Break_5 := TEdit.Create(panels[pan]);
time_Break_5.Parent := panels[pan];
time_Break_5.SetBounds(time_Total_5.Left, loads_Total_5.Top + loads_Total_5.Height + 10, 83, 21);
time_Break_5.Text := '0';
time_Break_5.Enabled := False;

loads_Break_5 := TEdit.Create(panels[pan]);
loads_Break_5.Parent := panels[pan];
loads_Break_5.SetBounds(time_Total_5.Left, time_Break_5.Top + time_Break_5.Height + 10, 83, 21);
loads_Break_5.Text := '0';
loads_Break_5.Enabled := False;

timeTotal := TLabel.Create(panels[pan]);
timeTotal.Parent := panels[pan];
timeTotal.Setbounds(55, 63,32,13);
timeTotal.Caption := 'Total Time (minutes)';
timeTotal.Font.Color := 2070783;

loadsTotal := TLabel.Create(panels[pan]);
with loadsTotal do
begin
Parent := panels[pan];
Setbounds(timeTotal.Left, timeTotal.Top + time_total_5.height + 10,32,13);
Caption := 'Total Loads';
Font.Color := 2070783;
end;

timeBreak := TLabel.Create(panels[pan]);
timeBreak.Parent := panels[pan];
timeBreak.Setbounds(timeTotal.Left, loadsTotal.Top + loads_total_5.height + 10,32,13);
timeBreak.Caption := 'Break After (minutes)';
timeBreak.Font.Color := 2070783;

loadsBreak := TLabel.Create(panels[pan]);
loadsBreak.Parent := panels[pan];
loadsBreak.Setbounds(timeTotal.Left, timeBreak.Top + time_Break_5.Height+10,32,13);
loadsBreak.Caption := 'Break After (loads)';
loadsBreak.Font.Color := 2070783;



pan := IMG_TAB_NORM_5;

script_CreateComponents(pan);

nScript := TButton.Create(panels[pan]);
nScript.Parent := panels[pan];
nScript.SetBounds(Previous[pan].Left, Previous[pan].Top + Previous[pan].Height + 10, 73, 25);
nScript.Caption := 'Previous';
nScript.OnClick := @PanelFiveClicks;
nScript.Visible := False;

ComboBox_Script_6 := TComboBox.Create(panels[pan]);
ComboBox_Script_6.Parent := panels[pan];
ComboBox_Script_6.SetBounds(175, ChoosePlay[pan].top, 115, 21);
ComboBox_Script_6.OnChange := @PanelFiveClicks;
ComboBox_Script_6.OnKeyPress := @PreventTyping;
ComboBox_Script_6.OnClick := @OnClickEvents;

pScript := TButton.Create(panels[pan]);
pScript.Parent := panels[pan];
pScript.SetBounds(ComboBox_Script_6.left + ComboBox_Script_6.width + 5,nScript.top,75,25);
pScript.Caption := 'Next';
pScript.OnClick := @PanelFiveClicks;
pScript.Visible := False;

inst_P6 := TLabel.Create(panels[pan]);
inst_P6.Parent := panels[pan];
inst_P6.SetBounds(75, 3, 73, 25);
inst_P6.Caption := 'Setup each script for each player';
inst_P6.Font.Color := 2070783;

intro_CreateComponents;
intro_Settings(False);
end;

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

procedure ShowFormModal;
begin
MainForm.ShowModal;
end;

procedure SafeShowFormModal;
var
v: TVariantArray;
begin
SetArrayLength(v, 0);
ThreadSafeCall('ShowFormModal', v);
end;
that's with the next/previous stuff done. It compiles, but the combobox stuff doesnt update correctly with all of them. I'm not sure what's wrong because i didn't write any of those and I dont know what they do exactly.

Coh3n

2010-12-30 19:08:05

From: Dan Cardin
the load should be after because what if it turns out that you dont want to run the script at all, but you want to just put all your players into the array, save, and exit. But you have to unnecessarily load smart, SRL and MSI. I dont know if you've commited it yet, but you should load smart and srl after because they're unnecessary. MSI can wait i suppose, but i would change it if i knew how.

I would change it too if there was an effective way of doing it without rewriting everything. And honestly, how many people are going to do what you just said? I don't feel it's worth the trouble. E: I just got an idea, I'll try it out as soon as I can and let you know. :)

From: Dan Cardin

i just think its much better. Its 100% shorter too. I would rather have it that much shorter on something that wont break than longer with something easier to read. Also trying to test the form or edit it, it takes like 4 seconds to load just to tell me if i have an error or not.

So many people are hung up on having short code when it's much smarter to have something that works the exact same, but is much easier to read and understand. But again, I guess it's personal opinion. The Form will be staying the way it is as that's how the rest of MSI is, plus it's working perfectly fine (excluding small errors that occur with every initial release).

From: Dan Cardin

for saving i got " "" is not a valid boolean" and for loading i cant reproduce. By dialogs i mean, when you do "save as" on any application…that, or open.

Oh this is because you didn't fill out one of the script settings combo boxes. I forgot to commit the Settings.txt file that fills out the default settings. Update your MSI and you'll have that file. I'll add that to the bugs though. The part that checks the combo box's text should in a try statement so you don't get that error. Also, I don't have a clue of how to do a "Save As" type thing, or if it's possible, but I like the idea.

From: Dan Cardin

EDIT: and from your code, all the stuff still does from IMG_TAB_NORM_1..IMG_TAB_NORM_5. I would have thought that if the >> tab was a tab it would be IMG_TAB_NORM_0..IMG_TAB_NORM_5

but you probably cant do that so easily because its after all the other tabs in the consts. unless im seeing something wrong here.

That's what I tried to do originally, but I couldn't get it working properly for some reason, so I just added it to the end of the array. It's all working fine now, so I'm not too concerned about this.

I'm pretty sure it was an issue with the constants (I know you'll probably flame me for saying that). When done right, using constants are beautiful for scripting efficiency. I'm not sure where, but it seems somewhere they got messed up. I've never really looked to try to find it. I just wanted it to work. :p

From: Dan Cardin

EDIT: and you seem to have included MSI_Form in Setup, so and msi_form includes Setup so….

The form doesn't include Setup.simba? It's commented out.

From: Dan Cardin

and en extra "end;" in a globals function.

What? :o

Dan Cardin

2010-12-30 19:19:03

ahh, i must have accidentally commented it.

And i tried running the form and it told me "function srl_InFight: Boolean;" had an extra end.

see my above post. hopefully you'll know what's wrong.

Coh3n

2010-12-30 19:28:54

From: Dan Cardin
that's with the next/previous stuff done. It compiles, but the combobox stuff doesnt update correctly with all of them. I'm not sure what's wrong because i didn't write any of those and I dont know what they do exactly.

Do the Next/Previous buttons work? I couldn't get them to work properly for some reason. For the combo boxes are you talking about the player ones on each tab? I'll have to see what you changed cause they were working fine.

E: You have an old version of the form. I stopped committing to the form repository. It's all in the MSI repository now. Sorry I didn't mention that earlier.

Dan Cardin

2010-12-30 21:51:32

I really hope that doesnt change much in the stuff pertaining to what i changed.

EDIT: and it looks to me like the buttons work. It just doesnt enable the checkboxlist on the first tab with it, and it errors when you try to onclick an comboboxitem on the 2nd page

Coh3n

2010-12-31 02:11:34

From: Dan Cardin
I really hope that doesnt change much in the stuff pertaining to what i changed.

EDIT: and it looks to me like the buttons work. It just doesnt enable the checkboxlist on the first tab with it, and it errors when you try to onclick an comboboxitem on the 2nd page

That's odd, I'll have to look into it when I get more time.

E: Committed a couple things: fixed the out of range when deleting the last player in the list and added some hints to the first panel.

E2: Okay Dan, I looked at the stuff you changed. For the most part, what I've changed in newer versions won't effect what you've changed, I'll just have to manually make your changes rather than apply a patch. Everything you've done looks great, nice work; however, the last tab (5) won't work properly the way you have it because of the way I've set it up.



I put them side by side because I was kind of pressed for space (we planned out the form incorrectly; we should have placed all the components and then made images around them). What I think the best option would be is to "stack" the combo boxes and Previous/Next buttons. So, it would look something like this:



Since Tab 5 is tight for space, we could have a form like this pop up that has all the script's setup components. And we could just have "OK" and "Cancel" buttons on the setup form (which I could make in Photoshop in a couple minutes; we could also just use the "X" image again).



What do you think? It would also leave plenty of room for additions as they come.

Dan Cardin

2010-12-31 10:57:45

Yea, i wanted to fix that in mine cuz the combobox was overlapping and screwed up, but i forgot. Hmm. Is a lot of stuff planned to go in there? I would rather not have a pop up, but if you really cant fit everything in the space without making it look cramped, then it looks like the next best thing.

Did you see what was wrong with the checkboxelists?

EDIT: looks like you fixed the error, and but the next button seems to skippp.

EDIT: maybe not….I'm not sure which file im supposed to run to run the form any more. Or to start msi for that matter

EDIT: so, i had to recheckout the repo for it to add my RunMe file and when i do it tells me

[Error] C:\Documents and Settings\Owner\Desktop\simba\Includes\MSI/MSI/Core/Reports.simba(98:107): Unknown identifier 'RandomsResult' at line 97

EDIT: i think im good. but you havent applied my changes yet, so ill wait. I can try making patches instead of just posting my version of the script from now on.

Coh3n

2010-12-31 11:39:56

From: Dan Cardin
Yea, i wanted to fix that in mine cuz the combobox was overlapping and screwed up, but i forgot. Hmm. Is a lot of stuff planned to go in there? I would rather not have a pop up, but if you really cant fit everything in the space without making it look cramped, then it looks like the next best thing.

Yeah I would rather avoid it too; however, if we stack the last tab, even if we crammed the components in there I don't think there would be enough room. Plus with a pop up, there's tons of space for additions (and we make additions all the time).

From: Dan Cardin

Did you see what was wrong with the checkboxelists?

EDIT: looks like you fixed the error, and but the next button seems to skippp.

EDIT: maybe not….I'm not sure which file im supposed to run to run the form any more. Or to start msi for that matter

Yeah no, I haven't made any of your changes yet; just looked through them. And no, I didn't see the error; but I'm sure I'll find it when I start making the changes.

And sorry for the confusion. To run the form (and MSI) all you have to do is download MSI to you includes folder via SVN (http://www.villavu.com/repositories/msi), and open and run RunMe.simba. Yes, you'll have to wait for SMART to load, but I'm going to try to fix that right now.

Dan Cardin

2010-12-31 11:53:12

so, i had to recheckout the repo for it to add my RunMe file (because updating wouldnt add it before) and when i do it tells me

[Error] C:\Documents and Settings\Owner\Desktop\simba\Includes\MSI/MSI/Core/Reports.simba(98:107): Unknown identifier 'RandomsResult' at line 97

i think im good. but you havent applied my changes yet, so ill wait. I can try making patches instead of just posting my version of the script from now on.

EDIT: and it didn't seem like i had the error anymore, but if you're going to apply my changes, use this -
{$i MSI/MSI/Core/Setup.simba}

const
IMG_COUNT = 12;
IMG_BGND = 0;
IMG_X_NORM = 1;
IMG_Q_NORM = 2;
IMG_LOAD_TAB_NORM = 3;
IMG_SAVE_TAB_NORM = 4;
IMG_TAB_NORM_1 = 5;
IMG_TAB_NORM_2 = 6;
IMG_TAB_NORM_3 = 7;
IMG_TAB_NORM_4 = 8;
IMG_TAB_NORM_5 = 9;
IMG_TAB_NORM_0 = 10;
IMG_RUN_NORM = 11;

PANEL_COUNT = 6;

BITMAP_COUNT = 24;
BGND = 0;
X_NORM = 1;
X_HOVER = 2;
Q_NORM = 3;
Q_HOVER = 4;
LOAD_TAB_NORM = 5;
LOAD_TAB_HOVER = 6;
SAVE_TAB_NORM = 7;
SAVE_TAB_HOVER = 8;
TAB_NORM_1 = 9;
TAB_HOVER_1 = 10;
TAB_NORM_2 = 11;
TAB_HOVER_2 = 12;
TAB_NORM_3 = 13;
TAB_HOVER_3 = 14;
TAB_NORM_4 = 15;
TAB_HOVER_4 = 16;
TAB_NORM_5 = 17;
TAB_HOVER_5 = 18;
TAB_NORM_0 = 19;
TAB_HOVER_0 = 20;
BGND_PANEL = 21;
RUN_NORM = 22;
RUN_HOVER = 23;

// Form components
var
MainForm: TForm;
AnimTimer: TTimer;

tImages: array[0..IMG_COUNT - 1] of TImage;
frmBitmaps: array [0..BITMAP_COUNT - 1] of Integer;
isActiveImage: array[0..IMG_COUNT - 1] of Boolean;
isLeftTab: array[IMG_TAB_NORM_1..IMG_TAB_NORM_5] of Boolean;
panels: array [IMG_TAB_NORM_1..IMG_TAB_NORM_1 + PANEL_COUNT - 1] of TPanel;

Previous,Next: array [IMG_TAB_NORM_2..IMG_TAB_NORM_5] of TButton;
ChoosePlay: array [IMG_TAB_NORM_2..IMG_TAB_NORM_5] of TCombobox;

var
pBoxIndex: Integer; // Stores the index of the player displayed in the combo boxes relative to the combo box, not the MSI_Players array
ScriptReady: Boolean;

var // Panel 1: Player Management
checkList_Players: TCheckListBox;
edit_User, edit_Pass, edit_Pin: TEdit;
comboBox_Member: TComboBox;
btn_AddPlayer, btn_DeletePlayer: TButton;
panOne_Inst, label_Username, label_Pass, label_Pin, label_Member: TLabel;

var // Panel 3
CheckListBox_3: TCheckListBox;
inst_P3: TLabel;

var // Panel 4
CheckListBox_4: TCheckListBox;
inst_P4: TLabel;

var // Panel 5
inst_P5, timeTotal, timeBreak, loadsBreak, loadsTotal: TLabel;
time_Total_5, time_Break_5, loads_Break_5, loads_Total_5: TEdit;

var // Panel 6
inst_P6: TLabel;
ComboBox_Script_6: TComboBox;
nScript, pScript: TButton;

(**
* Converts a string to an integer array; for example,
* StrToIntArr(1,2,3,4) will result [1, 2, 3, 4]
*)
function StrToIntArr(Str: string): TIntegerArray;
var
i: Integer;
s: TStringArray;
begin
if (Str = '') then
Exit;

s := Explode(',', Str);

for i := 0 to High(s) do
try
SetLength(Result, Length(Result) + 1);
Result[High(Result)] := StrToInt(s[i]);
//Writeln('StrArrToIntArry['+IntToStr(High(Result))+']: '+IntToStr(Result[High(Result)]));
except
//Writeln('Invalid integer!');
end;
end;

(**
* Converts an integer array to a string; for example,
* IntArrToStr([1, 2, 3, 4]) will result '1,2,3,4'
*)
function IntArrToStr(Int: TIntegerArray): string;
var
i: Integer;
begin
if (Length(Int) <= 0) then
begin
Result := '';
Exit;
end;

for i := 0 to High(Int) do
if (i = High(Int)) then
Result := Result + IntToStr(Int[i])
else
Result := Result + IntToStr(Int[i]) + ',';

//Writeln(Result);
end;

// Get the player index from the player's name
function GetPlayerIndex(Username: string): Integer;
var
i: Integer;
begin
if (Username = '') then
Exit;

for i := 0 to High(MSI_Players) do
if (Lowercase(MSI_Players[i].Name) = Lowercase(Username)) then
begin
Result := i;
Exit;
end;
end;

// Prevents people from typing in combo boxes
procedure PreventTyping(Sender: TObject; var Key: Char);
begin
Key := Chr(VK_CANCEL);
end;

var // Intro Panel
intro_Inst, intro_Next: TLabel;

intro_Combos: array of TComboBox;
intro_Edits: array of TEdit;
intro_ComboLabels, intro_EditLabels: array of TLabel;
s: TStringArray;

procedure intro_CreateComponents();
var
i, j: Integer;
begin
intro_Inst := TLabel.Create(panels[IMG_TAB_NORM_0]);
with intro_Inst do
begin
Parent := panels[IMG_TAB_NORM_0];
SetBounds(70, 5, 100, 25);
Caption := 'Setup all the different script properties';
Font.Color := 2070783;
end;

intro_Next := TLabel.Create(panels[IMG_TAB_NORM_0]);
with intro_Next do
begin
Parent := panels[IMG_TAB_NORM_0];
SetBounds(25, 268, 100, 25);
Caption := 'Click the sliding panels to reveal player setup steps >>';
Font.Color := 2070783;
end;

for i := 0 to High(MSI_SetupVars) do
case i of
SETUP_DEBUG_SMART, SETUP_SAVE_DEBUG, SETUP_HUMAN_BREAK, SETUP_SWITCH_WORLDS:
begin
SetLength(intro_Combos, Length(intro_Combos) + 1);

intro_Combos[High(intro_Combos)] := TComboBox.Create(panels[IMG_TAB_NORM_0]);
with intro_Combos[High(intro_Combos)] do
begin
Parent := panels[IMG_TAB_NORM_0];
Text := 'True';
Items.Add('True');
Items.Add('False');
OnKeyPress := @PreventTyping;

for j := 0 to High(intro_Combos) do
SetBounds(100, 27 + (j * 35), 60, 20);
end;
end;

SETUP_BREAK_TIME, SETUP_DEBUG_LEVEL, SETUP_ANTIBAN_WAIT, SETUP_RANDOMS_WAIT,
SETUP_STATS_ID, SETUP_STATS_PASS:
begin
SetLength(intro_Edits, Length(intro_Edits) + 1);

intro_Edits[High(intro_Edits)] := TEdit.Create(panels[IMG_TAB_NORM_0]);
with intro_Edits[High(intro_Edits)] do
begin
Parent := panels[IMG_TAB_NORM_0];

for j := 0 to High(intro_Edits) do
SetBounds(252, 27 + (j * 35), 70, 20);
end;
end;
end;

SetLength(intro_EditLabels, Length(intro_Edits));
s := ['Break Time', 'Level to Debug', 'Antiban Wait', 'Randoms Wait', 'World',
'Stats ID', 'Stats Pass'];
for i := 0 to High(intro_EditLabels) do
begin
intro_EditLabels[i] := TLabel.Create(panels[IMG_TAB_NORM_0]);
with intro_EditLabels[i] do
begin
Parent := panels[IMG_TAB_NORM_0];
Caption := s[i];
Font.Color := 2070783;
Font.Size := 8;
SetBounds(intro_Edits[i].Left - (intro_Edits[i].Width + 12), intro_Edits[i].Top + 4, 50, 25);
end;
end;

SetLength(intro_ComboLabels, Length(intro_Combos));
s := ['Debug SMART', 'Save Debug', 'Human Breaking', 'Switch Worlds'];
for i := 0 to High(intro_ComboLabels) do
begin
intro_ComboLabels[i] := TLabel.Create(panels[IMG_TAB_NORM_0]);
with intro_ComboLabels[i] do
begin
Parent := panels[IMG_TAB_NORM_0];
Caption := s[i];
Font.Color := 2070783;
Font.Size := 8;
SetBounds(intro_Combos[i].Left - (intro_Combos[i].Width + 32), intro_Combos[i].Top + 4, 50, 25);
end;
end;

end;

procedure intro_Settings(Save: Boolean);
var
i, j: Integer;
s: string;
begin
for i := 0 to High(MSI_SetupVars) do
case i of
SETUP_DEBUG_SMART, SETUP_SAVE_DEBUG, SETUP_HUMAN_BREAK, SETUP_SWITCH_WORLDS:
begin
case i of
SETUP_DEBUG_SMART: s := 'Debug SMART';
SETUP_SAVE_DEBUG: s := 'Save Debug';
SETUP_HUMAN_BREAK: s := 'Human Breaking';
SETUP_SWITCH_WORLDS: s := 'Switch Worlds';
end;

for j := 0 to High(intro_ComboLabels) do
if (intro_ComboLabels[j].Caption = s) then
if (Save) then
begin
WriteINI('SETTINGS', s, intro_Combos[j].Text, PATH_SETTINGS);
MSI_SetupVars[i] := StrToBool(intro_Combos[j].Text);
//Writeln('SetupVar['+IntToStr(i)+'] := '+ToStr(MSI_SetupVars[i]));
end else
intro_Combos[j].Text := ReadINI('SETTINGS', s, PATH_SETTINGS);
end;

SETUP_BREAK_TIME, SETUP_DEBUG_LEVEL, SETUP_ANTIBAN_WAIT, SETUP_RANDOMS_WAIT,
SETUP_STATS_ID, SETUP_STATS_PASS:
begin
case i of
SETUP_BREAK_TIME: s := 'Break Time';
SETUP_DEBUG_LEVEL: s := 'Level to Debug';
SETUP_ANTIBAN_WAIT: s := 'Antiban Wait';
SETUP_RANDOMS_WAIT: s := 'Randoms Wait';
SETUP_STATS_ID: s := 'Stats ID';
SETUP_STATS_PASS: s := 'Stats Pass';
end;

for j := 0 to High(intro_EditLabels) do
if (intro_EditLabels[j].Caption = s) then
if (Save) then
begin
WriteINI('SETTINGS', s, intro_Edits[j].Text, PATH_SETTINGS);

if (i = SETUP_STATS_ID) or (i = SETUP_STATS_PASS) then
MSI_SetupVars[i] := intro_Edits[j].Text
else
MSI_SetupVars[i] := StrToInt(intro_Edits[j].Text);

//Writeln('SetupVar['+IntToStr(i)+'] := '+ToStr(MSI_SetupVars[i]));
end else
intro_Edits[j].Text := ReadINI('SETTINGS', s, PATH_SETTINGS);

end;
end;
end;

(*
SCRIPT SETUP COMPONENTS & OTHER
===============================

Written by: Coh3n
*)

(**
* Used to for TScriptSetup for each player
*)
const
LIST_COUNT = 6;
LIST_ROCKS = 0;
LIST_TREES = 1;
LIST_FISHSPOTS = 2;
LIST_SPELLS = 3;
LIST_STAFFS = 4;
LIST_DROP = 5;

EDIT_COUNT = 6;
EDIT_LOADS = 0;
EDIT_TIME = 1;
EDIT_LEVEL = 2;
EDIT_EXCEPTIONS = 3;
EDIT_ALCH_SLOTS = 4;
EDIT_PRIORITY = 5;

var
script_ListTexts, script_EditTexts: TStringArray;
script_Lists: array[0..LIST_COUNT - 1] of TCheckListBox;
script_ListLabels: array[0..LIST_COUNT - 1] of TLabel;
script_Edits: array[0..EDIT_COUNT - 1] of TEdit;
script_EditLabels: array[0..EDIT_COUNT - 1] of TLabel;
script_StaffType: TComboBox;

procedure script_CreateComponents(PanelIndex: Integer);
var
i, j: Integer;
begin
// TCheckListBoxes
for i := 0 to High(script_Lists) do
begin
script_Lists[i] := TCheckListBox.Create(Panels[PanelIndex]);
with script_Lists[i] do
begin
Parent := Panels[PanelIndex];
Width := 140;
Height := 80;
Left := 20;
Top := 75;
Visible := False;

case i of
LIST_ROCKS:
begin
end;

LIST_TREES:
begin
end;

LIST_FISHSPOTS:
begin
end;

LIST_SPELLS:
begin
end;

LIST_STAFFS:
begin
Left := 20 + Width + 15;
end;

LIST_DROP:
begin
Left := 20 + Width + 15;

for i := 0 to High(MSI_Items) do
begin
if (MSI_Items[i].Name = '') then
Continue;

Items.Append(Capitalize(MSI_Items[i].Name));
end;
end;
end;
end;
end;

// TLabels
script_ListTexts := ['Rocks', 'Trees', 'Fishing Spots', 'Spells', 'Staffs', 'Don''t Drop/Bank'];
for i := 0 to High(script_ListLabels) do
begin
script_ListLabels[i] := TLabel.Create(Panels[PanelIndex]);
with script_ListLabels[i] do
begin
Parent := Panels[PanelIndex];
Height := 25;
Width := script_Lists[i].Width;
Left := script_Lists[i].Left;
Top := script_Lists[i].Top - (Height - 5);
Caption := script_ListTexts[i];
Font.Color := 2070783;
Visible := script_Lists[i].Visible;
end;
end;

// TEdits
for i := 0 to High(script_Edits) do
begin
script_Edits[i] := TEdit.Create(Panels[PanelIndex]);
with script_Edits[i] do
begin
Parent := Panels[PanelIndex];
Height := 20;
Visible := False;

case i of
EDIT_LOADS, EDIT_TIME, EDIT_LEVEL:
begin
Width := 40;
Left := (script_Lists[0].Left + script_Lists[0].Width - (Width + 40));
Top := (script_Lists[0].Top + script_Lists[0].Height + 20) + ((15 + Height) * i);
Text := '0';
Enabled := False;
end;

EDIT_EXCEPTIONS, EDIT_ALCH_SLOTS, EDIT_PRIORITY:
begin
Width := 80;
Left := script_Lists[LIST_DROP].Left + (Width - 40);
Top := (script_Lists[0].Top + script_Lists[0].Height + 20) + ((15 + Height) * (i - 3));
end;
end;
end;
end;

// Edit TLabels
script_EditTexts := ['Loads', 'Time', 'Level', 'Exceptions', 'Alching Slots', 'Priority'];
for i := 0 to High(script_EditLabels) do
begin
script_EditLabels[i] := TLabel.Create(Panels[PanelIndex]);
with script_EditLabels[i] do
begin
Parent := Panels[PanelIndex];
Height := 25;
Width := (script_Edits[i].Width);
Left := script_Edits[i].Left - Width;
Top := (script_Edits[i].Top + 4);
Caption := script_EditTexts[i];
Font.Color := 2070783;
Visible := script_Edits[i].Visible;
end;
end;
end;

procedure script_HideComponents();
var
i: Integer;
begin
for i := 0 to High(script_Lists) do
script_Lists[i].Visible := False;

for i := 0 to High(script_Edits) do
script_Edits[i].Visible := False;

for i := 0 to High(script_ListLabels) do
script_ListLabels[i].Visible := False;

for i := 0 to High(script_EditLabels) do
script_EditLabels[i].Visible := False;
end;

procedure script_ShowComponents();
var
i, j, k: Integer;
default, lists, edits: TIntegerArray;
mode, index: Integer;
begin
script_HideComponents();

for i := 0 to High(MSI_Scripts) do
if (MSI_Scripts[i].Name = comboBox_Script_6.Text) then
begin
case MSI_Scripts[i].SkillConst of
SKILL_WOODCUTTING, SKILL_MINING, SKILL_FISHING:
begin
case MSI_Scripts[i].SkillConst of
SKILL_WOODCUTTING:
begin
lists :=[LIST_TREES, LIST_DROP];
default := MSI_Scripts[i].Defaults.Trees;
end;

SKILL_MINING:
begin
lists :=[LIST_ROCKS, LIST_DROP];
default := MSI_Scripts[i].Defaults.Rocks;
end;

SKILL_FISHING:
begin
lists :=[LIST_FISHSPOTS, LIST_DROP];
default := MSI_Scripts[i].Defaults.FishSpots;
end;
end;

// Lists and edits for Woodcutting, Mining and Woodcutting
edits := [EDIT_LOADS, EDIT_TIME, EDIT_EXCEPTIONS, EDIT_PRIORITY, EDIT_LEVEL];

script_Lists[lists[0]].CLEAR;

// Add the default objects to the TCheckListBox
for j := 0 to High(default) do
for k := 0 to High(MSI_Objects) do
if (default[j] = k) then
script_Lists[lists[0]].Items.Append(Capitalize(MSI_Objects[k].Name));

// Make lists visible
for j := 0 to High(lists) do
begin
script_Lists[lists[j]].Visible := True;
script_ListLabels[lists[j]].Visible := True;
end;

// Make edit boxes visible
for j := 0 to High(edits) do
begin
script_Edits[edits[j]].Visible := True;
script_EditLabels[edits[j]].Visible := True;
end;
end;

SKILL_MAGIC:
begin
// Sets up spells if not already done so
if (not SpellSetup) then
SetupSpells;

script_Lists[LIST_SPELLS].CLEAR;
script_Lists[LIST_STAFFS].CLEAR;

// Adds all the spells to the Spells list
for j := 0 to High(MSI_Scripts[i].Defaults.Spells) do
begin
mode := MSI_GetSpellMode(MSI_Scripts[i].Defaults.Spells[j], index);
script_Lists[LIST_SPELLS].Items.Append(Capitalize(SpellModes[mode][index].Name));
end;

// Adds all the staffs to the Staff list
for j := 0 to High(MSI_Items) do
if (Pos('staff', Lowercase(MSI_Items[j].Name)) > 0) then
script_Lists[LIST_STAFFS].Items.Append(Capitalize(MSI_Items[j].Name));

// Makes all the required components visible
script_Lists[LIST_SPELLS].Visible := True;
script_Lists[LIST_STAFFS].Visible := True;
script_ListLabels[LIST_SPELLS].Visible := True;
script_ListLabels[LIST_STAFFS].Visible := True;
script_Edits[EDIT_TIME].Visible := True;
script_EditLabels[EDIT_TIME].Visible := True;
script_EditLabels[EDIT_ALCH_SLOTS].Visible := True;
script_Edits[EDIT_ALCH_SLOTS].Visible := True;
end;
end;
end;
end;

procedure script_FillComponents(pIndex: Integer); // OnChange
var
i, j, k, lIndex, sIndex, skill, mode, index: Integer;
objects: TIntegerArray;
begin
for i := 0 to High(MSI_Scripts) do
if (comboBox_Script_6.Text = MSI_Scripts[i].Name) then
begin
sIndex := comboBox_Script_6.ITEMS.IndexOf(comboBox_Script_6.Text);
skill := MSI_Scripts[i].SkillConst;
//Writeln('Skill: '+MSI_Scripts[i].SkillName);
Break;
end;

//Writeln('Script Index: '+IntToStr(sIndex));

case skill of
SKILL_WOODCUTTING, SKILL_MINING, SKILL_FISHING:
begin
case skill of
SKILL_WOODCUTTING:
begin
lIndex := LIST_TREES;
objects := MSI_Players[pIndex].Scripts[sIndex].Trees;
end;

SKILL_MINING:
begin
lIndex := LIST_ROCKS;
objects := MSI_Players[pIndex].Scripts[sIndex].Rocks;
end;

SKILL_FISHING:
begin
lIndex := LIST_FISHSPOTS;
objects := MSI_Players[pIndex].Scripts[sIndex].FishSpots;
end;
end;

// Check off the objects in the list
//Writeln(ToStr(objects));
for i := 0 to High(objects) do
for j := 0 to (script_Lists[lIndex].Items.Count - 1) do
if (Lowercase(script_Lists[lIndex].Items.Strings[j]) = Lowercase(MSI_Objects[objects[i]].Name)) then
script_Lists[lIndex].Checked[j] := True;

// Check off all the dont drop items
for i := 0 to High(MSI_Players[pIndex].Scripts[sIndex].DontDrop) do
for j := 0 to (script_Lists[LIST_DROP].Items.Count - 1) do
if (Lowercase(script_Lists[LIST_DROP].Items.Strings[j]) = Lowercase(MSI_Items[MSI_Players[pIndex].Scripts[sIndex].DontDrop[i]].Name)) then
script_Lists[LIST_DROP].Checked[j] := True;

with MSI_Players[pIndex].Scripts[sIndex] do
begin
script_Edits[EDIT_LOADS].Text := IntToStr(Loads);
script_Edits[EDIT_LEVEL].Text := IntToStr(MaxLevel);
script_Edits[EDIT_PRIORITY].Text := IntArrToStr(Priority);
script_Edits[EDIT_EXCEPTIONS].Text := IntArrToStr(Exceptions);
end;
end;

SKILL_MAGIC:
begin
if (not SpellSetup) then
SetupSpells;

with MSI_Players[pIndex].Scripts[sIndex] do
begin
// Check off all the spells
for i := 0 to High(Spells) do
begin
mode := MSI_GetSpellMode(Spells[i], index);

for j := 0 to (script_Lists[LIST_SPELLS].ITEMS.Count - 1) do
if (Lowercase(SpellModes[mode][index].Name) = Lowercase(script_Lists[LIST_SPELLS].ITEMS.Strings[j])) then
script_Lists[LIST_SPELLS].Checked[j] := True;
end;

// Check off all the staffs
for i := 0 to High(Staffs) do
for j := 0 to (script_Lists[LIST_STAFFS].ITEMS.Count - 1) do
if (Lowercase(MSI_Items[Staffs[i]].Name) = Lowercase(script_Lists[LIST_STAFFS].ITEMS.Strings[j])) then
script_Lists[LIST_STAFFS].Checked[j] := True;

// Fill the AlchSlots edit
script_Edits[EDIT_ALCH_SLOTS].Text := IntArrToStr(MSI_Players[pIndex].Scripts[sIndex].AlchSlots);
end;
end;
end;

// Time is common for every script
with MSI_Players[pIndex].Scripts[sIndex] do
script_Edits[EDIT_TIME].Text := IntToStr(Time);

//Writeln('Filled Script Setup Components');
end;

procedure script_FillCombo();
var
i, pIndex: Integer;
begin
comboBox_Script_6.CLEAR;

pIndex := GetPlayerIndex(ChoosePlay[IMG_TAB_NORM_5].Text);

with MSI_Players[pIndex] do
for i := 0 to High(Scripts) do
comboBox_Script_6.Items.Append(MSI_Scripts[Scripts[i].Name].Name);
end;

(**
* Currently sets:
*
*)
procedure script_SetInfo();
var
i, j, skill, sIndex, pIndex, lIndex: Integer;
objects: TIntegerArray;
begin
if (comboBox_Script_6.Text = '') then
Exit;

for i := 0 to High(MSI_Scripts) do
if (comboBox_Script_6.Text = MSI_Scripts[i].Name) then
begin
sIndex := comboBox_Script_6.ITEMS.IndexOf(comboBox_Script_6.Text);
//Writeln('Script Index: '+IntToStr(sIndex));
skill := MSI_Scripts[i].SkillConst;
Break;
end;

pIndex := GetPlayerIndex(ChoosePlay[IMG_TAB_NORM_5].Text);
//Writeln('Player Index: '+IntToStr(pIndex));

case skill of
SKILL_WOODCUTTING, SKILL_MINING, SKILL_FISHING:
begin
case skill of
SKILL_WOODCUTTING:
lIndex := LIST_TREES;

SKILL_MINING:
lIndex := LIST_ROCKS;

SKILL_FISHING:
lIndex := LIST_FISHSPOTS;
end;

// Set the Trees, Rocks, and FishSpots depending on the skill
for i := 0 to script_Lists[lIndex].ITEMS.Count - 1 do
if (script_Lists[lIndex].Checked[i]) then
for j := 0 to High(MSI_Objects) do
if (Lowercase(MSI_Objects[j].Name) = Lowercase(script_Lists[lIndex].Items.Strings[i])) then
begin
case skill of
SKILL_WOODCUTTING:
with MSI_Players[pIndex].Scripts[sIndex] do
begin
SetLength(Trees, Length(Trees) + 1);
Trees[High(Trees)] := j;
ClearSameIntegers(Trees);
//Writeln('Player '+IntToStr(pIndex)+' Trees: '+ToStr(Trees));
end;

SKILL_MINING:
with MSI_Players[pIndex].Scripts[sIndex] do
begin
SetLength(Rocks, Length(Rocks) + 1);
Rocks[High(Rocks)] := j;
ClearSameIntegers(Rocks);
//Writeln('Player '+IntToStr(pIndex)+' Rocks: '+ToStr(Rocks));
end;

SKILL_FISHING:
with MSI_Players[pIndex].Scripts[sIndex] do
begin
SetLength(FishSpots, Length(FishSpots) + 1);
FishSpots[High(FishSpots)] := j;
ClearSameIntegers(FishSpots);
//Writeln('Player '+IntToStr(pIndex)+' FishSpots: '+ToStr(FishSpots));
end;
end;
end;

// Set the items to exclude from dropping/banking
for i := 0 to (script_Lists[LIST_DROP].ITEMS.Count - 1) do
if (script_Lists[LIST_DROP].Checked[i]) then
for j := 0 to High(MSI_Items) do
if (Lowercase(script_Lists[LIST_DROP].Items.Strings[i]) = Lowercase(MSI_Items[j].Name)) then
with MSI_Players[pIndex].Scripts[sIndex] do
begin
SetLength(DontDrop, Length(DontDrop) + 1);
DontDrop[High(DontDrop)] := j;
ClearSameIntegers(DontDrop);
end;

// Set the other script information
with MSI_Players[pIndex].Scripts[sIndex] do
begin
try
MaxLevel := StrToInt(script_Edits[EDIT_LEVEL].Text);
except
ShowMessage('Invalid max level! Please enter a number.');
end;

try
Loads := StrToInt(script_Edits[EDIT_LOADS].Text);
except
ShowMessage('Invalid loads! Please enter a number.');
end;

try
Time := StrToInt(script_Edits[EDIT_LOADS].Text);
except
ShowMessage('Invalid AnimTimer! Please enter a number.');
end;

try
Exceptions := StrToIntArr(script_Edits[EDIT_EXCEPTIONS].Text);
ClearSameIntegers(Exceptions);
except
ShowMessage('Invalid exceptions input!');
end;

try
Priority := StrToIntArr(script_Edits[EDIT_PRIORITY].Text);
ClearSameIntegers(Priority);
except
ShowMessage('Invalid priority input!');
end;
end;
end;

SKILL_MAGIC:
begin
if (not SpellSetup) then
SetupSpells;

// Set the Spells
for i := 0 to script_Lists[LIST_SPELLS].ITEMS.Count - 1 do
if (script_Lists[LIST_SPELLS].Checked[i]) then
with MSI_Players[pIndex].Scripts[sIndex] do
begin
SetLength(Spells, Length(Spells) + 1);
Spells[High(Spells)] := MSI_StrToSpell(script_Lists[LIST_SPELLS].ITEMS.Strings[i]);
ClearSameIntegers(Spells);
//Writeln('Player '+IntToStr(pIndex)+' Spells: '+ToStr(Spells));
end;

// Set the staffs
for i := 0 to script_Lists[LIST_STAFFS].ITEMS.Count - 1 do
if (script_Lists[LIST_STAFFS].Checked[i]) then
for j := 0 to High(MSI_Items) do
if (Lowercase(MSI_Items[j].Name) = Lowercase(script_Lists[LIST_STAFFS].ITEMS.Strings[i])) then
with MSI_Players[pIndex].Scripts[sIndex] do
begin
SetLength(Staffs, Length(Staffs) + 1);
Staffs[High(Staffs)] := j;
ClearSameIntegers(Staffs);
//Writeln('Player '+IntToStr(pIndex)+' Staffs: '+ToStr(Staffs));
end;

// Set the Alching Slots
MSI_Players[pIndex].Scripts[sIndex].AlchSlots := StrToIntArr(script_Edits[EDIT_ALCH_SLOTS].Text);
end;
end;

with MSI_Players[pIndex].Scripts[sIndex] do
try
Time := StrToInt(script_Edits[EDIT_TIME].Text);
except
ShowMessage('Invalid AnimTimer! Please enter a number.');
end;
end;

(*
END OF SCRIPT SETUP COMPONENTS
==============================
*)

procedure CheckOffScripts(PlayerIndex: Integer);
var
j, k: Integer;
begin
for j := 0 to High(MSI_Players[PlayerIndex].Scripts) do
for k := 0 to (CheckListBox_3.Items.Count - 1) do
if (Lowercase(MSI_Scripts[MSI_Players[PlayerIndex].Scripts[j].Name].Name) = Lowercase(CheckListBox_3.Items.Strings[k])) then
CheckListBox_3.Checked[k] := True;
end;

procedure CheckOffLocs(PlayerIndex: Integer);
var
j, k: Integer;
begin
with MSI_Players[PlayerIndex] do
for k := 0 to (CheckListBox_4.Items.Count - 1) do
if (Lowercase(MSI_Locations[Location].Name) = Lowercase(CheckListBox_4.Items.Strings[k])) then
begin
CheckListBox_4.Checked[k] := True;
Break;
end;
end;

procedure LoadOther(pIndex: Integer);
begin
time_Total_5.Text := IntToStr(MSI_Players[pIndex].TotalTime);
time_Break_5.Text := IntToStr(MSI_Players[pIndex].BreakTime);
loads_Break_5.Text := IntToStr(MSI_Players[pIndex].BreakLoads);
loads_Total_5.Text := IntToStr(MSI_Players[pIndex].TotalLoads);

time_Total_5.Enabled := True;
time_Break_5.Enabled := True;
loads_Break_5.Enabled := True;
loads_Total_5.Enabled := True;
end;

procedure LoadPlayersToPanels(s: string);
var
i, j, k, pIndex: Integer;
begin
s := Capitalize(s);

for i := IMG_TAB_NORM_2 to IMG_TAB_NORM_5 do
ChoosePlay[i].Items.Append(s);
end;

function SetScriptConsts(): TIntegerArray;
var
i, j: Integer;
begin
for i := 0 to (CheckListBox_3.Items.Count - 1) do
if (CheckListBox_3.Checked[i]) then
for j := 0 to High(MSI_Scripts) do
begin
if (MSI_Scripts[j].Name = '') then
Continue;

if (Lowercase(CheckListBox_3.Items.Strings[i]) = Lowercase(MSI_Scripts[j].Name)) then
begin
SetLength(Result, Length(Result) + 1);
Result[High(Result)] := MSI_Scripts[j].Constant;
end;
end;

for i := 0 to High(MSI_Players) do
if (Lowercase(ChoosePlay[IMG_TAB_NORM_2].Text) = Lowercase(MSI_Players[i].Name)) then
begin
SetLength(MSI_Players[i].Scripts, Length(Result));

for j := 0 to High(MSI_Players[i].Scripts) do
begin
MSI_Players[i].Scripts[j].Name := Result[j];
//Writeln(IntToStr(MSI_Players[i].Scripts[j].Name));
end;

Break;
end;

//Writeln('Scripts: ' + ToStr(Result));
end;

function SetLocConsts(): Integer;
var
i, j: Integer;
begin
for i := 0 to (CheckListBox_4.Items.Count - 1) do
if (CheckListBox_4.Checked[i]) then
for j := 0 to High(MSI_Locations) do
begin
if (MSI_Locations[j].Name = '') then
Continue;

if (Lowercase(ChoosePlay[IMG_TAB_NORM_3].Items.Strings[i]) = Lowercase(MSI_Locations[j].Name)) then
begin
Result := MSI_Locations[j].Constant;
Break;
end;
end;

for i := 0 to High(MSI_Players) do
if (Lowercase(ChoosePlay[IMG_TAB_NORM_3].Text) = Lowercase(MSI_Players[i].Name)) then
begin
MSI_Players[i].Location := Result;
//Writeln('Location: ' + ToStr(MSI_Players[i].Location));
Break;
end;

end;

procedure SetOther();
var
i: Integer;
begin
for i := 0 to High(MSI_Players) do
if (Lowercase(ChoosePlay[IMG_TAB_NORM_4].Text) = Lowercase(MSI_Players[i].Name)) then
with MSI_Players[i] do
begin
try
TotalTime := StrToInt(time_Total_5.Text);
except
ShowMessage('Total AnimTimer must be a number!');
Exit;
end;

try
BreakTime := StrToInt(time_Break_5.Text);
except
ShowMessage('Break after (AnimTimer) must be a number!');
Exit;
end;

try
BreakLoads := StrToInt(loads_Break_5.Text);
except
ShowMessage('Break after (loads) must be a number!');
Exit;
end;

try
TotalLoads := StrToInt(loads_Total_5.Text);
except
ShowMessage('Total loads must be a number!');
Exit;
end;

Break;
end;

//Writeln('Others set!');
end;

procedure SavePlayers();
var
i, j, k: Integer;
s: string;
begin
intro_Settings(True);

WriteINI('Number of Players', 'NumberOfPlayers', IntToStr(Length(MSI_Players)), PATH_PLAYER);

for i := 0 to High(MSI_Players) do
with MSI_Players[i] do
begin
s := '';
Active := checkList_Players.Checked[i];
SetLocConsts;
script_SetInfo;

WriteINI(IntToStr(i), 'Name', Name, PATH_PLAYER);
WriteINI(IntToStr(i), 'Pass', Pass, PATH_PLAYER);
WriteINI(IntToStr(i), 'Nick', Nick, PATH_PLAYER);
WriteINI(IntToStr(i), 'Pin', Pin, PATH_PLAYER);
WriteINI(IntToStr(i), 'Active', BoolToStr(Active), PATH_PLAYER);
WriteINI(IntToStr(i), 'Member', BoolToStr(Member), PATH_PLAYER);
WriteINI(IntToStr(i), 'Location', IntToStr(Location), PATH_PLAYER);
WriteINI(IntToStr(i), 'BreakTime', IntToStr(BreakTime), PATH_PLAYER);
WriteINI(IntToStr(i), 'BreakLoads', IntToStr(BreakLoads), PATH_PLAYER);
WriteINI(IntToStr(i), 'TotalTime', IntToStr(TotalTime), PATH_PLAYER);
WriteINI(IntToStr(i), 'TotalLoads', IntToStr(TotalLoads), PATH_PLAYER);

WriteINI(IntToStr(i), 'NumberOfScripts', IntToStr(Length(Scripts)), PATH_PLAYER);
for j := 0 to High(Scripts) do
begin
// Set for all skills
WriteINI(IntToStr(i), 'Script'+IntToStr(j)+'.Name', IntToStr(Scripts[j].Name), PATH_PLAYER);
WriteINI(IntToStr(i), 'Script'+IntToStr(j)+'.Time', IntToStr(Scripts[j].Time), PATH_PLAYER);

case MSI_Scripts[Scripts[j].Name].SkillConst of
SKILL_WOODCUTTING, SKILL_FISHING, SKILL_MINING:
begin
// DontDrop
if (Length(Scripts[j].DontDrop) > 0) then
WriteINI(IntToStr(i), 'Script'+IntToStr(j)+'.DontDrop', IntArrToStr(Scripts[j].DontDrop), PATH_PLAYER);

// Exceoptions
if (Length(Scripts[j].Exceptions) > 0) then
WriteINI(IntToStr(i), 'Script'+IntToStr(j)+'.Exceptions', IntArrToStr(Scripts[j].Exceptions), PATH_PLAYER);

// Priority
if (Length(Scripts[j].Priority) > 0) then
WriteINI(IntToStr(i), 'Script'+IntToStr(j)+'.Priority', IntArrToStr(Scripts[j].Priority), PATH_PLAYER);

// Level and Loads
WriteINI(IntToStr(i), 'Script'+IntToStr(j)+'.MaxLevel', IntToStr(Scripts[j].MaxLevel), PATH_PLAYER);
WriteINI(IntToStr(i), 'Script'+IntToStr(j)+'.Loads', IntToStr(Scripts[j].Loads), PATH_PLAYER);

// Trees, Rocks, and FishSpots
case MSI_Scripts[Scripts[j].Name].SkillConst of
SKILL_WOODCUTTING:
WriteINI(IntToStr(i), 'Script'+IntToStr(j)+'.Trees', IntArrToStr(Scripts[j].Trees), PATH_PLAYER);

SKILL_MINING:
WriteINI(IntToStr(i), 'Script'+IntToStr(j)+'.Rocks', IntArrToStr(Scripts[j].Rocks), PATH_PLAYER);

SKILL_FISHING:
WriteINI(IntToStr(i), 'Script'+IntToStr(j)+'.FishSpots', IntArrToStr(Scripts[j].FishSpots), PATH_PLAYER);
end;
end;

SKILL_MAGIC:
begin
// Staffs
if (Length(Scripts[j].Staffs) > 0) then
WriteINI(IntToStr(i), 'Script'+IntToStr(j)+'.Staffs', IntArrToStr(Scripts[j].Staffs), PATH_PLAYER);

// Spells
if (Length(Scripts[j].Spells) > 0) then
WriteINI(IntToStr(i), 'Script'+IntToStr(j)+'.Spells', IntArrToStr(Scripts[j].Spells), PATH_PLAYER);

// AlchSlots
if (Length(Scripts[j].AlchSlots) > 0) then
WriteINI(IntToStr(i), 'Script'+IntToStr(j)+'.AlchSlots', IntArrToStr(Scripts[j].AlchSlots), PATH_PLAYER);
end;
end;
end;
end;

ShowMessage('Saved Players!');
end;

procedure LoadPlayers();
var
i, j: Integer;
nPlayers, s, p: string;
begin
if (not FileExists(PATH_PLAYER)) then
begin
ShowMessage('Players need to be saved before they can be loaded!');
Exit;
end;

nPlayers := ReadINI('Number of Players', 'NumberOfPlayers', PATH_PLAYER);
SetLength(MSI_Players, StrToInt(nPlayers));

for i := 0 to High(MSI_Players) do
with MSI_Players[i] do
begin
Name := ReadINI(IntToStr(i), 'Name', PATH_PLAYER);
Pass := ReadINI(IntToStr(i), 'Pass', PATH_PLAYER);
Nick := ReadINI(IntToStr(i), 'Nick', PATH_PLAYER);
Pin := ReadINI(IntToStr(i), 'Pin', PATH_PLAYER);
Active := StrToBool(ReadINI(IntToStr(i), 'Active', PATH_PLAYER));
Member := StrToBool(ReadINI(IntToStr(i), 'Member', PATH_PLAYER));
Location := StrToInt(ReadINI(IntToStr(i), 'Location', PATH_PLAYER));
BreakTime := StrToInt(ReadINI(IntToStr(i), 'BreakTime', PATH_PLAYER));
BreakLoads := StrToInt(ReadINI(IntToStr(i), 'BreakLoads', PATH_PLAYER));
TotalTime := StrToInt(ReadINI(IntToStr(i), 'TotalTime', PATH_PLAYER));
TotalLoads := StrToInt(ReadINI(IntToStr(i), 'TotalLoads', PATH_PLAYER));

if (Member) then
begin
comboBox_Member.Text := 'True';
s := '[P2P] '
end else begin
comboBox_Member.Text := 'False';
s := '[F2P] ';
end;

if (Pin <> '') then
p := 'Pin';

checkList_Players.Items.Append(s + Capitalize(Name) + ' (' + Pass + ')' + p + Pin);
checkList_Players.Checked[i] := Active;

LoadPlayersToPanels(Name);

SetLength(Scripts, StrToInt(ReadINI(IntToStr(i), 'NumberOfScripts', PATH_PLAYER)));
for j := 0 to High(Scripts) do
begin
Scripts[j].Name := StrToInt(ReadINI(IntToStr(i), 'Script'+IntToStr(j)+'.Name', PATH_PLAYER));
Scripts[j].Time := StrToInt(ReadINI(IntToStr(i), 'Script'+IntToStr(j)+'.Time', PATH_PLAYER));

try
Scripts[j].Trees := StrToIntArr(ReadINI(IntToStr(i), 'Script'+IntToStr(j)+'.Trees', PATH_PLAYER));
Scripts[j].Rocks := StrToIntArr(ReadINI(IntToStr(i), 'Script'+IntToStr(j)+'.Rocks', PATH_PLAYER));
Scripts[j].FishSpots := StrToIntArr(ReadINI(IntToStr(i), 'Script'+IntToStr(j)+'.FishSpots', PATH_PLAYER));
Scripts[j].Spells := StrToIntArr(ReadINI(IntToStr(i), 'Script'+IntToStr(j)+'.Spells', PATH_PLAYER));
Scripts[j].DontDrop := StrToIntArr(ReadINI(IntToStr(i), 'Script'+IntToStr(j)+'.DontDrop', PATH_PLAYER));
Scripts[j].Exceptions := StrToIntArr(ReadINI(IntToStr(i), 'Script'+IntToStr(j)+'.Exceptions', PATH_PLAYER));
Scripts[j].Priority := StrToIntArr(ReadINI(IntToStr(i), 'Script'+IntToStr(j)+'.Priority', PATH_PLAYER));
Scripts[j].AlchSlots := StrToIntArr(ReadINI(IntToStr(i), 'Script'+IntToStr(j)+'.AlchSlots', PATH_PLAYER));
Scripts[j].Loads := StrToInt(ReadINI(IntToStr(i), 'Script'+IntToStr(j)+'.Loads', PATH_PLAYER));
Scripts[j].MaxLevel := StrToInt(ReadINI(IntToStr(i), 'Script'+IntToStr(j)+'.MaxLevel', PATH_PLAYER));
except
//Writeln('INI Doesn''t Exist!');
end;
end;
end;

tImages[IMG_LOAD_TAB_NORM].Enabled := False;
btn_DeletePlayer.Enabled := (Length(MSI_Players) > 1);
ShowMessage('Loaded Players!');
end;

procedure OnMouseMove(Sender: TObject; Shift: TShiftState; x, y: Integer);
var
x1, y1, hi, i, j, bmp, xdif, ydif, h: Integer;
BoundL, BoundT: Extended;
imgSwap, bmpArr, imgArr: Array of Integer;
begin
bmpArr := [ X_NORM, Q_NORM, LOAD_TAB_NORM,
SAVE_TAB_NORM, TAB_NORM_1, TAB_NORM_2,
TAB_NORM_3, TAB_NORM_4, TAB_NORM_5, TAB_NORM_0, RUN_NORM ];

imgArr := [ IMG_X_NORM, IMG_Q_NORM, IMG_LOAD_TAB_NORM,
IMG_SAVE_TAB_NORM, IMG_TAB_NORM_1, IMG_TAB_NORM_2,
IMG_TAB_NORM_3, IMG_TAB_NORM_4, IMG_TAB_NORM_5, IMG_TAB_NORM_0, IMG_RUN_NORM ];

hi := High(bmpArr);
case Sender of
tImages[IMG_BGND], Panels[IMG_TAB_NORM_1],
Panels[IMG_TAB_NORM_2], Panels[IMG_TAB_NORM_3], Panels[IMG_TAB_NORM_4],
Panels[IMG_TAB_NORM_5], Panels[IMG_TAB_NORM_0]:
begin
for i := 0 to hi do
begin
if (not isActiveImage[imgArr[i]]) then
Continue;

bmp := frmBitmaps[bmpArr[i]];
DrawBitmap(bmp, tImages[imgArr[i]].Canvas, 0, 0);
isActiveImage[imgArr[i]] := False;
end;
end;
end;

for h := 0 to hi do
case Sender of
tImages[imgArr[h]]:
begin
imgSwap := [imgArr[h], frmBitmaps[bmpArr[h] + 1]];
if (not isActiveImage[imgSwap[0]]) then
begin
DrawBitmap(imgSwap[1],tImages[imgSwap[0]].Canvas,0,0);
isActiveImage[imgSwap[0]] := True;
for i := 0 to hi do
begin
if (Sender = tImages[imgArr[i]]) then
Continue;

if (not isActiveImage[imgArr[i]]) then
Continue;

if (i = imgSwap[0] - 1) then
Continue;

bmp := frmBitmaps[bmpArr[i]];
DrawBitmap(bmp, tImages[imgArr[i]].Canvas, 0, 0);
isActiveImage[imgArr[i]] := False;
end;
end;
end;
end;
end;

const
MAX_MOVE = 315;

var
accel, pMoved, senderTab, pan: integer;
onLeft: Boolean;

procedure OnTimerEnabled(Sender: TObject);
var
i, e, d, hi, lo: Integer;
begin
accel := accel + 2;
pMoved := pMoved + accel;

if (senderTab = IMG_TAB_NORM_0) then
begin
panels[IMG_TAB_NORM_0].Width := panels[IMG_TAB_NORM_0].Width + accel;

for i := IMG_TAB_NORM_1 to IMG_TAB_NORM_5 do
begin
if (not isLeftTab[i]) then
Continue;

tImages[i].Left := tImages[i].Left + accel;

if (pMoved >= MAX_MOVE) then
begin
isLeftTab[i] := False;
AnimTimer.Enabled := False;
tImages[i].Left := tImages[i].Left - 5;
end;
end;
end else
begin
if (onLeft) then
for i := senderTab to IMG_TAB_NORM_5 do
begin
if (i = senderTab) or (not isLeftTab[i]) then
Continue;

tImages[i].Left := tImages[i].Left + accel;

if (pMoved >= MAX_MOVE) then
begin
isLeftTab[i] := False;
AnimTimer.Enabled := False;
tImages[i].Left := tImages[i].Left - 5;
end;

//Writeln(BoolToStr(isLeftTab[i]));
end
else begin
panels[IMG_TAB_NORM_0].Width := panels[IMG_TAB_NORM_0].Width - accel;

for i := senderTab downto IMG_TAB_NORM_1 do
begin
if (isLeftTab[i]) then
Continue;

tImages[i].Left := tImages[i].Left - accel;

if (pMoved >= MAX_MOVE) then
begin
isLeftTab[i] := True;
AnimTimer.Enabled := False;
tImages[i].Left := tImages[i].Left + 5;
end;

end;
end;
end;

for i := IMG_TAB_NORM_1 to IMG_TAB_NORM_5 do
begin
panels[i].left := tImages[i].left + tImages[i].width + 2
if i <> IMG_TAB_NORM_5 then
panels[i].width := tImages[i + 1].left - panels[i].left - 2
else
panels[i].width := MainForm.width - panels[i].left - 10;
end;

if (senderTab = IMG_TAB_NORM_0) then
if (pMoved >= MAX_MOVE) then
panels[IMG_TAB_NORM_0].Width := panels[IMG_TAB_NORM_0].Width - 10;
end;

procedure OnTabClick(Sender: TObject);
var
i: integer;
begin
if not AnimTimer.ENABLED then
begin
accel := 0;
pMoved := 0;
AnimTimer.enabled := true;
pan := senderTab;

if (Sender = tImages[IMG_TAB_NORM_0]) then
senderTab := IMG_TAB_NORM_0;

for i := IMG_TAB_NORM_1 to IMG_TAB_NORM_5 do
if (Sender = tImages[i]) then
begin
senderTab := i;
if (isLeftTab[senderTab]) then
onLeft := True
else
onLeft := False;
end;
end;
end;

procedure OnClickEvents(Sender: TObject); // OnClick
var
i, j, t: integer;
bmpArr, tScripts: TIntegerArray;
begin
for i := IMG_TAB_NORM_1 to IMG_TAB_NORM_5 do
if (isLeftTab[i]) then
Inc(t);

for i := IMG_TAB_NORM_1 to IMG_TAB_NORM_5 do
case Sender of
tImages[i]:
begin
if (isLeftTab[i]) then
if (t <= (i - (IMG_TAB_NORM_5 - IMG_TAB_NORM_1))) then
Exit;

OnTabClick(Sender);

if (not isLeftTab[i]) then
begin
bmpArr := [TAB_NORM_1, TAB_NORM_2, TAB_NORM_3, TAB_NORM_4, TAB_NORM_5];
DrawBitmap(frmBitmaps[bmpArr[i-IMG_TAB_NORM_1]], tImages[i].Canvas, 0, 0);
end;
end;
end;

case Sender of
tImages[IMG_X_NORM]:
begin
for i := 0 to BITMAP_COUNT - 1 do
FreeBitmap(frmBitmaps[i]);

MainForm.ModalResult := mrOk;
end;

tImages[IMG_Q_NORM]: OpenWebPage('http://villavu.com/forum/showthread.php?t=57723');

tImages[IMG_TAB_NORM_0]:
begin
if (t <= 0) then
Exit;

OnTabClick(Sender);
end;

tImages[IMG_SAVE_TAB_NORM]:
begin
DrawBitmap(frmBitmaps[SAVE_TAB_NORM],tImages[IMG_SAVE_TAB_NORM].Canvas, 0, 0);
SetScriptConsts;
SetLocConsts;
SetOther;
SavePlayers;
end;

tImages[IMG_LOAD_TAB_NORM]:
begin
DrawBitmap(frmBitmaps[LOAD_TAB_NORM],tImages[IMG_LOAD_TAB_NORM].Canvas, 0, 0);
LoadPlayers;
end;

tImages[IMG_RUN_NORM]:
begin
ScriptReady := True;

intro_Settings(True);
script_SetInfo();
SetScriptConsts();
SetLocConsts();
SetOther();
SavePlayers();

MainForm.ModalResult := mrOk;
end;
comboBox_Script_6:
script_SetInfo;
end;
end;

{******************************************************************************}
{ Name: function GenerateNick(Username: string): string; }
{ By: Coh3n }
{ Description: Generates the players nickname based on their username }
{******************************************************************************}
function GenerateNick(Username: string): string;
var
i, j: Integer;
s: TStringArray;
begin
s := Explode(' ', Username);
for i := 0 to High(s) do
if (Length(s[i]) >= 4) then
begin
for j := 2 to 4 do
Result := Result + s[i][j];

Break;
end;

//Writeln('Username: ' + Username);
//Writeln('Nickname: ' + Result);
end;

{******************************************************************************}
{ Name: procedure AddPlayer(); }
{ By: Coh3n }
{ Description: Adds a player to the player array. Called when the Add Player }
{ button is pressed }
{******************************************************************************}
procedure AddPlayer();
var
h: Integer;
begin
SetLength(MSI_Players, Length(MSI_Players) + 1);
btn_DeletePlayer.Enabled := (Length(MSI_Players) > 1);

h := High(MSI_Players);
with MSI_Players[h] do
begin
Name := edit_User.Text;
Pass := edit_Pass.Text;
Nick := GenerateNick(Name);
Pin := edit_Pin.Text;
Active := checkList_Players.Checked[checkList_Players.ItemIndex];
Member := StrToBool(comboBox_Member.Text);

//Writeln(Name);
//Writeln(Pass);
//Writeln(Nick);
//Writeln(Pin);
//Writeln(BoolToStr(Active));
//Writeln(BoolToStr(Member));
end;

//Writeln('Player Length: ' + IntToStr(Length(MSI_Players)));
end;

{******************************************************************************}
{ Name: procedure RemovePlayer(); }
{ By: Masterkill & Coh3n }
{ Description: Removes a player from the player array. Called when the Remove }
{ Player button is pressed }
{******************************************************************************}
procedure RemovePlayer();
var
i: Integer;
begin
//Writeln(IntToStr(checkList_Players.ItemIndex));
if (not (checkList_Players.ItemIndex = High(MSI_Players))) then
if (checkList_Players.ItemIndex + 1 = High(MSI_Players)) then
MSI_Players[checkList_Players.ItemIndex] := MSI_Players[High(MSI_Players)]
else
for i := checkList_Players.ItemIndex to High(MSI_Players) - 1 do
MSI_Players[i] := MSI_Players[i + 1];

btn_DeletePlayer.Enabled := (Length(MSI_Players) > 1);

SetLength(MSI_Players, Length(MSI_Players) - 1);
//Writeln('Player Length: ' + IntToStr(Length(MSI_Players)));
end;

procedure PanelOneClicks(Sender: TObject); // OnChange
var
sel, i: integer;
s, p: string;
begin
case sender of
btn_AddPlayer:
begin
if (StrToBool(comboBox_Member.Text)) then
s := '[P2P] '
else
s := '[F2P] ';

if (edit_Pin.Text <> '') then
p := 'Pin';

checkList_Players.Items.Append(s + Capitalize(edit_User.Text) + ' (' + edit_Pass.Text + ')' + p + edit_Pin.Text);

// Add player to the combo box on other panels
LoadPlayersToPanels(edit_User.Text);

checkList_Players.Checked[checkList_Players.items.Count - 1] := true;
checkList_Players.ItemIndex := checkList_Players.Items.Count - 1;

AddPlayer();

edit_User.Text := '';
edit_Pass.Text := '';
edit_Pin.Text := '';
end;

btn_DeletePlayer:
begin
if checkList_Players.ItemIndex >= 0 then
sel := checkList_Players.ItemIndex;
checkList_Players.Items.Delete(sel);
for i := IMG_TAB_NORM_2 to IMG_TAB_NORM_5 do
ChoosePlay[i].Items.Delete(sel);
if sel = 0 then
sel := 1;
checkList_Players.ItemIndex := sel - 1;

RemovePlayer();

edit_User.Text := '';
edit_Pass.Text := '';
edit_Pin.Text := '';
end;
end;
end;

procedure PanelFiveClicks(Sender: TObject); // OnChange
var
pIndex, i: Integer;
begin
case sender of
ComboBox_Script_6:
begin
script_ShowComponents();

for i := 0 to script_Lists[LIST_DROP].ITEMS.Count - 1 do
if (script_Lists[LIST_DROP].Checked[i]) then
script_Lists[LIST_DROP].Checked[i] := False;

pIndex := GetPlayerIndex(ChoosePlay[IMG_TAB_NORM_5].Text);
script_FillComponents(pIndex);
end;

nScript:
if ComboBox_Script_6.ITEMINDEX < ComboBox_Script_6.ITEMS.Count then
ComboBox_Script_6.ItemIndex := ComboBox_Script_6.ItemIndex + 1;

pScript:
if ComboBox_Script_6.ITEMINDEX > 0 then
ComboBox_Script_6.ItemIndex := ComboBox_Script_6.ItemIndex - 1;
end;
end;



procedure PlayerControls(Sender: TObject);
var i, pIndex: integer;
begin
for i := IMG_TAB_NORM_2 to IMG_TAB_NORM_5 do
case sender of
ChoosePlay[i]: pBoxIndex := ChoosePlay[i].ItemIndex;
Previous[i]: if ChoosePlay[i].ItemIndex > 0 then
ChoosePlay[i].ItemIndex := ChoosePlay[i].ItemIndex - 1;
Next[i]: if ChoosePlay[i].ItemIndex < ChoosePlay[i].Items.Count then
ChoosePlay[i].ItemIndex := ChoosePlay[i].ItemIndex + 1;
end;
case sender of
ChoosePlay[IMG_TAB_NORM_2]: SetScriptConsts;
ChoosePlay[IMG_TAB_NORM_3]: SetLocConsts;
ChoosePlay[IMG_TAB_NORM_4]: SetOther();
ChoosePlay[IMG_TAB_NORM_5]: script_SetInfo();
Next[IMG_TAB_NORM_2]:
if ChoosePlay[IMG_TAB_NORM_2].ItemIndex < ChoosePlay[IMG_TAB_NORM_2].Items.Count then
begin
pBoxIndex := ChoosePlay[IMG_TAB_NORM_2].ItemIndex;
SetScriptConsts;
pIndex := GetPlayerIndex(ChoosePlay[IMG_TAB_NORM_2].Items.Strings[pBoxIndex]);
CheckOffScripts(pIndex);

for i := 0 to CheckListBox_3.Items.Count - 1 do
CheckListBox_3.Checked[i] := False;
end;
end;
end;

procedure PlayerCUpdate(Sender: TObject);
var i, pIndex: integer;
begin
case sender of
ChoosePlay[IMG_TAB_NORM_2]:
begin
for i := 0 to CheckListBox_3.ITEMS.Count - 1 do
CheckListBox_3.Checked[i] := False;

pIndex := GetPlayerIndex(ChoosePlay[IMG_TAB_NORM_2].Text);
CheckOffScripts(pIndex);
CheckListBox_3.Enabled := True;
end;
ChoosePlay[IMG_TAB_NORM_3]:
begin
for i := 0 to CheckListBox_4.ITEMS.Count - 1 do
CheckListBox_4.Checked[i] := False;

pIndex := GetPlayerIndex(ChoosePlay[IMG_TAB_NORM_3].Text);

CheckOffLocs(pIndex);
CheckListBox_4.Enabled := True;
end;
ChoosePlay[IMG_TAB_NORM_4]:
begin
pIndex := GetPlayerIndex(ChoosePlay[IMG_TAB_NORM_4].Text);
LoadOther(pIndex);
end;
ChoosePlay[IMG_TAB_NORM_5]:
begin
SetScriptConsts();
script_FillCombo();
script_HideComponents();
end;
end;
end;



// Used to display a background image on the panels
var
bgndPanel: TImage;
a, b: Integer;

procedure InitForm;
var
i, pan: Integer;
consts: TintegerArray;
bmpArr: TStringArray;
xy: TPointArray;
visibl: array of boolean;
wh: TPoint;
begin
bmpArr := ['BGND','X_NORM','X_HOVER','Q_NORM','Q_HOVER','LOAD_TAB_NORM','LOAD_TAB_HOVER','SAVE_TAB_NORM','SAVE_TAB_HOVER','TAB_NORM_1','TAB_HOVER_1','TAB_NORM_2','TAB_HOVER_2','TAB_NORM_3','TAB_HOVER_3','TAB_NORM_4','TAB_HOVER_4','TAB_NORM_5','TAB_HOVER_5','TAB_NORM_0','TAB_HOVER_0', 'BGND_PANEL', 'RUN_NORM', 'RUN_HOVER'];
for i := 0 to High(frmBitmaps) do
frmBitmaps[i] := LoadBitmap(ScriptPath + 'Bitmaps\' + bmpArr[i] + '.png');

MainForm := TForm.Create(nil);
MainForm.SetBounds({L} 100, {T} 100, {W} 600, {H} 400);
MainForm.Position := poScreenCenter;
MainForm.BorderStyle := bsNone;

AnimTimer := TTimer.Create(MainForm);
with AnimTimer do
begin
ONTIMER := @OnTimerEnabled;
INTERVAL := 10;
ENABLED := false;
end;

xy := [Point(0, 0), Point(575, 7), Point(557, 7), Point(7, 69), Point(81, 69), Point(386, 100), Point(427, 100), Point(468, 100), Point(509, 100), Point(550, 100), Point(8, 222), Point(519, 69) ];
SetArrayLength(visibl, GetArrayLength(xy));
consts := [BGND, X_NORM, Q_NORM, LOAD_TAB_NORM, SAVE_TAB_NORM, TAB_NORM_1, TAB_NORM_2, TAB_NORM_3, TAB_NORM_4, TAB_NORM_5, TAB_NORM_0, RUN_NORM ];

for i := 0 to IMG_COUNT - 1 do
begin
tImages[i] := TImage.Create(MainForm)
with tImages[i] do
begin
Parent := MainForm;
GetBitmapSize(frmBitmaps[consts[i]], wh.x, wh.y);
SetBounds(xy[i].x, xy[i].y, wh.x, wh.y);
OnMouseMove := @OnMouseMove;
OnClick := @OnClickEvents;
isActiveImage[i] := False;
end;
DrawBitmap(frmBitmaps[consts[i]], tImages[i].canvas, 0, 0);
end;

for i := low(panels) to high(panels) do
begin
panels[i] := TPanel.Create(MainForm);
panels[i].parent := MainForm;
GetBitmapSize(frmBitmaps[consts[i]], wh.x, wh.y);
panels[i].SetBounds(xy[i].x + wh.x, xy[i].y, 0, wh.y);
panels[i].BevelWidth := 0;

if (i = High(panels)) then
panels[i].SetBounds(10 + tImages[IMG_TAB_NORM_0].Width, 100,
tImages[IMG_TAB_NORM_1].Left - (tImages[IMG_TAB_NORM_0].Left + tImages[IMG_TAB_NORM_0].Width) - 4,
tImages[IMG_TAB_NORM_1].Height);

bgndPanel := TImage.Create(panels[i]);
bgndPanel.Parent := panels[i];
bgndPanel.Visible := True;
GetBitmapSize(frmBitmaps[BGND_PANEL], a, b);
bgndPanel.SetBounds(0, 0, a, b);
DrawBitmap(frmBitmaps[BGND_PANEL], bgndPanel.Canvas, 0, 0);
end;

pan := IMG_TAB_NORM_1;

checkList_Players := TCheckListBox.Create(panels[pan]);
checkList_Players.Parent := panels[pan];
checkList_Players.SetBounds(10, 55, 225, 220);

label_Username := TLabel.Create(panels[pan]);
label_Username.Parent := panels[pan];
label_Username.Setbounds(245,55,50,13);
label_Username.Caption := 'Username';
label_Username.Font.Color := 2070783;

edit_User := TEdit.Create(panels[pan]);
edit_User.Parent := panels[pan];
edit_User.SetBounds(label_Username.left,label_Username.top + label_Username.height + 5,83,21);

label_Pass := TLabel.Create(panels[pan]);
label_Pass.Parent := panels[pan];
label_Pass.Setbounds(label_Username.left, edit_User.top + edit_User.height + 10,32,13);
label_Pass.Caption := 'Password';
label_Pass.Font.Color := 2070783;

edit_Pass := TEdit.Create(panels[pan]);
edit_Pass.Parent := panels[pan];
edit_Pass.SetBounds(label_Username.left,label_Pass.top + label_Pass.height + 5,83,21);

label_Pin := TLabel.Create(panels[pan]);
label_Pin.Parent := panels[pan];
label_Pin.Setbounds(label_Username.left, edit_Pass.top + edit_Pass.height + 10,32,13);
label_Pin.Caption := 'Pin';
label_Pin.Font.Color := 2070783;

edit_Pin := TEdit.Create(panels[pan]);
edit_Pin.Parent := panels[pan];
edit_Pin.SetBounds(label_Username.left, label_Pin.top + label_Pin.height + 5, 83, 21);
edit_Pin.MaxLength := 4;

label_Member := TLabel.Create(panels[pan]);
label_Member.Parent := panels[pan];
label_Member.Setbounds(label_Username.left, edit_Pin.top + edit_Pin.height + 10,32,13);
label_Member.Caption := 'Members';
label_Member.Font.Color := 2070783;

comboBox_Member := TComboBox.Create(panels[pan]);
comboBox_Member.Parent := panels[pan];
comboBox_Member.SetBounds(label_Username.left, label_Member.top + label_Member.height + 5, 83, 21);
comboBox_Member.OnKeyPress := @PreventTyping;
comboBox_Member.Items.Add('True');
comboBox_Member.Items.Add('False');
comboBox_Member.Text := 'False';

btn_AddPlayer := TButton.Create(panels[pan]);
btn_AddPlayer.Parent := panels[pan];
btn_AddPlayer.Setbounds(22,22,95,25);
btn_AddPlayer.Caption := 'Add Player';
btn_AddPlayer.ONCLICK := @PanelOneClicks;

btn_DeletePlayer := TButton.Create(panels[pan]);
btn_DeletePlayer.Parent := panels[pan];
btn_DeletePlayer.SetBounds(btn_AddPlayer.left+btn_AddPlayer.width+10,btn_AddPlayer.top,btn_AddPlayer.width,btn_AddPlayer.height);
btn_DeletePlayer.Caption := 'Remove Player';
btn_DeletePlayer.OnClick := @PanelOneClicks;
btn_DeletePlayer.Enabled := (Length(MSI_Players) > 1);

panOne_Inst := TLabel.Create(panels[pan]);
panOne_Inst.Parent := panels[pan];
panOne_Inst.SetBounds(50,3,73,25);
panOne_Inst.Caption := 'Input player information and click Add Player';
panOne_Inst.Font.Color := 2070783;


for i := low(Previous) to high(Previous) do
begin
Previous[i] := TButton.Create(panels[i]);
Previous[i].Parent := panels[i];
Previous[i].SetBounds(35,24,73,25);
Previous[i].Caption := 'Previous';
Previous[i].OnClick := @PlayerControls;
//Previous[i].Visible := False;

ChoosePlay[i] := TComboBox.Create(panels[i]);
ChoosePlay[i].Parent := panels[i];
ChoosePlay[i].SetBounds(Previous[i].left + Previous[i].width + 5,Previous[i].top,115,21);
ChoosePlay[i].OnChange := @PlayerCUpdate;
ChoosePlay[i].OnKeyPress := @PreventTyping;
ChoosePlay[i].OnClick := @PlayerControls;

Next[i] := TButton.Create(panels[i]);
Next[i].Parent := panels[i];
Next[i].SetBounds(ChoosePlay[i].left + ChoosePlay[i].width + 5, ChoosePlay[i].top,75,25);
Next[i].Caption := 'Next';
Next[i].OnClick := @PlayerControls;
//Next[i].Visible := False;
end;


pan := IMG_TAB_NORM_2;

inst_P3 := TLabel.Create(panels[pan]);
inst_P3.Parent := panels[pan];
inst_P3.SetBounds(60,3,73,25);
inst_P3.Caption := 'Choose a script(s) for each player to use';
inst_P3.Font.Color := 2070783;

CheckListBox_3 := TCheckListBox.Create(panels[pan]);
CheckListBox_3.Parent := panels[pan];
CheckListBox_3.SetBounds(10, 55, 315, 220);
for i := 0 to High(MSI_Scripts) do
begin
if (MSI_Scripts[i].Name = '') then
Continue;

CheckListBox_3.Items.Add(Capitalize(MSI_Scripts[i].Name));
end;

CheckListBox_3.Enabled := False;




pan := IMG_TAB_NORM_3;

CheckListBox_4 := TCheckListBox.Create(panels[pan]);
CheckListBox_4.Parent := panels[pan];
CheckListBox_4.SetBounds(10, 55, 315, 220);
for i := 0 to High(MSI_Locations) do
begin
if (MSI_Locations[i].Name = '') or (MSI_Locations[i].Name = 'Lost') then
Continue;

CheckListBox_4.Items.Append(Capitalize(MSI_Locations[i].Name));
end;
CheckListBox_4.Enabled := False;

inst_P4 := TLabel.Create(panels[pan]);
inst_P4.Parent := panels[pan];
inst_P4.SetBounds(85, 3, 73, 25);
inst_P4.Caption := 'Set a location for each player';
inst_P4.Font.Color := 2070783;




pan := IMG_TAB_NORM_4;

inst_P5 := TLabel.Create(panels[pan]);
inst_P5.Parent := panels[pan];
inst_P5.SetBounds(38, 3, 73, 25);
inst_P5.Caption := 'Set all other required information for each player';
inst_P5.Font.Color := 2070783;

time_Total_5 := TEdit.Create(panels[pan]);
time_Total_5.Parent := panels[pan];
time_Total_5.SetBounds(180, 60, 83, 21);
time_Total_5.Text := '0';
time_Total_5.Enabled := False;

loads_Total_5 := TEdit.Create(panels[pan]);
with loads_Total_5 do
begin
Parent := panels[pan];
SetBounds(time_Total_5.Left, time_Total_5.Top + time_Total_5.Height + 10, 83, 21);
Text := '0';
Enabled := False;
end;

time_Break_5 := TEdit.Create(panels[pan]);
time_Break_5.Parent := panels[pan];
time_Break_5.SetBounds(time_Total_5.Left, loads_Total_5.Top + loads_Total_5.Height + 10, 83, 21);
time_Break_5.Text := '0';
time_Break_5.Enabled := False;

loads_Break_5 := TEdit.Create(panels[pan]);
loads_Break_5.Parent := panels[pan];
loads_Break_5.SetBounds(time_Total_5.Left, time_Break_5.Top + time_Break_5.Height + 10, 83, 21);
loads_Break_5.Text := '0';
loads_Break_5.Enabled := False;

timeTotal := TLabel.Create(panels[pan]);
timeTotal.Parent := panels[pan];
timeTotal.Setbounds(55, 63,32,13);
timeTotal.Caption := 'Total Time (minutes)';
timeTotal.Font.Color := 2070783;

loadsTotal := TLabel.Create(panels[pan]);
with loadsTotal do
begin
Parent := panels[pan];
Setbounds(timeTotal.Left, timeTotal.Top + time_total_5.height + 10,32,13);
Caption := 'Total Loads';
Font.Color := 2070783;
end;

timeBreak := TLabel.Create(panels[pan]);
timeBreak.Parent := panels[pan];
timeBreak.Setbounds(timeTotal.Left, loadsTotal.Top + loads_total_5.height + 10,32,13);
timeBreak.Caption := 'Break After (minutes)';
timeBreak.Font.Color := 2070783;

loadsBreak := TLabel.Create(panels[pan]);
loadsBreak.Parent := panels[pan];
loadsBreak.Setbounds(timeTotal.Left, timeBreak.Top + time_Break_5.Height+10,32,13);
loadsBreak.Caption := 'Break After (loads)';
loadsBreak.Font.Color := 2070783;



pan := IMG_TAB_NORM_5;

script_CreateComponents(pan);

nScript := TButton.Create(panels[pan]);
nScript.Parent := panels[pan];
nScript.SetBounds(Previous[pan].Left, Previous[pan].Top + Previous[pan].Height + 10, 73, 25);
nScript.Caption := 'Previous';
nScript.OnClick := @PanelFiveClicks;
nScript.Visible := False;

ComboBox_Script_6 := TComboBox.Create(panels[pan]);
ComboBox_Script_6.Parent := panels[pan];
ComboBox_Script_6.SetBounds(ChoosePlay[pan].left, ChoosePlay[pan].top + ChoosePlay[pan].height + 10, 115, 21);
ComboBox_Script_6.OnChange := @PanelFiveClicks;
ComboBox_Script_6.OnKeyPress := @PreventTyping;
ComboBox_Script_6.OnClick := @OnClickEvents;

pScript := TButton.Create(panels[pan]);
pScript.Parent := panels[pan];
pScript.SetBounds(Next[pan].left, Next[pan].top + Next[pan].height + 10,75,25);
pScript.Caption := 'Next';
pScript.OnClick := @PanelFiveClicks;
pScript.Visible := False;

inst_P6 := TLabel.Create(panels[pan]);
inst_P6.Parent := panels[pan];
inst_P6.SetBounds(75, 3, 73, 25);
inst_P6.Caption := 'Setup each script for each player';
inst_P6.Font.Color := 2070783;

intro_CreateComponents;
intro_Settings(False);
end;

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

procedure ShowFormModal;
begin
MainForm.ShowModal;
end;

procedure SafeShowFormModal;
var
v: TVariantArray;
begin
SetArrayLength(v, 0);
ThreadSafeCall('ShowFormModal', v);
end;
the next button would increment twice in the previous version, and this fixes the buttons on the last tab overlappping.

Coh3n

2010-12-31 11:58:03

Okay great, I'll try to add that stuff today.

Also, I managed to have the form open before waiting for SMART; however, half the time Simba crashes and half the time I get an Invalid Opcode error during runtime. Don't even both asking me why because I have absolutely not idea, but I'm going to try to rearrange some things and see if that does anything.

Dan Cardin

2010-12-31 12:00:05

I assume this is after, because i just moved the smart stuff and SetupSRL to after the tryfinally, that the form is in and it didnt error, though i dont follow through and try to run a script.

Coh3n

2010-12-31 14:29:50

From: Dan Cardin
I assume this is after, because i just moved the smart stuff and SetupSRL to after the tryfinally, that the form is in and it didnt error, though i dont follow through and try to run a script.

Yeah that's exactly what I did. It worked the first time, then when I closed the form and tried running it again, Simba crashed. Then I tried running a script and after it setup the player I got an invalid opcode.

I'm going to run the script before the change to see if that's actually the reason for the invalid opcode. E: It was what caused it.

E2: Got it working! :D SetupReflection needed to be called after SetupSRL. That was actually a lot easier than I thought. :)

E3: Committed that (only changes to RunMe.simba) and I'll work on your changes now, Dan.

E4: Okay so I've made all your changes, but only the combo boxes work properly. Here's why: ComboBoxes have an OnChange as well as an OnClick event, which lets us set the previous player's variables before we change to the next player. With buttons, there's only an OnClick so when I try to set the previous player's variables, it sets the next player's instead, which screws everything up. What we need is a way to set the previous player's variables before the actual OnClick procedures are called. I tried simply calling the setting procedures first in the OnClick procedure, but that didn't seem to work. This was the same problem I was running into when I tried to get the Next/Previous buttons working a while ago.

I have to go for the day, but if you want to try and see what's wrong, I've attached my version of the form.

monkeybeer

2011-01-01 22:40:25

Not sure if this has already been suggested or if this already exists and I haven't figured out how to use it, but it would be nice if you could save different sets of character setups. From what I understand, when you save a setup, it overwrites the previously saved setup. It would be nice to be able to save multiple character setups and be able to choose which one you want to load.

Dan Cardin

2011-01-01 23:34:17

@monkeybeer - That would be the Tsavedialogs that i want. and though i havent checked, im fairly sure they're in Simba.

@Coh3n - what exactly goes wrong when you just call the setting proc first? Because that should work fine.

EDIT: doesnt seem to save anything even if i change through the comboboxes.

Coh3n

2011-01-02 00:21:38

From: Dan Cardin
@monkeybeer - That would be the Tsavedialogs that i want. and though i havent checked, im fairly sure they're in Simba.

Great, then that should definitely be added. :) I'll add that to the suggestions list.

From: Dan Cardin

@Coh3n - what exactly goes wrong when you just call the setting proc first? Because that should work fine.

Say I had a character, Cohen1, that was the current player in the combo box, and the next player was Cohen2. When I hit next, it saves the current info (the info I want for Cohen1) in Cohen2 and nothing is saved for Cohen1.

From: Dan Cardin

EDIT: doesnt seem to save anything even if i change through the comboboxes.

Have you done it without hitting the Next/Previous buttons at all? It works for me. :unsure: But nevertheless, I have an idea that should make the buttons work properly. "Should" being the key word there. :p

Dan Cardin

2011-01-02 10:43:13

Well to me, putting the saving part before changing the currently selected combobox item should work. And yes, i was just selecting the people directly from the comboboxes and it wouldnt save them if i left that person and then went back. Do you save them when you switch tabs?

EDIT: and i tried compiling part of msi with just the declaration of "aeeee: TSaveDialog;" and while it didn't give me an error like it didnt know what that was, it did in fact crash Simba even though that's all i changed. I hope that doesn't mean what i think it means.

EDIT: I think it might be a good idea to add a "copy settings" button or something so you can put multiple players doing the same actions more easily. Or have "groups" where a group will do a specific script, and each group can have however many players in it.

Gu3st...

2011-01-02 16:29:21

From: monkeybeer
*deleted*
This is not the correct thread for this. please post a new thread here: http://villavu.com/forum/forumdisplay.php?f=313 :)

Coh3n

2011-01-04 01:38:40

From: Dan Cardin
Well to me, putting the saving part before changing the currently selected combobox item should work. And yes, i was just selecting the people directly from the comboboxes and it wouldnt save them if i left that person and then went back. Do you save them when you switch tabs?

Sorry I've been away the last few days, but I did manage to get a few things done. The Next/Previous buttons are working as they should be, I'm just working on the Next/Previous ones on the script tab. I'll commit what I have to the old form SVN if you want to test it out (you'll have to comment out the {$i Form.simba} in Setup.simba). The saving is working for me, so I'm hoping something just got messed up in a transfer somewhere; although, I'm not sure how that would happen.

From: Dan Cardin

EDIT: and i tried compiling part of msi with just the declaration of "aeeee: TSaveDialog;" and while it didn't give me an error like it didnt know what that was, it did in fact crash Simba even though that's all i changed. I hope that doesn't mean what i think it means.

I also hope the same. :( May have to file a bug report; could be something small.

From: Dan Cardin

EDIT: I think it might be a good idea to add a "copy settings" button or something so you can put multiple players doing the same actions more easily. Or have "groups" where a group will do a specific script, and each group can have however many players in it.

That's a good idea, I'll add that to the first post.

Hugolord

2011-01-04 04:22:33

For the "copy" idea. Perhaps have a check button called "Work forever" where it would have the total loads and total time on like 9999?

Also, would be awesome if we could choose to have it login players from the list randomly and not always start from the first to the last.

Dan Cardin

2011-01-04 06:57:04

you can commit to the msi svn if that's how you're doing it. Its all good now.

Work forever seems kind of pointless as you can just put in 99999 yourself.
Random Order seems alright. if it can be done easily, then we'd just need a checkbox in the player creation tab.

EDIT: coh3n, what would you like better? copy settings feature or groups? I actually like the groups more, and i think the tab would be big enough for it.

Sex

2011-01-04 07:45:45

Show only the valid locations for each script.
If MSI is gonna have world walking or whatever so that you can move from one place to another then you shouldn't do that…

Coh3n

2011-01-04 12:22:53

From: Hugolord
For the "copy" idea. Perhaps have a check button called "Work forever" where it would have the total loads and total time on like 9999?

Set them all to 0 and it will run forever.

From: Hugolord

Also, would be awesome if we could choose to have it login players from the list randomly and not always start from the first to the last.

Makes sense.

From: Dan Cardin
if it can be done easily, then we'd just need a checkbox in the player creation tab.

I think that would work.

From: Dan Cardin

EDIT: coh3n, what would you like better? copy settings feature or groups? I actually like the groups more, and i think the tab would be big enough for it.

What do you mean groups? Sorry if you explained it already; I don't remember. :o

From: Sex
If MSI is gonna have world walking or whatever so that you can move from one place to another then you shouldn't do that…

Makes sense I guess, but right now the world walker isn't used for that purpose, but I guess it could be.

Dan Cardin

2011-01-04 16:14:13

If you were walking to somewhere, it would make sense to me to check off the box in the first checkboxlist, so it would display it there. Im not sure i get why it would be bad to not show scripts you dont have marked as used.

Groups: So, you have a checkboxlist to the left and one on the right. You can add a group to the left hand one, and add players to each group. Instead of setting up your script for a bunch of individual players, you put them in groups and set them to do stuff. If all the groups are selected, then it would still come out programmatically as one list of players and their actions, it would just make it easier to make more than one player do the same thing, with the ability to do for multiple groups.

Coh3n

2011-01-04 17:32:43

From: Dan Cardin
Groups: So, you have a checkboxlist to the left and one on the right. You can add a group to the left hand one, and add players to each group. Instead of setting up your script for a bunch of individual players, you put them in groups and set them to do stuff. If all the groups are selected, then it would still come out programmatically as one list of players and their actions, it would just make it easier to make more than one player do the same thing, with the ability to do for multiple groups.

Oh I see, yes that would be neat. I'm not sure how you would do it, but I added it to the first post.

E: I could also just add a check box that will set the same settings for every player. That would at least work for armies that all do the same thing.

Ejjman

2011-01-05 23:51:20

This looks extremely good, and I'll put it to use very soon, guys. Great job on the project so far, the coding is fun to look at!

Here's a few suggestions maybe someone who has no idea about cheating will have questions about, or comments.


Break Time: 30 … Adding a hint would be nice, just to say what this is.

Level to Debug … Same thing as above, not sure what it is.

Antiban Wait, Randoms Wait … Same things as above.

Make the window so it isn't locked in place.

At number 4, is it Total Time and Total Loads, like, whichever you hit first is when you stop? And Break After, same deal?

At number 5, As stated above, narrow down to items only dealing with that script.

Also at number 5, what does Exceptions and Priority mean?


Anywhoo, its looking really good so far!

Coh3n

2011-01-05 23:59:51

From: Ejjman1
This looks extremely good, and I'll put it to use very soon, guys. Great job on the project so far, the coding is fun to look at!

Here's a few suggestions maybe someone who has no idea about cheating will have questions about, or comments.


Break Time: 30 … Adding a hint would be nice, just to say what this is.

Level to Debug … Same thing as above, not sure what it is.

Antiban Wait, Randoms Wait … Same things as above.

Make the window so it isn't locked in place.

At number 4, is it Total Time and Total Loads, like, whichever you hit first is when you stop? And Break After, same deal?

At number 5, As stated above, narrow down to items only dealing with that script.

Also at number 5, what does Exceptions and Priority mean?


Anywhoo, its looking really good so far!

I'm glad you like it. :)

I was just thinking about the windows lock thing. Naum came up with a solution to that, but for some reason it crashes Simba when I include SRL. Don't ask me why; it's weird, I know. :o So I was just thinking about adding the default windows border (after changing the background image a little to blend in better); although, I'm not sure how much people are going to like that.

And yes, when I make my next commit, there will be hints on all the components. :) I'm just working on a lot of updates at the moment.

TotalTime/TotalLoads, etc. will stop when the first one has been reached, yes. Set them to 0 if you want it to run forever (i.e. sets loads to 0 if you want it to run for only 60 minues (assuming you've set TotalTime to 60)).

Exceptions are the inventory slots you don't want to bank/drop. You may have an item that we don't have a record for. This was added to the player setup as something extra, as it's set throughout runtime. You don't have to fill it out.

Priority is a feature you can set some objects to have priority over others. For example, you're mining both coal and mithril. If you set Priority to "30,70", it will search first for coal 30% of the time, and mithril 70% of the time.

E: To expand on my the windows border idea:

I would probably get rid of the current border (to blend in a little better). That would also negate the need for the 'X', so that can be deleted. I would also make the '?' into a 'Help' tab and place it beside the 'Run' tab. Thoughts about this? I really don't think it would look that bad. I just added a border to see what it would be like, and I don't hate it. :p


Ejjman

2011-01-06 00:46:23

Ah, okay, thanks for clearing things up.

I can't get a clear picture without the border, but I think it would look better than it did on your last image post. It looks like you have a window within a window currently.

As for turning the help into a tab, that sounds like a great idea. The form leaves plenty of room for another tab without it being crammed.

Looking forward to see the revision :)

Coh3n

2011-01-06 00:52:28

From: Ejjman1
Ah, okay, thanks for clearing things up.

No problem. :)

From: Ejjman1

I can't get a clear picture without the border, but I think it would look better than it did on your last image post. It looks like you have a window within a window currently.

Yeah, exactly. I'll edit the image tomorrow probably to give you guys a better picture of what I mean.

E: It would look something like this (if you can picture it without the X and ?. I would probably change the position of some things also so they're closer to the border.


Dan Cardin

2011-01-06 14:36:51

Have you tried it recently? If you did indeed move the inclusion of SRL to after the the form, then it might not conflict any longer. I dont mind either way.

Basically what groups would look like. You add a group. Then when you add a player, its added to the selected group and any settings on further tabs will be applied to the whole group. The light lines around stuff are labeled panels (whatever their name is) if they are in fact included in Simba

mormonman

2011-01-06 14:38:15

I think you guys should add army support. Then I can run multiple scripts at the same time way easier :P

Coh3n

2011-01-06 15:11:44

From: Dan Cardin
Have you tried it recently? If you did indeed move the inclusion of SRL to after the the form, then it might not conflict any longer. I dont mind either way.

No, I haven't, I didn't think to. I will though.

From: Dan Cardin

Basically what groups would look like. You add a group. Then when you add a player, its added to the selected group and any settings on further tabs will be applied to the whole group. The light lines around stuff are labeled panels (whatever their name is) if they are in fact included in Simba

Great idea. I'll be making a commit later today with a TON of updates (you'll notice it more than users), so you're welcome to work on the group thing as soon as I'm done that (I just don't want any conflicts as I have changed a lot).

From: mormonman
I think you guys should add army support. Then I can run multiple scripts at the same time way easier :P

Expand please? Do you want to run multiple SMARTs?

Ejjman

2011-01-06 15:13:12

Cohen, that looks good.

@dan, that also looks good with groups. Would groups be required to be used, or could you still just have players by themselves?

A suggestion would be to make it so you can only select one location on the player's location page, so someone does not mistakenly choose two locations for a player.

Coh3n

2011-01-06 15:20:26

From: Ejjman1
Cohen, that looks good.

@dan, that also looks good with groups. Would groups be required to be used, or could you still just have players by themselves?

They would have to be optional. I always have my 8 players using different scripts. I'm sure I'm not the only one.

From: Ejjman1

A suggestion would be to make it so you can only select one location on the player's location page, so someone does not mistakenly choose two locations for a player.

Already thought of that and I have no idea how to do it without using the TCheckListBox's OnCheck property. Thing is, it doesn't work in Simba. Both Dan and I always get the same error when trying to get it to work (can't remember what it is at the moment).

If it did work, setting the players locations/scripts would be much easier than the way we do it now.

mormonman

2011-01-06 16:14:50

What I mean by armies is, saving and loading different lists of players.

Coh3n

2011-01-07 01:56:50

From: mormonman
What I mean by armies is, saving and loading different lists of players.

Ah yes, Dan tried doing something with TSaveDialog, which crashed Simba, but we'll try to figure something out.

E: I just made a big update. Test out the changes. :)
  • There are now Next/Previous buttons on the tabs to go through your players and their respective scripts. You can use either this method, or choosing them from the combo box.
  • I've added a separate form for script setup components. Although it may not be the most practical, it's much neater and leaves plenty of space for additions for other skills.
  • The Don't Drop/Bank check list boxes only show relative items to the script rather than every supported item.
  • Any other changes have been made in the code (organization, etc.), so as a user you shouldn't notice much differences other than what I've already said.

No, I haven't added hints to the components yet, but that's the next thing on the list. I'll also be looking into dragging the forms and saving multiple files. Check the first post for an updated list.

Enjoy. :)

mormonman

2011-01-07 02:08:55

It doesn't have to be multiple files. I think it would be quite simple to make it all one file and make your own "Open File" form that would parse that file into separate armies and let you choose which one you want to load.

Coh3n

2011-01-07 02:21:47

From: mormonman
It doesn't have to be multiple files. I think it would be quite simple to make it all one file and make your own "Open File" form that would parse that file into separate armies and let you choose which one you want to load.

Probably could do that, but if adding this:


is as simple as declaring a TSaveDialog, then that would be much easier and serve the same purpose.

@Dan: I probably won't be working on this for a little while as there are other things I need to work on, so if you planned on making some major changes, now would be the time. :)

Dgby714

2011-01-07 02:25:50

Coh3n, I was testing too see if the form was working for me. (a few days ago it wasn't)
Now after this last MSI update it does. =)

Since I was only testing and had no use for it, I closed the form without making any changes.

and got this
[0:01:02]: Thank-you for using MSI Phoenix scripts!
[0:01:02]: Exception in Script: Invalid FileNum passed: 0
The following DTMs were not freed: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80]

I'll look into a fix in a bit. (if you don't get to it before I do)

Coh3n

2011-01-07 02:27:52

From: Dgby714
Coh3n, I was testing too see if the form was working for me. (a few days ago it wasn't)
Now after this last MSI update it does. =)

Since I was only testing and had no use for it, I closed the form without making any changes.

and got this
[0:01:02]: Thank-you for using MSI Phoenix scripts!
[0:01:02]: Exception in Script: Invalid FileNum passed: 0
The following DTMs were not freed: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80]

I'll look into a fix in a bit. (if you don't get to it before I do)

Oh yeah I forgot about that. Probably because it only happens sometimes when you close the form. I'm guessing it's somewhere in the MSI_TerminateScript function in Mainloop.simba. I'll have to take a look tomorrow though.

mormonman

2011-01-07 02:34:14

From: Coh3n
Probably could do that, but if adding this:


is as simple as declaring a TSaveDialog, then that would be much easier and serve the same purpose.

@Dan: I probably won't be working on this for a little while as there are other things I need to work on, so if you planned on making some major changes, now would be the time. :)


Except that it requires the user to be a little smarter. With the army selector you could even have it so that when the highlight an army name, it shows all of the players/groups in that army. Could be pretty cool.

Dan Cardin

2011-01-07 07:11:05

Groups would effectively do what you want. You put an army into a group, and uncheck all other groups if you wont want everyone to run. It would basically remove the need to allow saving to different files. And i think it would be possible to allow for creating players without a group. Or a group that gets created when you add another group. Cuz i mean, if you have a bunch of seperate players, then create a group, by how i was expecting to do it, you wouldnt be able to go back to those people.

So either a group would need to be created to encompass those people, and just show that none of those would be grouped together, which doesn't seem like a great solution, or i could add a checkbox for enabling groups. Or people could just create a group and only have one player in it (which isn't that hard, but i guess it might not be the best solution either).

EDIT: also, why is there a members True/false combobox? I feel like we should assume that if they choose a members script, and go into a members world, then they are in fact a member.

Coh3n

2011-01-07 15:05:28

From: Dan Cardin
Groups would effectively do what you want. You put an army into a group, and uncheck all other groups if you wont want everyone to run. It would basically remove the need to allow saving to different files. And i think it would be possible to allow for creating players without a group. Or a group that gets created when you add another group. Cuz i mean, if you have a bunch of seperate players, then create a group, by how i was expecting to do it, you wouldnt be able to go back to those people.

So either a group would need to be created to encompass those people, and just show that none of those would be grouped together, which doesn't seem like a great solution, or i could add a checkbox for enabling groups. Or people could just create a group and only have one player in it (which isn't that hard, but i guess it might not be the best solution either).

I think that if the player isn't in a group, it should still run (unless it's unchecked and therefore inactive).

From: Dan Cardin

EDIT: also, why is there a members True/false combobox? I feel like we should assume that if they choose a members script, and go into a members world, then they are in fact a member.

For world switching. It sets SRL's Players[].Member so if the user wants to switch worlds when switching players, it will choose the right one.

E: Dan, I'm going to add Hints to the components before I work on other things. I forgot that the setup guide doesn't have explanations for all these any more. Let me know if you've made any major changes.

E2: Hints are done and committed.

Dan Cardin

2011-01-07 22:58:30

i haven't done anything. My problem regarding the groups would be seeing players that aren't in groups. I wanted to make it where it would update the playerlist when you clicked on a group. But then you would run into the problem when you create a group (if you have players out of group) of being able to get back to those players. I suppose i could just a textless item to the groups to be for ungrouped people. I just dont think that that is necessarily intuitive.

I would like to force people to just create a group for individuals instead, because i dont think its that much of a hassle. But, that's just me.

NCDS

2011-01-08 00:01:12

How about an Advanced Settings/Options tab that would contain such things as MIN/MAX_RUN_ENERGY (for resting), Option to toggle Reflection randoms on/off, Option to use only color, etc. The 'Extras' could also be included on this tab as well.

I can go through and make a list of everything if need be. Nothing that's really necessary/urgently needed, but would be nice I think. :)

Coh3n

2011-01-08 01:44:02

From: Dan Cardin
i haven't done anything. My problem regarding the groups would be seeing players that aren't in groups. I wanted to make it where it would update the playerlist when you clicked on a group. But then you would run into the problem when you create a group (if you have players out of group) of being able to get back to those players. I suppose i could just a textless item to the groups to be for ungrouped people. I just dont think that that is necessarily intuitive.

I would like to force people to just create a group for individuals instead, because i dont think its that much of a hassle. But, that's just me.

What about having a TTabThing on the player setup panel? One could be "Armies", one could be "All Players"?

From: NCDS
How about an Advanced Settings/Options tab that would contain such things as MIN/MAX_RUN_ENERGY (for resting), Option to toggle Reflection randoms on/off, Option to use only color, etc. The 'Extras' could also be included on this tab as well.

I can go through and make a list of everything if need be. Nothing that's really necessary/urgently needed, but would be nice I think. :)

That's actually not a bad idea. Could have an advanced settings button on the last panel and have the window pop up (like setting up a script), but with the advanced components on it.

I like that idea a lot actually. That would mean, though, that those constants would need to be made in to variables, which isn't really a big deal.

Ejjman

2011-01-08 15:15:18

How hard would it be to add a Move Up and Move Down button to the groups/players?


Like, I constantly test the script out and I have been having crashing errors, so often my first player gets way more turns than everyone else. I'd love if I could move up another player quickly to have him start instead of the people in front of him?

Dan Cardin

2011-01-08 15:44:58

oh, move up like up in the list. It would be easy to make, though im not quite sure how the other tabs access the playerlist, so it might be a bit more complicated than i think it should be. The problem would be fixed with a random order checkbox, but i agree that the option should be added.

What about having a TTabThing on the player setup panel? One could be "Armies", one could be "All Players"?
meh. We are already pushing it on the space in that tab (with some of the suggested changes). Groups would especially make the current size a bit small unless im overestimating. You would have a problem with creating a group per person? To me, its like…if you happen to create another char, that you want to do the same thing as someone you previously had singular, then it would make it easy. If that never happens, it only adds 2 clicks (maybe 1) and some optional typing to your player adding.

Coh3n

2011-01-08 15:45:17

From: Ejjman1
How hard would it be to add a Move Up and Move Down button to the groups/players?


Like, I constantly test the script out and I have been having crashing errors, so often my first player gets way more turns than everyone else. I'd love if I could move up another player quickly to have him start instead of the people in front of him?

Done. :) Update, or wait for the update if you're using the extension.

I just added a TEdit where you put the number of the player you want to start with. CurrentPlayer is set to that number when you run the script.

Oh Hi Oh

2011-01-08 22:15:03

I just noticed another error (probably SRL related). Within the RM Iron script (the one I'm currently testing) I find that after solving some randoms the screen will be left on my friends list instead of returning to my inventory. From here, the script doesn't recognize that my inventory is full, and so my character attempts to mine rocks and never banks from this point onwards.

Also, I find my character is having trouble picking a reward from the random event reward box.

(I apologize if I posted this in the wrong place :$)

Coh3n

2011-01-08 22:45:56

From: Oh Hi Oh
I just noticed another error (probably SRL related). Within the RM Iron script (the one I'm currently testing) I find that after solving some randoms the screen will be left on my friends list instead of returning to my inventory. From here, the script doesn't recognize that my inventory is full, and so my character attempts to mine rocks and never banks from this point onwards.

Also, I find my character is having trouble picking a reward from the random event reward box.

(I apologize if I posted this in the wrong place :$)

Yes, you should have posted here. Also read this. And I think you're about the 1000th person to say it's tried to mine with a full inventory. Please read around a little before posting. Nothing against you, but I'm sure you can see how it can get annoying to us when we have to say the same thing over and over again.

We recently added a failsafe in case it didn't go back to the inventory tab. I'll test it again now.

XRaye

2011-01-10 19:44:54

It's not too much of a problem, but i have MSI set to take a 5 minute break every hour, sometimes though it doesn't log out for the break, it just stands at the bank. Btw my guy is fly fishing in barbarian's village.
If this helps at all this is a small part of the debug.

[ Ugn ] ------ Deposited Raw Trout
[ Ugn ] ------ Deposited Raw Salmon
[ Ugn ] ------ Result: True
[ Ugn ] ---- Result: True
[ Ugn ] -- MSI_SetSkillLevels
[ Ugn ] ---- Fishing level hasn't changed
[ Ugn ] ---- Result: Done
[ Ugn ] -- MSI_ResetINI: Error!
[ Ugn ] ---- Temp playing time: 340270
[ Ugn ] ---- Finished total time before breaking
[ Ugn ] -- MSI_HandleBreaking
[ Ugn ] ---- Taking a short break

Coh3n

2011-01-10 19:45:52

From: XRaye
It's not too much of a problem, but i have MSI set to take a 5 minute break every hour, sometimes though it doesn't log out for the break, it just stands at the bank. Btw my guy is fly fishing in barbarian's village.
If this helps at all this is a small part of the debug.

[ Ugn ] ------ Deposited Raw Trout
[ Ugn ] ------ Deposited Raw Salmon
[ Ugn ] ------ Result: True
[ Ugn ] ---- Result: True
[ Ugn ] -- MSI_SetSkillLevels
[ Ugn ] ---- Fishing level hasn't changed
[ Ugn ] ---- Result: Done
[ Ugn ] -- MSI_ResetINI: Error!
[ Ugn ] ---- Temp playing time: 340270
[ Ugn ] ---- Finished total time before breaking
[ Ugn ] -- MSI_HandleBreaking
[ Ugn ] ---- Taking a short break

If you have Human Breaking set to true it will sometimes just time out (i.e. not do anything).

XRaye

2011-01-10 20:03:35

From: Coh3n
If you have Human Breaking set to true it will sometimes just time out (i.e. not do anything).

Oh ok, sorry about that

Coh3n

2011-01-10 20:05:21

From: XRaye
Oh ok, sorry about that

No problem. If you hover over the Human Breaking combo box, I think it says what it will do. If it doesn't, let me know and I'll change it. :)

NCDS

2011-01-10 20:06:42

From: Coh3n
If you have Human Breaking set to true it will sometimes just time out (i.e. not do anything).


I have a question about this actually. Currently, we do not start recording the 'BreakTime' until after it times out. Should we change that?

Coh3n

2011-01-10 20:10:04

From: NCDS
I have a question about this actually. Currently, we do not start recording the 'BreakTime' until after it times out. Should we change that?

Actually yeah maybe. IIRC, it takes a lot longer than it used to to time out.

NCDS

2011-01-10 20:12:58

From: Coh3n
Actually yeah maybe. IIRC, it takes a lot longer than it used to to time out.


Yeah, 5 mins I believe. :/ I can go ahead and change that.

XRaye

2011-01-10 22:53:10

That barbarian fisher ran great for 6 & 1/2 hrs =) but then it stopped because I think it couldn't find my fishing rod? Here's some debug if it helps (i still had the rod and feathers in my inventory)
Debug is starting from when I last left the bank

 [ Ugn ] ---- Player's Location = Edgeville bank
[ Ugn ] ---- MSI_PerfomWalk
[ Ugn ] ------ MSI_ReflectionWalk
[ Ugn ] -------- Tile(3107, 3433) is not on the minimap
[ Ugn ] -------- Tile(3103, 3435) is not on the minimap
[ Ugn ] -------- Tile(3096, 3449) is not on the minimap
[ Ugn ] -------- Tile(3098, 3464) is not on the minimap
[ Ugn ] -------- Tile(3100, 3474) is not on the minimap
[ Ugn ] -------- Tile(3099, 3485) is on the minimap
[ Ugn ] ---------- Flag distance: 31
[ Ugn ] ---------- Flag distance: 37
[ Ugn ] ---------- MSI_AntiBan
[ Ugn ] ---------- Flag distance: 37
[ Ugn ] ---------- Flag distance: 31
[ Ugn ] ---------- Flag distance: 20
[ Ugn ] -------- Tile(3107, 3433) is not on the minimap
[ Ugn ] -------- Tile(3103, 3435) is not on the minimap
[ Ugn ] -------- Tile(3096, 3449) is not on the minimap
[ Ugn ] -------- Tile(3098, 3464) is not on the minimap
[ Ugn ] -------- Tile(3100, 3474) is on the minimap
[ Ugn ] ---------- Flag distance: 43
[ Ugn ] ---------- Flag distance: 32
[ Ugn ] ---------- Flag distance: 22
[ Ugn ] ---------- Flag distance: 13
[ Ugn ] -------- Tile(3107, 3433) is not on the minimap
[ Ugn ] -------- Tile(3103, 3435) is not on the minimap
[ Ugn ] -------- Tile(3096, 3449) is not on the minimap
[ Ugn ] -------- Tile(3098, 3464) is on the minimap
[ Ugn ] ---------- Scanning for randoms...
[ Ugn ] ---------- Flag distance: 37
[ Ugn ] ---------- Flag distance: 27
[ Ugn ] ---------- Flag distance: 12
[ Ugn ] -------- Tile(3107, 3433) is not on the minimap
[ Ugn ] -------- Tile(3103, 3435) is not on the minimap
[ Ugn ] -------- Tile(3096, 3449) is not on the minimap
[ Ugn ] -------- Tile(3098, 3464) is on the minimap
[ Ugn ] ---------- Flag distance: 5
[ Ugn ] -------- Tile(3107, 3433) is not on the minimap
[ Ugn ] -------- Tile(3103, 3435) is not on the minimap
[ Ugn ] -------- Tile(3096, 3449) is on the minimap
[ Ugn ] ---------- Flag distance: 58
[ Ugn ] ---------- Flag distance: 61
[ Ugn ] ---------- Flag distance: 61
[ Ugn ] ---------- Flag distance: 64
[ Ugn ] ---------- MSI_AntiBan
[ Ugn ] ---------- Flag distance: 41
[ Ugn ] ---------- Flag distance: 31
[ Ugn ] ---------- Flag distance: -1
[ Ugn ] -------- Tile(3107, 3433) is not on the minimap
[ Ugn ] -------- Tile(3103, 3435) is on the minimap
[ Ugn ] ---------- Flag distance: 65
[ Ugn ] ---------- Scanning for randoms...
[ Ugn ] ---------- Flag distance: 68
[ Ugn ] ---------- Flag distance: 66
[ Ugn ] ---------- Flag distance: 59
[ Ugn ] ---------- Flag distance: 48
[ Ugn ] ---------- Flag distance: 31
[ Ugn ] ---------- Flag distance: 23
[ Ugn ] ---------- MSI_AntiBan
[ Ugn ] ---------- Distance from player to location: 24
[ Ugn ] ---------- Distance from player to location: 40
[ Ugn ] -------- Tile(3107, 3433) is on the minimap
[ Ugn ] ---------- Flag distance: 22
[ Ugn ] ---------- Flag distance: -1
[ Ugn ] ---------- Distance from player to location: 8
[ Ugn ] ---------- Player is at Barbarian Village fishing spot
[ Ugn ] -------- Player's Location = Barbarian Village fishing spot
[ Ugn ] -------- Result: True
[ Ugn ] ------ Result: True
[ Ugn ] ---- Result: True
[ Ugn ] -- MSI_AutoObjects
[ Ugn ] ---- MSI_FindObjectsIn
[ Ugn ] ------ 2 objects found!
[ Ugn ] ------ MSI_Track Object
[ Ugn ] ---------- MSI_FindObjectsTPA: Not enough points!
[ Ugn ] ---------- MSI_FindObjectsTPA: Not enough points!
[ Ugn ] ---------- MSI_FindObjectsTPA: Not enough points!
[ Ugn ] ---------- MSI_FindObjectsTPA: Not enough points!
[ Ugn ] ---------- MSI_FindObjectsTPA: Not enough points!
[ Ugn ] ---------- MSI_FindObjectsTPA: No colors found!
[ Ugn ] ---------- MSI_FindObjectsTPA: Not enough points!
[ Ugn ] ---------- MSI_FindObjectsTPA: Not enough points!
[ Ugn ] -------- ~ Track Record
[ Ugn ] -------- ~ ~ TrackObject
[ Ugn ] -------- ~ ~ Searches: 143
[ Ugn ] -------- ~ ~ Successes: 111
[ Ugn ] -------- ~ ~ Success %: 77
[ Ugn ] -------- Result: True
[ Ugn ] ------ Result: True
[ Ugn ] ---- MSI_WaitWhileFishing
[ Ugn ] ------ DetectWaterDirections, direction: 0. Result: True. WaterCount: 251
[ Ugn ] ------ DetectWaterDirections, direction: 1. Result: False. WaterCount: 0
[ Ugn ] ------ DetectWaterDirections, direction: 2. Result: False. WaterCount: 0
[ Ugn ] ------ DetectWaterDirections, direction: 3. Result: False. WaterCount: 64
[ Ugn ] ------ TrueCount: 1
[ Ugn ] ------ Setting compass to: n
[ Ugn ] ------ Luring
[ Ugn ] -------- Scanning for randoms...
[ Ugn ] ------ Timefrommark Check for fish
[ Ugn ] ------ PixelShift Segment
[ Ugn ] ------ Findgear Segment
[ Ugn ] ------ Fishing returned True
[ Ugn ] ------ Timefrommark Check for fish
[ Ugn ] ------ PixelShift Segment
[ Ugn ] ------ Findgear Segment
[ Ugn ] ------ Fishing returned True
[ Ugn ] -------- MSI_AntiBan
[ Ugn ] ------ Timefrommark Check for fish
[ Ugn ] ------ PixelShift Segment
[ Ugn ] ------ Findgear Segment
[ Ugn ] ------ Fishing returned True
[ Ugn ] ------ Timefrommark Check for fish
[ Ugn ] ------ PixelShift Segment
[ Ugn ] ------ Findgear Segment
[ Ugn ] ------ Fishing returned True
[ Ugn ] -------- Scanning for randoms...
[ Ugn ] ------ Timefrommark Check for fish
[ Ugn ] ------ PixelShift Segment
[ Ugn ] ------ Findgear Segment
[ Ugn ] ------ Fishing returned True
[ Ugn ] ------ Timefrommark Check for fish
[ Ugn ] ------ PixelShift Segment
[ Ugn ] ------ Findgear Segment
[ Ugn ] ------ Fishing returned True
[ Ugn ] ------ Timefrommark Check for fish
[ Ugn ] ------ PixelShift Segment
[ Ugn ] ------ Findgear Segment
[ Ugn ] ------ Fishing returned True
[ Ugn ] ------ Timefrommark Check for fish
[ Ugn ] ------ Got more fish, setting new count
[ Ugn ] ------ PixelShift Segment
[ Ugn ] ------ Findgear Segment
[ Ugn ] ------ Fishing returned True
[ Ugn ] -------- Scanning for randoms...
[ Ugn ] ------ Timefrommark Check for fish
[ Ugn ] ------ PixelShift Segment
[ Ugn ] ------ Findgear Segment
[ Ugn ] ------ Fishing returned True
[ Ugn ] ------ Timefrommark Check for fish
[ Ugn ] ------ PixelShift Segment
[ Ugn ] ------ Findgear Segment
[ Ugn ] ------ Fishing returned True
[ Ugn ] ------ Timefrommark Check for fish
[ Ugn ] ------ PixelShift Segment
[ Ugn ] ------ Findgear Segment
[ Ugn ] ------ Fishing returned True
[ Ugn ] -------- MSI_AntiBan
[ Ugn ] ------ Timefrommark Check for fish
[ Ugn ] ------ PixelShift Segment
[ Ugn ] ------ Findgear Segment
[ Ugn ] ------ Fishing returned True
[ Ugn ] -------- Scanning for randoms...
[ Ugn ] ------ Timefrommark Check for fish
[ Ugn ] ------ PixelShift Segment
[ Ugn ] ------ Findgear Segment
[ Ugn ] ------ Fishing returned True
[ Ugn ] ------ Timefrommark Check for fish
[ Ugn ] ------ PixelShift Segment
[ Ugn ] ------ Findgear Segment
[ Ugn ] ------ Fishing returned True
[ Ugn ] ------ Timefrommark Check for fish
[ Ugn ] ------ Got more fish, setting new count
[ Ugn ] ------ PixelShift Segment
[ Ugn ] ------ Findgear Segment
[ Ugn ] ------ Fishing returned True
[ Ugn ] ------ Timefrommark Check for fish
[ Ugn ] ------ PixelShift Segment
[ Ugn ] ------ Findgear Segment
[ Ugn ] ------ Result: MSI_WaitWhileFishing: Exit
[ Ugn ] ---- MSI_FindObjectsIn
[ Ugn ] -------- MSI_FindObjectsTPA: No colors found!
[ Ugn ] ------ Result: False
[ Ugn ] ------ Scanning for randoms...
[ Ugn ] ------ MSI_FindRandoms: Solved Random Event!
[ Ugn ] ---- MSI_Relocate
[ Ugn ] ------ Walking to Point(602, 113)
[ Ugn ] -------- Flag distance: 37
[ Ugn ] -------- MSI_AntiBan
[ Ugn ] -------- Flag distance: 26
[ Ugn ] -------- Flag distance: 12
[ Ugn ] ------ Result: True
[ Ugn ] ------ Waiting 62201 ms before relocating again
[ Ugn ] ---- MSI_FindObjectsIn
[ Ugn ] ------ 1 objects found!
[ Ugn ] ------ MSI_Track Object
[ Ugn ] ---------- MSI_FindObjectsTPA: Not enough points!
[ Ugn ] ---------- MSI_FindObjectsTPA: Not enough points!
[ Ugn ] ---------- MSI_FindObjectsTPA: Not enough points!
[ Ugn ] ---------- MSI_FindObjectsTPA: Not enough points!
[ Ugn ] ---------- MSI_FindObjectsTPA: Not enough points!
[ Ugn ] ---------- MSI_FindObjectsTPA: Not enough points!
[ Ugn ] ---------- MSI_FindObjectsTPA: Not enough points!
[ Ugn ] ---------- MSI_FindObjectsTPA: Not enough points!
[ Ugn ] ---------- MSI_FindObjectsTPA: Not enough points!
[ Ugn ] ---------- MSI_FindObjectsTPA: No colors found!
[ Ugn ] ---------- MSI_FindObjectsTPA: No colors found!
[ Ugn ] ---------- MSI_FindObjectsTPA: No colors found!
[ Ugn ] ---------- MSI_FindObjectsTPA: No colors found!
[ Ugn ] ---------- MSI_FindObjectsTPA: No colors found!
[ Ugn ] -------- Lost track of object
[ Ugn ] -------- ~ Track Record
[ Ugn ] -------- ~ ~ TrackObject
[ Ugn ] -------- ~ ~ Searches: 144
[ Ugn ] -------- ~ ~ Successes: 111
[ Ugn ] -------- ~ ~ Success %: 77
[ Ugn ] -------- Result: False
[ Ugn ] ------ Result: True
[ Ugn ] ---- MSI_WaitWhileFishing
[ Ugn ] ------ DetectWaterDirections, direction: 0. Result: True. WaterCount: 247
[ Ugn ] ------ DetectWaterDirections, direction: 1. Result: False. WaterCount: 0
[ Ugn ] ------ DetectWaterDirections, direction: 2. Result: False. WaterCount: 96
[ Ugn ] ------ DetectWaterDirections, direction: 3. Result: False. WaterCount: 0
[ Ugn ] ------ TrueCount: 1
[ Ugn ] ------ Setting compass to: n
[ Ugn ] ------ Luring
[ Ugn ] ------ Timefrommark Check for fish
[ Ugn ] ------ PixelShift Segment
[ Ugn ] ------ Findgear Segment
[ Ugn ] ------ Fishing returned True
[ Ugn ] ------ Timefrommark Check for fish
[ Ugn ] ------ PixelShift Segment
[ Ugn ] ------ Findgear Segment
[ Ugn ] ------ Fishing returned True
[ Ugn ] -------- Scanning for randoms...
[ Ugn ] ------ Timefrommark Check for fish
[ Ugn ] ------ PixelShift Segment
[ Ugn ] ------ Findgear Segment
[ Ugn ] ------ Fishing returned True
[ Ugn ] ------ Timefrommark Check for fish
[ Ugn ] ------ PixelShift Segment
[ Ugn ] ------ Findgear Segment
[ Ugn ] ------ Fishing returned True
[ Ugn ] ------ Timefrommark Check for fish
[ Ugn ] ------ PixelShift Segment
[ Ugn ] ------ Findgear Segment
[ Ugn ] ------ Fishing returned True
[ Ugn ] -------- MSI_AntiBan
[ Ugn ] ------ Timefrommark Check for fish
[ Ugn ] ------ PixelShift Segment
[ Ugn ] ------ Findgear Segment
[ Ugn ] ------ Fishing returned True
[ Ugn ] -------- Scanning for randoms...
[ Ugn ] ------ Timefrommark Check for fish
[ Ugn ] ------ Result: MSI_WaitWhileFishing: Exit
[ Ugn ] ---- MSI_FindObjectsIn
[ Ugn ] -------- MSI_FindObjectsTPA: No colors found!
[ Ugn ] ------ Result: False
[ Ugn ] ---- MSI_Relocate
[ Ugn ] ------ Walking to Point(602, 109)
[ Ugn ] -------- Flag distance: 35
[ Ugn ] -------- Flag distance: 37
[ Ugn ] -------- Flag distance: 30
[ Ugn ] -------- MSI_AntiBan
[ Ugn ] -------- Flag distance: 11
[ Ugn ] ------ Result: True
[ Ugn ] ------ Waiting 81132 ms before relocating again
[ Ugn ] ---- MSI_FindObjectsIn
[ Ugn ] ------ 1 objects found!
[ Ugn ] ------ Uptext didn't match!
[ Ugn ] ------ Result: False
[ Ugn ] ---- MSI_FindObjectsIn
[ Ugn ] -------- MSI_FindObjectsTPA: Not enough points!
[ Ugn ] -------- MSI_FindObjectsTPA: Not enough points!
[ Ugn ] ------ Result: False
[ Ugn ] ---- MSI_FindObjectsIn
[ Ugn ] -------- MSI_FindObjectsTPA: Not enough points!
[ Ugn ] -------- MSI_FindObjectsTPA: Not enough points!
[ Ugn ] ------ Result: False
[ Ugn ] ---- MSI_FindObjectsIn
[ Ugn ] -------- MSI_FindObjectsTPA: Not enough points!
[ Ugn ] ------ 1 objects found!
[ Ugn ] ------ MSI_Track Object
[ Ugn ] ---------- MSI_FindObjectsTPA: Not enough points!
[ Ugn ] ---------- MSI_FindObjectsTPA: Not enough points!
[ Ugn ] ---------- MSI_FindObjectsTPA: Not enough points!
[ Ugn ] ---------- MSI_FindObjectsTPA: Not enough points!
[ Ugn ] ---------- MSI_FindObjectsTPA: Not enough points!
[ Ugn ] ---------- MSI_FindObjectsTPA: Not enough points!
[ Ugn ] ---------- MSI_FindObjectsTPA: Not enough points!
[ Ugn ] ---------- MSI_FindObjectsTPA: Not enough points!
[ Ugn ] ---------- MSI_FindObjectsTPA: No colors found!
[ Ugn ] ---------- MSI_FindObjectsTPA: No colors found!
[ Ugn ] -------- Lost track of object
[ Ugn ] -------- ~ Track Record
[ Ugn ] -------- ~ ~ TrackObject
[ Ugn ] -------- ~ ~ Searches: 145
[ Ugn ] -------- ~ ~ Successes: 111
[ Ugn ] -------- ~ ~ Success %: 76
[ Ugn ] -------- Result: False
[ Ugn ] ------ Result: True
[ Ugn ] ---- MSI_WaitWhileFishing
[ Ugn ] ------ DetectWaterDirections, direction: 0. Result: False. WaterCount: 0
[ Ugn ] ------ DetectWaterDirections, direction: 1. Result: False. WaterCount: 0
[ Ugn ] ------ DetectWaterDirections, direction: 2. Result: False. WaterCount: 0
[ Ugn ] ------ DetectWaterDirections, direction: 3. Result: False. WaterCount: 0
[ Ugn ] ------ TrueCount: 0
[ Ugn ] ------ Setting compass to:
[ Ugn ] ------ Luring
[ Ugn ] ------ Timefrommark Check for fish
[ Ugn ] ------ PixelShift Segment
[ Ugn ] ------ Findgear Segment
[ Ugn ] ------ Fishing returned True
[ Ugn ] ------ Timefrommark Check for fish
[ Ugn ] ------ PixelShift Segment
[ Ugn ] ------ Findgear Segment
[ Ugn ] ------ Fishing returned True
[ Ugn ] -------- Scanning for randoms...
[ Ugn ] ------ Timefrommark Check for fish
[ Ugn ] ------ PixelShift Segment
[ Ugn ] ------ Findgear Segment
[ Ugn ] ------ Fishing returned True
[ Ugn ] ------ Timefrommark Check for fish
[ Ugn ] ------ PixelShift Segment
[ Ugn ] ------ Findgear Segment
[ Ugn ] ------ Fishing returned True
[ Ugn ] -------- MSI_AntiBan
[ Ugn ] ------ Timefrommark Check for fish
[ Ugn ] ------ PixelShift Segment
[ Ugn ] ------ Findgear Segment
[ Ugn ] ------ Fishing returned True
[ Ugn ] ------ Timefrommark Check for fish
[ Ugn ] ------ PixelShift Segment
[ Ugn ] ------ Findgear Segment
[ Ugn ] ------ Fishing returned True
[ Ugn ] -------- Scanning for randoms...
[ Ugn ] ------ Timefrommark Check for fish
[ Ugn ] ------ Result: MSI_WaitWhileFishing: Exit
[ Ugn ] ---- MSI_FindObjectsIn
[ Ugn ] -------- MSI_FindObjectsTPA: Not enough points!
[ Ugn ] ------ 1 objects found!
[ Ugn ] ------ MSI_Track Object
[ Ugn ] ---------- MSI_FindObjectsTPA: No colors found!
[ Ugn ] -------- ~ Track Record
[ Ugn ] -------- ~ ~ TrackObject
[ Ugn ] -------- ~ ~ Searches: 146
[ Ugn ] -------- ~ ~ Successes: 112
[ Ugn ] -------- ~ ~ Success %: 76
[ Ugn ] -------- Result: True
[ Ugn ] ------ Result: True
[ Ugn ] ---- MSI_WaitWhileFishing
[ Ugn ] ------ DetectWaterDirections, direction: 0. Result: True. WaterCount: 213
[ Ugn ] ------ DetectWaterDirections, direction: 1. Result: False. WaterCount: 0
[ Ugn ] ------ DetectWaterDirections, direction: 2. Result: False. WaterCount: 0
[ Ugn ] ------ DetectWaterDirections, direction: 3. Result: False. WaterCount: 41
[ Ugn ] ------ TrueCount: 1
[ Ugn ] ------ Setting compass to: n
[ Ugn ] ------ Luring
[ Ugn ] ------ Timefrommark Check for fish
[ Ugn ] ------ PixelShift Segment
[ Ugn ] ------ Findgear Segment
[ Ugn ] ------ Fishing returned True
[ Ugn ] ------ Timefrommark Check for fish
[ Ugn ] ------ PixelShift Segment
[ Ugn ] ------ Findgear Segment
[ Ugn ] ------ Result: MSI_WaitWhileFishing: Exit
[ Ugn ] ---- MSI_FindObjectsIn
[ Ugn ] ------ 1 objects found!
[ Ugn ] ------ MSI_Track Object
[ Ugn ] ---------- MSI_FindObjectsTPA: Not enough points!
[ Ugn ] ---------- MSI_FindObjectsTPA: Not enough points!
[ Ugn ] ---------- MSI_FindObjectsTPA: Not enough points!
[ Ugn ] ---------- MSI_FindObjectsTPA: No colors found!
[ Ugn ] ---------- MSI_FindObjectsTPA: No colors found!
[ Ugn ] -------- Lost track of object
[ Ugn ] -------- ~ Track Record
[ Ugn ] -------- ~ ~ TrackObject
[ Ugn ] -------- ~ ~ Searches: 147
[ Ugn ] -------- ~ ~ Successes: 112
[ Ugn ] -------- ~ ~ Success %: 76
[ Ugn ] -------- Result: False
[ Ugn ] ------ Result: True
[ Ugn ] ---- MSI_WaitWhileFishing
[ Ugn ] ------ DetectWaterDirections, direction: 0. Result: True. WaterCount: 226
[ Ugn ] ------ DetectWaterDirections, direction: 1. Result: False. WaterCount: 0
[ Ugn ] ------ DetectWaterDirections, direction: 2. Result: False. WaterCount: 122
[ Ugn ] ------ DetectWaterDirections, direction: 3. Result: False. WaterCount: 0
[ Ugn ] ------ TrueCount: 1
[ Ugn ] ------ Setting compass to: n
[ Ugn ] ------ Luring
[ Ugn ] -------- Scanning for randoms...
[ Ugn ] ------ Timefrommark Check for fish
[ Ugn ] ------ PixelShift Segment
[ Ugn ] ------ Findgear Segment
[ Ugn ] ------ Fishing returned True
[ Ugn ] ------ Timefrommark Check for fish
[ Ugn ] ------ PixelShift Segment
[ Ugn ] ------ Findgear Segment
[ Ugn ] ------ Fishing returned True
[ Ugn ] ------ Timefrommark Check for fish
[ Ugn ] ------ PixelShift Segment
[ Ugn ] ------ Findgear Segment
[ Ugn ] ------ Fishing returned True
[ Ugn ] ------ Timefrommark Check for fish
[ Ugn ] ------ PixelShift Segment
[ Ugn ] ------ Findgear Segment
[ Ugn ] ------ Fishing returned True
[ Ugn ] -------- Scanning for randoms...
[ Ugn ] ------ Timefrommark Check for fish
[ Ugn ] ------ Result: MSI_WaitWhileFishing: Exit
[ Ugn ] ---- Result: False
[ Ugn ] ---- MSI_TimedOut: Suspicion of connection loss
[ Ugn ] -- MSI_ResetINI: Error!
[ Ugn ] -- MSI_SetupPlayer
[ Ugn ] ------ Scanning for randoms...
[ Ugn ] ---- MSI_SetupFishing
[ Ugn ] ------ Lure Spot: Required tools not found
[ Ugn ] ------ Result: MSI_SetupFishing: False
[ Ugn ] ---- Result: False
[ Ugn ] ---- MSI_TimedOut: Suspicion of connection loss
[ Ugn ] -- MSI_ResetINI: Error!
[ Ugn ] -- MSI_SetupPlayer
[ Ugn ] ---- MSI_SetSkillLevels
[ Ugn ] ------ Fishing level hasn't changed
[ Ugn ] ------ Result: Done
[ Ugn ] ---- MSI_SetupFishing
[ Ugn ] ------ Result: MSI_SetupFishing: False
[ Ugn ] ---- Result: False
[ Ugn ] -- MSI_UnsetPlayer
[ Ugn ] ---- Failed to setup player
[ Ugn ] ---- MSI_SetSkillLevels
[ Ugn ] ------ Fishing level hasn't changed
[ Ugn ] ------ Result: Done

Coh3n

2011-01-10 23:36:21

From: XRaye
That barbarian fisher ran great for 6 & 1/2 hrs =) but then it stopped because I think it couldn't find my fishing rod? Here's some debug if it helps (i still had the rod and feathers in my inventory)
Debug is starting from when I last left the bank

This is in the wrong thread. You want to post problems with the script in the Script didn't run thread. According to the debug you posted, it recovered from a connection loss, and for some reason didn't properly setup your player after logging back in. It doesn't even look like it looked for the items. I'll take a look at it now.

E: I can't seem to find what's wrong so I added some more debugging in MSI_SetupFishing. If it happens again, please report it and post the debug in the Script didn't run thread. :) Thanks, and sorry for the inconvenience. Usually I would try to recreate the problem, but I don't have an account ATM that I can test Lure fishing with.

XRaye

2011-01-11 00:27:27

Oh alright, thanks =)
And i'm a little confused on what goes in this thread and what goes in the script didn't run thread?

Coh3n

2011-01-11 00:29:14

From: XRaye
Oh alright, thanks =)
And i'm a little confused on what goes in this thread and what goes in the script didn't run thread?

This is for form bugs and suggestions, hence the title. ;)

XRaye

2011-01-11 00:43:53

From: Coh3n
This is for form bugs and suggestions, hence the title. ;)

ooo oops sorry, I just read MSI Bugs and Suggestions =p got it now =)

Sgt Soul

2011-01-11 03:24:47

EDIT
wrong section sorry, if curious click here:shifty:

Heavenzeyez1

2011-01-11 17:23:39

Guys, the form looks perfect!!! :)
This is just so beautiful how far MSI can grow.
Thank you all, it is just wonderful! :)

~Eerik.

Gu3st...

2011-01-12 16:39:45

From: Heavenzeyez1
Guys, the form looks perfect!!! :)

~Eerik.
I agree :)
Great job guys :)

mormonman

2011-01-18 05:01:45

Got an annoyance more than a bug. Remove the settings.txt from the svn and have the script create that file if it doesn' exist. Everytime MSI updates all of my saved settings for the first tab are overwritten, and I have to take the time to fill them out again.

Coh3n

2011-01-18 14:52:36

From: mormonman
Got an annoyance more than a bug. Remove the settings.txt from the svn and have the script create that file if it doesn' exist. Everytime MSI updates all of my saved settings for the first tab are overwritten, and I have to take the time to fill them out again.

I didn't think files were overridden. I thought it says it's in a conflict state, rather than overriding it. Weird. I'll add that to the first post, though and get to it as soon as I can. :)

mormonman

2011-01-18 15:00:42

From: Coh3n
I didn't think files were overridden. I thought it says it's in a conflict state, rather than overriding it. Weird. I'll add that to the first post, though and get to it as soon as I can. :)


Using MSI.sex it just overwrites everything.

Coh3n

2011-01-18 15:06:38

From: mormonman
Using MSI.sex it just overwrites everything.

Interesting. Good to know.

Sgt Soul

2011-01-19 19:04:13

if it hasn't been suggested already I would like to suggest that you make it so its not possible to have 2 locations selected at the same time in the form as it could be overly confusing for new players. Also after picking the script (when it asks for the current location of the player) you should only be able to view the valid locations dependant on the script that has been selected.

many thanks,
Sgt Soul

Coh3n

2011-01-20 16:06:56

From: sgt soul
if it hasn't been suggested already I would like to suggest that you make it so its not possible to have 2 locations selected at the same time in the form as it could be overly confusing for new players. Also after picking the script (when it asks for the current location of the player) you should only be able to view the valid locations dependant on the script that has been selected.

many thanks,
Sgt Soul

1. It's not like that now because for whatever reason, the OnClick pointers don't work for TCheckBoxLists in Simba. It was suggested to use Radio Buttons instead, but I'm not sure if there's a TRadioButtonList type.

2. It's already on the first post. ;)

mormonman

2011-01-20 16:48:17

From: Coh3n
1. It's not like that now because for whatever reason, the OnClick pointers don't work for TCheckBoxLists in Simba. It was suggested to use Radio Buttons instead, but I'm not sure if there's a TRadioButtonList type.


It doesn't exist unfortunately :( I tried for hours to find documentation on FPC for it.

Coh3n

2011-01-20 17:06:46

From: mormonman

It doesn't exist unfortunately :( I tried for hours to find documentation on FPC for it.

It's not actually OnClick, but there's something like OnItemCheck and OnItemClick or something like that. They appear in Simba anyway, but I always get type mismatches when I try to set the pointers.

E: Nevermind, I think you were talking about TRadioButtonList. :p

I haven't been able to figure out a way to have it respond to clicks (so I can disable all other locations when one is checked) without having those pointers working properly. I'm allow pretty sure someone reported that bug in the Simba tracker, but mastaraymond had no idea why it was happening.

E2: It now only shows the valid locations for each player.

nielskool

2011-01-23 05:52:33

hi guys,
first of all i would like to say that i love msi scripting!! it works awesome.

i have a little problem with the rimmington iron miner(Rimmington Iron Rocks 1). sometimes when my acount walks to the rocks, he detect both of the rocks but only click on one of the them. does any has the same problem?

thnx

Gu3st...

2011-01-23 10:12:18

From: nielskool
hi guys,
first of all i would like to say that i love msi scripting!! it works awesome.

i have a little problem with the rimmington iron miner(Rimmington Iron Rocks 1). sometimes when my acount walks to the rocks, he detect both of the rocks but only click on one of the them. does any has the same problem?

thnx
This is not the correct thread for this. This thread is about the MSI Form, not MSI itself. Please post a new thread here: http://villavu.com/forum/forumdisplay.php?f=313

Dan Cardin

2011-01-23 14:14:29

timers will solve all problems (i think) that would require the onclickitem to work. I am just very anti programming atm, so i cbf to do it =/

Coh3n

2011-01-23 16:58:05

From: nielskool
hi guys,
first of all i would like to say that i love msi scripting!! it works awesome.

i have a little problem with the rimmington iron miner(Rimmington Iron Rocks 1). sometimes when my acount walks to the rocks, he detect both of the rocks but only click on one of the them. does any has the same problem?

thnx

What do you mean? Does it hover the other rock?

From: Dan Cardin
timers will solve all problems (i think) that would require the onclickitem to work. I am just very anti programming atm, so i cbf to do it =/

Mind explaining how you would do that because I don't have a clue? You may have before, but I don't remember.

Dan Cardin

2011-01-23 21:09:13

you have a timer check if the status of any of the checkboxes changes. If so, update accordingly

Coh3n

2011-01-23 21:59:01

From: Dan Cardin
you have a timer check if the status of any of the checkboxes changes. If so, update accordingly

So would it be checking continuously as the form was up?

yeangkz

2011-01-24 12:38:51

Hey guys, I don't know whether this is a bug or not, but now theres a new update where the option will be grouped up. For example, to fish for swordfishes and lobsters, the will be an option to cage or harpoon.But now, if theres too many options, like too many players on the list when you right click, THE CAGE AND HARPOON OPTION WILL BE UNDER AN OPTION CALLED FISHING SPOTS. Need to update this please : )

Coh3n

2011-01-24 12:52:57

From: yeangkz
Hey guys, I don't know whether this is a bug or not, but now theres a new update where the option will be grouped up. For example, to fish for swordfishes and lobsters, the will be an option to cage or harpoon.But now, if theres too many options, like too many players on the list when you right click, THE CAGE AND HARPOON OPTION WILL BE UNDER AN OPTION CALLED FISHING SPOTS. Need to update this please : )

Okay well I think this is the 4th or 5th time it's been said in this thread. This is ONLY for bugs and suggestions for the MSI Form. Any problems you have with the script itself should be posted on this thread. Apparently no one likes to read the first paragraph of the first post this thread.

Now, to your issue. It's not MSI, it's SRL. MSI uses SRL's ChooseOption, so file your bug report in the Public SVN section.

nielskool

2011-01-24 15:02:23

Quote:
Originally Posted by nielskool
hi guys,
first of all i would like to say that i love msi scripting!! it works awesome.

i have a little problem with the rimmington iron miner(Rimmington Iron Rocks 1). sometimes when my acount walks to the rocks, he detect both of the rocks but only click on one of the them. does any has the same problem?

thnx

What do you mean? Does it hover the other rock?



msi detects the iron rock the left one to be specific but does not click on the rock so he does not mining it.

yea it hover the rock
(im sorry for the language)

Coh3n

2011-01-24 17:40:35

From: nielskool
msi detects the iron rock the left one to be specific but does not click on the rock so he does not mining it.

yea it hover the rock
(im sorry for the language)

Have you tried mining in other iron locations? It sounds like an uptext issue, but that doesn't really make sense if it's mining the one rock.

yeangkz

2011-01-25 10:44:15

When I'm fishing for lobsters, sometimes it will click the net or bait option..then I have to wait for several minutes for it to reselect the right one. And it happens often. Anyone got this prob?

Coh3n

2011-01-25 14:41:09

From: yeangkz
When I'm fishing for lobsters, sometimes it will click the net or bait option..then I have to wait for several minutes for it to reselect the right one. And it happens often. Anyone got this prob?

I'm not going to answer that. Did you even read my reply to your last post?

nielskool

2011-01-25 14:49:36

Have you tried mining in other iron locations? It sounds like an uptext issue, but that doesn't really make sense if it's mining the one rock.


yes i have tried mining orther iron locations and i have only problems with the iron mining 1 script. im scripting on 3 different computers and at all of them I detect this problem. i shall make a short movie to show you exactly what i mean to say. is that an option?

Coh3n

2011-01-25 14:51:56

From: nielskool
yes i have tried mining orther iron locations and i have only problems with the iron mining 1 script. im scripting on 3 different computers and at all of them I detect this problem. i shall make a short movie to show you exactly what i mean to say. is that an option?

Please do, and when it's done, please post it on this thread. Also post your debug file if you have it.

Dan Cardin

2011-01-25 18:44:49

yes, it would be constantly looking, though you could do it where it only is enabled when you are on the tab that needs it. So basically only the first one, though you could do it for the others if you wanted to add that thing that you wanted before.

Coh3n

2011-01-26 01:19:50

From: Dan Cardin
yes, it would be constantly looking, though you could do it where it only is enabled when you are on the tab that needs it. So basically only the first one, though you could do it for the others if you wanted to add that thing that you wanted before.

Ah okay I understand now. Unfortunately, this isn't hight on my to-do list. I have about a dozen other things first. :o

Boreas

2011-02-14 01:46:03

Priority: low
Category: ease of use, polish, UI intuitiveness

On the player tab, add player button is on the top, and the user/pass boxes are on the right. Unless I did something wrong, it would appear that you to have enter the user/pass/etc first, then click add player. So I think add player should be on the bottom. Likewise remove player should be on the bottom because you have to select a player first. Basically everything should go top down.

Dan Cardin

2011-02-14 07:13:08

agreed. If I ever get around to making groups, then that would be fixed anyway, but I'm not sure quite how groups would affect the way things are saved in the rest of the form, so idk if I should touch it.

Coh3n

2011-02-14 19:31:37

From: Boreas
Priority: low
Category: ease of use, polish, UI intuitiveness

On the player tab, add player button is on the top, and the user/pass boxes are on the right. Unless I did something wrong, it would appear that you to have enter the user/pass/etc first, then click add player. So I think add player should be on the bottom. Likewise remove player should be on the bottom because you have to select a player first. Basically everything should go top down.

Makes sense.

From: Dan Cardin
agreed. If I ever get around to making groups, then that would be fixed anyway, but I'm not sure quite how groups would affect the way things are saved in the rest of the form, so idk if I should touch it.

Just so you know, MSI is now on git, so you can fork the repository and make any changes you want, then send a pull request to the main repository.

Dan Cardin

2011-02-14 21:44:45

I saw. I don't really get it…I wonder if the change was really worth the effort for the minimal benefits I see it actually doing for this particular project.

Coh3n

2011-02-14 23:56:44

From: Dan Cardin
I saw. I don't really get it…I wonder if the change was really worth the effort for the minimal benefits I see it actually doing for this particular project.

Switching to git? It's actually nice. There hasn't been much activity right now, but it allows me to push changes to my personal fork for other people to test before I merge it with the main branch.

NCDS

2011-02-15 00:00:41

From: Dan Cardin
I saw. I don't really get it…I wonder if the change was really worth the effort for the minimal benefits I see it actually doing for this particular project.


From: Coh3n
Switching to git? It's actually nice. There hasn't been much activity right now, but it allows me to push changes to my personal fork for other people to test before I merge it with the main branch.


Yeah, it honestly does make development easier. Though git can be a bit confusing at first, I'm still figuring everything out.

Yago

2011-03-12 17:23:49

Suggestion (Not Neccessary) Mask the password field so that nobody see the password

And yes I know there is a players file …

Coh3n

2011-03-12 18:43:36

From: yago
Suggestion (Not Neccessary) Mask the password field so that nobody see the password

And yes I know there is a players file …

What's the player file have anything to do with it?

And I thought it already masked the password, or are you talking about masking it in the player file? If so, that's not possible.

Yago

2011-03-12 18:50:11

no like when you enter the password a bunch of stars appear in place of your characters. By player file… I know the info is available on the player file.

Coh3n

2011-03-12 18:54:10

From: yago
no like when you enter the password a bunch of stars appear in place of your characters. By player file… I know the info is available on the player file.

Oh yeah I thought it already did that. Guess not. I'll be sure to fix that up when I can.

Yago

2011-03-12 18:56:28

Yeah … In the list of players it shows all the info so say my brother or someone walked by …

Coh3n

2011-03-12 19:01:09

From: yago
Yeah … In the list of players it shows all the info so say my brother or someone walked by …

Oh okay. Well that part can just be removed from the player list. I may add a check box to toggle showing the password.

Yago

2011-03-12 19:04:55

k. Thanks :)

Luski14

2011-03-25 11:48:18

Not sure what the error or bug is here, but I'm trying to run multiple accounts doing Rimmington Clay Minning, and I will get this spammed a million times a second (maybe a little exaggerated :P)


[0:02:18]: [ Username ] ---------- Point in bad box

I'll get roughly 40-50 messages like this per second in the debug window.
It also seems to make the accounts minning not even mine, even though their standing next to clay. It then will mine one, and spam this message over again.

Everything is updated and the brightness/quality set correctly.


It also doesn't seem to work for my multiple accounts. First account works fine, but when any of the others log in, they open up the bank deposit box, say theres nothing to deposit (in the debug) and it logs out and goes onto the next. It then won't go back to the first account after the rest are set to false, and just ends the script.
Edit2: Nevermind on this. It won't work for any again. It seems to always want to open the bank on login and deposit something (clay in this case?) and since it doesn't, it just ends the script. This also happens when trying to do Draynor Clay. I think it might have something to do with the banking section.

Edit: My apologies in case this is in the wrong section. I decided here as oppose to script won't run because the script does run and works flawlessly if I set up one account.

Echo_

2011-03-25 12:38:42

The last time I ran the Rimmington gold miner, the script mines one ore then just sits. It might be an issue with the WaitWhileMining procedure, but I'm not sure. I don't know if this has been fixed since I last ran it because that was 2 days ago.

Coh3n

2011-03-26 19:32:30

From: Luski14
Not sure what the error or bug is here, but I'm trying to run multiple accounts doing Rimmington Clay Minning, and I will get this spammed a million times a second (maybe a little exaggerated :P)


[0:02:18]: [ Username ] ---------- Point in bad box

I'll get roughly 40-50 messages like this per second in the debug window.
It also seems to make the accounts minning not even mine, even though their standing next to clay. It then will mine one, and spam this message over again.

Everything is updated and the brightness/quality set correctly.


It also doesn't seem to work for my multiple accounts. First account works fine, but when any of the others log in, they open up the bank deposit box, say theres nothing to deposit (in the debug) and it logs out and goes onto the next. It then won't go back to the first account after the rest are set to false, and just ends the script.
Edit2: Nevermind on this. It won't work for any again. It seems to always want to open the bank on login and deposit something (clay in this case?) and since it doesn't, it just ends the script. This also happens when trying to do Draynor Clay. I think it might have something to do with the banking section.

Edit: My apologies in case this is in the wrong section. I decided here as oppose to script won't run because the script does run and works flawlessly if I set up one account.

I don't know what to tell you. My MSI has been running for 31 hours on 8 characters. They're all still active and the script is still running.

From: Echo_
The last time I ran the Rimmington gold miner, the script mines one ore then just sits. It might be an issue with the WaitWhileMining procedure, but I'm not sure. I don't know if this has been fixed since I last ran it because that was 2 days ago.

Someone was having this issue with Coal, which has since been fixed recently. I'm hoping it was fixed for all ore. For some reason it would wait for a long time after mining an ore.

E: And by the way guys, this thread is for bugs/suggestions for the MSI Form. Please read the title more carefully next time.

bolshak25

2011-05-21 17:36:49

i suggest choosing what you want from the reward box, like what rsbot has. add it to the players options maybe?

Coh3n

2011-05-22 02:22:10

From: bolshak25
i suggest choosing what you want from the reward box, like what rsbot has. add it to the players options maybe?

I already have that planned for the new form, but in the meantime you can edit the code to choose what you like. It can be edited on line 308 of RunMe.simba if you wish.

bolshak25

2011-05-22 10:08:31

thanks

e: so if i want defence xp, would i put 'defence'? or would i have to put 'xp' then put defence somewhere else?

Coh3n

2011-05-22 10:49:26

From: bolshak25
thanks

e: so if i want defence xp, would i put 'defence'? or would i have to put 'xp' then put defence somewhere else?

You'd have to put 'xp', and I don't think MSI sets the lamp skill, so you'd have to add that yourself. Right below where you entered the xp, add this line:

LampSkill := 'Defence';
Should work for you then. Also, the LampSkill is already added to the new form so you'll be able to choose for each player.

Dan Cardin

2011-05-22 21:55:40

new form?

Coh3n

2011-05-22 21:59:37

From: Dan Cardin
new form?

Yeah. We've kind of been planning a new form for several reasons. There hasn't been a lot of development on it yet, but if you're curious you can find it here.

Dgby714

2011-05-22 23:18:17

From: Coh3n
Yeah. We've kind of been planning a new form for several reasons. There hasn't been a lot of development on it yet, but if you're curious you can find it here.


You don't need to split Form initialization and ShowModal into diffrent functions.

You also wanna do anything to do with Forms inside of a ThreadSafeCall.
Like Free'ing a TForm should be in one.

Coh3n

2011-05-22 23:32:10

From: Dgby714
You don't need to split Form initialization and ShowModal into diffrent functions.

You also wanna do anything to do with Forms inside of a ThreadSafeCall.
Like Free'ing a TForm should be in one.

Okay. I just used a template I had; I don't remember where I got it from. And aren't Form_Init and Form_ShowModel already in ThreadSafeCalls?

Dgby714

2011-05-23 00:45:04

From: Coh3n
Okay. I just used a template I had; I don't remember where I got it from. And aren't Form_Init and Form_ShowModel already in ThreadSafeCalls?


I was looking at v2 and your Free isn't in ThreadSafeCall.

Nava2

2011-05-23 01:47:58

With the git repos, why not just use a branch inside the regular MSI?

Coh3n

2011-05-23 10:54:25

From: Dgby714
I was looking at v2 and your Free isn't in ThreadSafeCall.

Oh right. Okay I did that, but had to make two more procedures, unless there's another way. Also, what exactly does ThreadSafeCall do, and why'd it needed?

E: Does this look better?

// rest of the init procedure here
OnKeyPress := @PreventTyping;
end;

for i := 0 to High(Buttons) do
with Buttons[i] do
begin
Height := 25;
Font.Style := [fsItalic];
ShowHint := True;
end;

Forms[FORM_MAIN].ShowModal;
end;

procedure Form_SafeInit;
var
v: TVariantArray;
begin
SetArrayLength(v, 0);
ThreadSafeCall('Form_Init', v);
end;

procedure Form_Free();
begin
Forms[FORM_MAIN].Free();
end;

procedure Form_SafeFree();
var
v: TVariantArray;
begin
SetArrayLength(v, 0);
ThreadSafeCall('Form_Free', v);
end;

var
i: Integer;
begin
ClearDebug();

try
Form_SafeInit;
except
Writeln(ExceptionToString(ExceptionType, ExceptionParam));
finally
Form_SafeFree();
end;

if (MSI_Ready) then
Writeln('MSI is ready!');
end.

From: Nava2
With the git repos, why not just use a branch inside the regular MSI?

No reason. I'd run in to less hassle keeping it separate until it needs to be added to MSI.

Nava2

2011-05-23 11:59:54

From: Coh3n
No reason. I'd run in to less hassle keeping it separate until it needs to be added to MSI.


Actually its about the same haha, if you do your branches properly its actually easier. :)

Dan Cardin

2011-05-23 15:28:25

reasons like? Just wondering. Tbh unless you're doing something very simple, or using most of the original code. Then I don't see the need. Then again i havent worked on the form in a while and i know that there was some unfinished business. But i would think that fixing that would be easier than rewriting.

Coh3n

2011-05-23 15:47:58

From: Dan Cardin
reasons like? Just wondering. Tbh unless you're doing something very simple, or using most of the original code. Then I don't see the need. Then again i havent worked on the form in a while and i know that there was some unfinished business. But i would think that fixing that would be easier than rewriting.

The biggest reason was expandability. There's no way we can expand the current form because it's based around the sizes of the bitmaps. Having standard form components we can easily add things when necessary without having to add a new button or create new images: just simply increase/decrease some sizes. No, it doesn't look as cool, but it will be much more user-friendly, will have better features (there's already the option to save/load multiple files using TSave/LoadDialogs). Not to mention we can always change the component's colors to make it look more "RS-like".

Believe me, this wasn't my first choice. I spent hours and hours getting the current form to work. I am, however, going to reuse a lot of the code such as the player saving and loading. I also wanted it to be easier to understand code-wise. I'm not sure if I've accomplished that yet, but I feel like it's easier to read.

Dan Cardin

2011-05-23 22:18:30

i just feel like we went about making the bitmaps wrong. Should have made it like web-devs make websites. 1 pixel wide strips that repeat over and over (could be wider). It would make it possible to have any size, and shouldnt have any effect on speed except for possibly some ms in loading. Then Similarly with the tabs, have the tab images and such, but without the text and draw the text in-code.

Coh3n

2011-05-23 22:33:04

From: Dan Cardin
i just feel like we went about making the bitmaps wrong. Should have made it like web-devs make websites. 1 pixel wide strips that repeat over and over (could be wider). It would make it possible to have any size, and shouldnt have any effect on speed except for possibly some ms in loading. Then Similarly with the tabs, have the tab images and such, but without the text and draw the text in-code.

You're right, that would have made it expandable, but I feel that would be overdoing it simply for the looks. I would much rather have a form that works great and that's extremely user-friendly than one that looks good. I'm hoping to capture a little of both in the new form.

Dgby714

2011-05-23 22:36:41

From: Coh3n
Oh right. Okay I did that, but had to make two more procedures, unless there's another way. Also, what exactly does ThreadSafeCall do, and why'd it needed?

E: Does this look better?

// rest of the init procedure here
OnKeyPress := @PreventTyping;
end;

for i := 0 to High(Buttons) do
with Buttons[i] do
begin
Height := 25;
Font.Style := [fsItalic];
ShowHint := True;
end;

Forms[FORM_MAIN].ShowModal;
end;

procedure Form_SafeInit;
var
v: TVariantArray;
begin
SetArrayLength(v, 0);
ThreadSafeCall('Form_Init', v);
end;

procedure Form_Free();
begin
Forms[FORM_MAIN].Free();
end;

procedure Form_SafeFree();
var
v: TVariantArray;
begin
SetArrayLength(v, 0);
ThreadSafeCall('Form_Free', v);
end;

var
i: Integer;
begin
ClearDebug();

try
Form_SafeInit;
except
Writeln(ExceptionToString(ExceptionType, ExceptionParam));
finally
Form_SafeFree();
end;

if (MSI_Ready) then
Writeln('MSI is ready!');
end.


No reason. I'd run in to less hassle keeping it separate until it needs to be added to MSI.


You did it right and if you wanna use less just do a

procedure CallSafe(s: string);
var
V: TVariantArray;
begin
ThreadSafeCall(s, V);
end;

Then use that.

ThreadSafeCall
function ThreadSafeCall(ProcName: string; var V: TVariantArray): Variant; extdecl;
begin
if GetCurrentThreadId = MainThreadID then
begin
with TPSThread(currthread).PSScript do
Result := Exec.RunProcPVar(V,Exec.GetProc(Procname));
end else
begin
CurrThread.SyncInfo^.MethodName:= ProcName;
CurrThread.SyncInfo^.V:= @V;
CurrThread.SyncInfo^.OldThread := CurrThread;
CurrThread.SyncInfo^.Res := @Result;
CurrThread.Synchronize(CurrThread.SyncInfo^.SyncMethod);
end;
end;

Coh3n

2011-05-23 22:47:01

Ah okay thanks, and I thought PS didn't support multiple threads, so wouldn't the current thread always be the main thread? Or am I just misunderstanding it?

Dgby714

2011-05-24 00:02:53

From: Coh3n
Ah okay thanks, and I thought PS didn't support multiple threads, so wouldn't the current thread always be the main thread? Or am I just misunderstanding it?


PascalScript may not support multiple threads but FreePascal does.

Coh3n

2011-05-24 00:06:15

From: Dgby714
PascalScript may not support multiple threads but FreePascal does.

In that case, I feel like ThreadSafeCall would be useless when used in PS, and since Simba uses PS as the interpreter, useless in this situation.

Dgby714

2011-05-24 00:27:25

From: Coh3n
In that case, I feel like ThreadSafeCall would be useless when used in PS, and since Simba uses PS as the interpreter, useless in this situation.


FreePascal is what Simba is coded in.

Your script runs in its own thread, ThreadSafeCall does the function in the main thread.

Forms and stuff have to be done in the Main Thread.

Coh3n

2011-05-24 00:31:48

From: Dgby714
FreePascal is what Simba is coded in.

Your script runs in its own thread, ThreadSafeCall does the function in the main thread.

Forms and stuff have to be done in the Main Thread.

Oh right right right. Makes sense. :p

Thanks. :)

E: Marking this as resolved as there's development for MSI Form V2.

divad82

2011-11-25 00:22:06

after the update
MSI cant run…
[Error] C:\Simba\Includes\sps/sps.simba(34:17): Unknown type 'T4DIntegerArray' at line 33
Compiling failed.

Coh3n

2011-11-25 00:26:16

You need sps.dll in Simba/Plugins.

divad82

2011-11-25 00:33:19

From: Coh3n
You need sps.dll in Simba/Plugins.


i get sps.dll in Simba/Plugins
but still cant run…

just after the last update of srl and msi
the others without the update can still run MSI

Coh3n

2011-11-25 00:35:58

You need the latest version of SPS as well, otherwise the new MSI won't work. That should update automatically though. Also be sure to restart Simba after updating.

divad82

2011-11-25 00:39:42

i restart Simba and checked all for update
but still…

Thank you for using Simba,
Hakuna Matata

No Plugins update available.
No SPS update available.
No SRL update available.
No MSI update available.
Running MSI…
[Error] C:\Simba\Includes\sps/sps.simba(34:17): Unknown type 'T4DIntegerArray' at line 33
Compiling failed.

Running MSI…
[Hint] D:\Simba-5\Includes\MSI/MSI/Core/Locations.simba(1576:3): Variable 'AREATPA' never used at line 1575
[Error] D:\Simba-5\Includes\MSI/MSI/Core/Scripts.simba(1560:46): Unknown identifier 'RUNECRAFTING_ALTARS' at line 1559
Compiling failed.

can't fix …

Coh3n

2011-11-25 01:58:40

From: divad82
i restart Simba and checked all for update
but still…

Thank you for using Simba,
Hakuna Matata

No Plugins update available.
No SPS update available.
No SRL update available.
No MSI update available.
Running MSI…
[Error] C:\Simba\Includes\sps/sps.simba(34:17): Unknown type 'T4DIntegerArray' at line 33
Compiling failed.
There are only 2 possible reasons that would happen.
  1. You don't have your SPS plugin in Simba/Plugins.
  2. You don't load the SPS library. - This is done automatically in sps.simba.
So, you either don't have the plugin, or your SPS is horribly outdated.

Try this http://villavu.com/forum/showpost.php?p=849159&postcount=253.

E: Please try not to double post, that's what the edit button is for. ;)

divad82

2011-11-25 02:23:18

i will have a try
ty for ur patience

wtfje

2011-11-25 05:59:34

Mmmm, since i've updated MSI i've got the same prob. as david. I'll try to find a solution

SOLVED!

just follow the steps of Coh3n last post! Thx again!

Coh3n

2011-11-26 02:10:14

The SPS updater should now be working. :) Sorry for the delay.

divad82

2011-11-29 22:59:38

after the update.
can't open the bank.
just do right click but don't chose and left click and get stuck.