SRL Archive - MSI Suggestions

way to set user active during runtime


Shuttleu

2010-07-21 07:45:43

i was thinking maybe we could add a way to set a user true during runtime

so for example:

a user has a problem finding its way to where its ment to go, so it logs out and sets the user to false
you can then log into RS and sort it out then by using another script you can set the user to true and set its location
therefore you can get nice long progress reports

i was thinking maybe using ini files or something

thoughts

~shut

EDIT: maybe it can make an ini file then after one minute it will delete it, MSI will then check for this ini file every 45 seconds and if it finds this file then it will make the changes accordingly

EDiT: this is what i have come up with
program new;

{$i SRL/SRL/MSI/Globals.scar}

type
ThePlayerInfo = record
Active: Boolean;
PlayerNumber, Location: Integer;
end;

var
ThePlayersInfo: array of ThePlayerInfo;
i: Integer;

procedure DeclareNewPlayerInfo;
var
HowManyPlayers: Integer;
begin
HowManyPlayers:= 1;
SetArrayLength(ThePlayersInfo, HowManyPlayers);

with ThePlayersInfo[0] do
begin
PlayerNumber := 0;
Active := True;
Location := LOC_PS_DBOX;
end;
end;

begin
DeclareNewPlayerInfo;
WriteINI('Active', 'Active', 'True', IncludePath+'SRL\SRL\MSI\Player.INI');
for i:=0 to High(ThePlayersInfo) do
begin
WriteINI(IntToStr(ThePlayersInfo[i].PlayerNumber), 'Active', BoolToStr(ThePlayersInfo[i].Active), IncludePath+'SRL\SRL\MSI\Player.INI');
WriteINI(IntToStr(ThePlayersInfo[i].PlayerNumber), 'Location', IntToStr(ThePlayersInfo[i].Location), IncludePath+'SRL\SRL\MSI\Player.INI');
end;
Wait(60*1000);
for i:=0 to High(ThePlayersInfo) do
begin
DeleteINI(IntToStr(ThePlayersInfo[i].PlayerNumber), 'Active', BoolToStr(ThePlayersInfo[i].Active), IncludePath+'SRL\SRL\MSI\Player.INI');
DeleteINI(IntToStr(ThePlayersInfo[i].PlayerNumber), 'Location', IntToStr(ThePlayersInfo[i].Location), IncludePath+'SRL\SRL\MSI\Player.INI');
end;
WriteINI('Active', 'Active', 'False', IncludePath+'SRL\SRL\MSI\Player.INI');
end.
and this would go somewhere in MSI
procedure RemoteSet;
var
i: Integer;
begin
if FileExists(IncludePath+'SRL\SRL\MSI\Player.INI') then
if StrToBool(ReadINI('Active', 'Active', IncludePath+'SRL\SRL\MSI\Player.INI')) then
for i:=0 to High(MSI_Players) do
if (Length(ReadIni(IntToStr(i), 'Active', IncludePath+'SRL\SRL\MSI\Player.INI'))>0) then
begin
Players[i].Active:= StrToBool(ReadIni(IntToStr(i), 'Active', IncludePath+'SRL\SRL\MSI\Player.INI'));
MSI_Players[i].Active:= StrToBool(ReadIni(IntToStr(i), 'Active', IncludePath+'SRL\SRL\MSI\Player.INI'));
MSI_Players[i].Location:= StrToInt(ReadIni(IntToStr(i), 'Location', IncludePath+'SRL\SRL\MSI\Player.INI'));
end;
//SetTimeout(45, 'RemoteSet');
end;

Frement

2010-07-21 07:54:30

Or maybe a MSI control panel website? Just like how the current temp SRL stats work.

Shuttleu

2010-07-21 08:17:11

i have this, which i will also put in the first post
procedure RemoteSet;
var
i: Integer;
begin
if FileExists(IncludePath+'SRL\SRL\MSI\Player.INI') then
for i:=0 to High(MSI_Players) do
if (Length(ReadIni(IntToStr(i), 'Active', IncludePath+'SRL\SRL\MSI\Player.INI'))>0) then
begin
Players[i].Active:= StrToBool(ReadIni(IntToStr(i), 'Active', IncludePath+'SRL\SRL\MSI\Player.INI'));
MSI_Players[i].Active:= StrToBool(ReadIni(IntToStr(i), 'Active', IncludePath+'SRL\SRL\MSI\Player.INI'));
MSI_Players[i].Location:= StrToInt(ReadIni(IntToStr(i), 'Location', IncludePath+'SRL\SRL\MSI\Player.INI'));
end;
SetTimeout(45, 'RemoteSet');
end;

~shut

Sir R. M8gic1an

2010-07-21 08:27:59

There are countless ways to do this. I guess I hadn't yet thought of an ini.

MSI does connect to SRL Stats, therefore you can just use that.

You can also build a local control. In some of my older scripts I would just use the F Keys to control the script.

~RM

Shuttleu

2010-07-21 08:35:30

From: Rasta Magician
There are countless ways to do this. I guess I hadn't yet thought of an ini.

MSI does connect to SRL Stats, therefore you can just use that.

You can also build a local control. In some of my older scripts I would just use the F Keys to control the script.

~RM
IsFKeyDown doesnt exist in Simba :(

anyway i have this which would work with the above
program new;

{$i SRL/SRL/MSI/Globals.scar}

type
ThePlayerInfo = record
Active: Boolean;
PlayerNumber, Location: Integer;
end;

var
ThePlayersInfo: array of ThePlayerInfo;
i: Integer;

procedure DeclareNewPlayerInfo;
var
HowManyPlayers: Integer;
begin
HowManyPlayers:= 1;
SetArrayLength(ThePlayersInfo, HowManyPlayers);

with ThePlayersInfo[0] do
begin
PlayerNumber := 0;
Active := True;
Location := LOC_PS_DBOX;
end;
end;

begin
for i:=0 to High(ThePlayersInfo) do
begin
writeini(IntToStr(ThePlayersInfo[i].PlayerNumber), 'Active', BoolToStr(ThePlayersInfo[i].Active), IncludePath+'SRL\SRL\MSI\Player.INI');
writeini(IntToStr(ThePlayersInfo[i].PlayerNumber), 'Location', IntToStr(ThePlayersInfo[i].Location), IncludePath+'SRL\SRL\MSI\Player.INI');
end;
Wait(60*1000);
//DeleteFile(IncludePath+'SRL\SRL\MSI\Player.INI');
end.

the only problem is that there is no way to delete the ini file afterwards

~shut

Sir R. M8gic1an

2010-07-21 08:38:29

Meh. Just have an ini with a version.

If version script has < Ini version then properly read the ini.

~RM

Shuttleu

2010-07-21 08:45:16

From: Rasta Magician
Meh. Just have an ini with a version.

If version script has < Ini version then properly read the ini.

~RM

i think i know what you mean, well how about that (updated first post)

~shut

Coh3n

2010-07-21 10:00:06

Definitely worth adding. SRL's stats system can already do this via the stats webiste, although it doesn't work with MSI because we don't use SRL's Players array. However, I think it can be altered slightly to work with the stats.

We already use Players.Active for NextPlayer and such so we may just be able to check if the Player's status has changed. Or just set MSI_Players.Active as all the player information is updated on the stats server every time we call MSI_SendStats.

Something like this in the mainloop may work:

for i := 0 to High(MSI_Players) do
MSI_Players[i].Active := Players[i].Active;
That way if Players.Active was updated via the stats site, MSI_Players will also update, setting the player active. Another issue, however, is location. The stats system updates using Players.Loc which is a string. So, we may need a function (MSI_LocToConst) to convert the string to the proper const.

for i := 0 to High(Players)
begin
MSI_Players[i].Active := Players[i].Active;
MSI_Players[i].Location := MSI_LocToConst(Players[i].Loc);
end;
I'm not 100% sure if that would work, but it makes sense.

Shut, not that I don't like your INI idea, because I do and it will work nicely. There just may be a way we can utilize the stats feature.

Nice work nonetheless. :)

3Garrett3

2010-07-21 14:20:41

From: Shuttleu
IsFKeyDown doesnt exist in Simba :(



Yes it does? I posted about it a month ago and one of the devs (forget who now) said they fixed it.

Shuttleu

2010-07-21 14:56:42

From: 3Garrett3
Yes it does? I posted about it a month ago and one of the devs (forget who now) said they fixed it.


try to compile this in simba
program new;
begin
if IsFKeyDown(12) then
Writeln('F12 is pressed');
end.

~shut

EDIT: well i was just about to add it to my MSI to use for now and it seems that SetTimeout doesnt exist in Simba either :(

Heavenzeyez1

2010-07-21 15:04:40

From: Shuttleu
try to compile this in simba
program new;
begin
if IsFKeyDown(12) then
Writeln('F12 is pressed');
end.

~shut

EDIT: well i was just about to add it to my MSI to use for now and it seems that SetTimeout doesnt exist in Simba either :(


Try to compile this:
program new;
{.include srl/srl.scar}
begin
if IsFKeyDown(12) then
Writeln('F12 is pressed');
end.
~Eerik.

Shuttleu

2010-07-21 15:07:10

From: Heavenzeyez1
Try to compile this:
program new;
{.include srl/srl.scar}
begin
if IsFKeyDown(12) then
Writeln('F12 is pressed');
end.
~Eerik.

well what is it doing in SRL for!

:fiery:

~shut

EDIT: well until a way has been added i have added my ini version in my MSI for now :)

Wanted

2010-07-21 15:18:19

This is built into the stats system aswell as RC Master (though I doubt rc works)

Coh3n

2010-07-21 16:40:44

From: Shuttleu
EDIT: well until a way has been added i have added my ini version in my MSI for now :)

And it's working well?

E: Just looked through it, and you wouldn't need the PlayerNumber attribute as you can just use the index of the Players array. It looks good though, I can't decide if I would rather have it use the stats system's updating or yours. Right now I'm leaning towards yours, but I'd like to see some other people's opinions.

Shuttleu

2010-07-21 16:44:48

yep :)

~shut

Coh3n

2010-07-21 16:57:03

From: Shuttleu
yep :)

~shut

When you update the player's location in the INI file, you have to actually put the location's integer rather than the constant don't you?

Shuttleu

2010-07-21 16:58:22

From: Coh3n
When you update the player's location in the INI file, you have to actually put the location's integer rather than the constant don't you?

well in the script the user fills in it will be the constant, but a integer will be in the ini

~shut

EDIT: just to let you know im having to hold down F12 because SetTimeout doesnt exist and i cant get TTimers to work in Simba

Coh3n

2010-07-21 17:07:17

From: Shuttleu
well in the script the user fills in it will be the constant, but a integer will be in the ini

~shut

EDIT: just to let you know im having to hold down F12 because SetTimeout doesnt exist and i cant get TTimers to work in Simba

Oh, you're actually running that script. I thought it was integrated into Simba so it would update automatically when you edited the INI file.

And I don't know what you're doing with F12? Why do you need a TTimer anyway?

Shuttleu

2010-07-21 19:16:19

well the way i was going to do it was to get it to run every 45 seconds using SetTimeout, but that doesnt work, so i got told to use a TTimer, but that also doesnt work in simba :(

you run the first script and what and put the second one in somewhere it will get called often (such as a main loop or something?), at the mo i have put it in Walking_Reflection.scar and it runs the procedure everytime MSI_WalkToTile is called, i will try to find a better plce for it but for now im not too bothered because it works fine for me :)

~shut

Coh3n

2010-07-21 21:14:27

From: Shuttleu
well the way i was going to do it was to get it to run every 45 seconds using SetTimeout, but that doesnt work, so i got told to use a TTimer, but that also doesnt work in simba :(

you run the first script and what and put the second one in somewhere it will get called often (such as a main loop or something?), at the mo i have put it in Walking_Reflection.scar and it runs the procedure everytime MSI_WalkToTile is called, i will try to find a better plce for it but for now im not too bothered because it works fine for me :)

~shut

I've never used a TTimer, so I don't know how they work exactly, but I'm glad to see it's working for you. :)

I've talked it over with NCDS a little, and we both think it would be better to use a keyboard system where all you have to do is, for example, press F1 and Player 1's status and location will pop up in a window where you can reset that player (after manually resetting them in-game of course). This would be easier for the user especially, and it wouldn't require running another script as it would all be built into the MSI core.

We would still call it in all the major loops (walking, banking, object finding, etc.) so that no matter when the user presses the button, it will work.

Does anyone disagree?

Oh, shut, I wasn't trying to put down your work at all. If it wasn't for you, we probably wouldn't have ever thought of this idea. ;)

Shuttleu

2010-07-22 04:24:32

From: Coh3n
I've never used a TTimer, so I don't know how they work exactly, but I'm glad to see it's working for you. :)

I've talked it over with NCDS a little, and we both think it would be better to use a keyboard system where all you have to do is, for example, press F1 and Player 1's status and location will pop up in a window where you can reset that player (after manually resetting them in-game of course). This would be easier for the user especially, and it wouldn't require running another script as it would all be built into the MSI core.

We would still call it in all the major loops (walking, banking, object finding, etc.) so that no matter when the user presses the button, it will work.

Does anyone disagree?

Oh, shut, I wasn't trying to put down your work at all. If it wasn't for you, we probably wouldn't have ever thought of this idea. ;)

no that sounds great, i will get to work on that if you want?

~shut

EDIT: maybe they can press F1 and it will popup, then it will have tabs for each player, then they can choose which player they want to rest, where it is, plus they can also change the script, the only problem i can think of is the objects, because it is an array

Coh3n

2010-07-22 06:09:42

From: Shuttleu
no that sounds great, i will get to work on that if you want?

~shut

EDIT: maybe they can press F1 and it will popup, then it will have tabs for each player, then they can choose which player they want to rest, where it is, plus they can also change the script, the only problem i can think of is the objects, because it is an array

I like the tab idea, that way we won't run out of F# buttons if there's more than 12 players. :p You mean basically reset the entire DeclarePlayers? Interesting thought, but yeah I'm not sure how it would work.

And yes, go ahead and start working on it if you wish. :)

Shuttleu

2010-07-22 07:00:46

From: Coh3n
I like the tab idea, that way we won't run out of F# buttons if there's more than 12 players. :p You mean basically reset the entire DeclarePlayers? Interesting thought, but yeah I'm not sure how it would work.

And yes, go ahead and start working on it if you wish. :)


Well I'm in starbucks at the mo with a coffe. But when I get home I will start on it and let you know how it goes

~shut

EDIT: got the basic bit done, just have to add the loading and setting of the vars

Sir R. M8gic1an

2010-07-22 11:49:50

if you're going to use the stats system, remember to also update the player array from the msi array before sending the stats ;)

~RM

NCDS

2010-07-22 12:18:54

From: Rasta Magician
if you're going to use the stats system, remember to also update the player array from the msi array before sending the stats ;)

~RM


Were going to use F# button to bring up a form to reset the players, similar to how you allow people to talk in your guild miner. That was my inspiration :p

Shuttleu

2010-07-22 12:23:57

ok its done, it ugly but its done, i will upload in a little while (my mum wants me to do something :()

~shut

Sir R. M8gic1an

2010-07-22 12:29:57

Sounds good.

You could also implement using the stats system, as one allows local access, while the other allows remote access ;)

~RM

Shuttleu

2010-07-22 12:46:02

From: Rasta Magician
Sounds good.

You could also implement using the stats system, as one allows local access, while the other allows remote access ;)

~RM

well at the mo im just working on the local side, i think coh3n might be working on the remote side

~shut

Shuttleu

2010-07-22 12:57:52

here is the form, like i said its ugly but it works (from what i can tell it works :p)

the first one is so you can test it and have a look at it
the second one it everything you need to add to MSI
the third one is the same as the first one but for people still using scar -_-'

~shut

EDIT: i made this in scar because Simba doesn't have a form editor in it :(

EDIT: i have made it so it doesnt set the vars unless something has been changed in the form, which means that not all the players will be reset

Coh3n

2010-07-22 18:54:25

From: Shuttleu
well at the mo im just working on the local side, i think coh3n might be working on the remote side

~shut

I just posted my suggestion on the last page. :p To be honest, I'm not sure we need to use the stats remote feature if we have out own. There's not need. We don't even use it now because out locations are integer constants instead of strings.

From: Shuttleu
here is the form, like i said its ugly but it works (from what i can tell it works :p)

the first one is so you can test it and have a look at it
the second one it everything you need to add to MSI
the third one is the same as the first one but for people still using scar -_-'

~shut

EDIT: i made this in scar because Simba doesn't have a form editor in it :(

EDIT: i have made it so it doesnt set the vars unless something has been changed in the form, which means that not all the players will be reset

Wow nice work. :) Have you tested?

Shuttleu

2010-07-22 19:55:45

From: Coh3n
I just posted my suggestion on the last page. :p To be honest, I'm not sure we need to use the stats remote feature if we have out own. There's not need. We don't even use it now because out locations are integer constants instead of strings.


Wow nice work. :) Have you tested?


yes and it works beautifully, the only problem i did find is that when i put it in the script, it wouldn't recognize that i had pressed F1, so i left the "if IsFKeyDown(1) then" out, which meant it popped up every load because i stick it at the end of the main loop

but it did work, and very well

~shut

Coh3n

2010-07-22 20:08:13

From: Shuttleu
yes and it works beautifully, the only problem i did find is that when i put it in the script, it wouldn't recognize that i had pressed F1, so i left the "if IsFKeyDown(1) then" out, which meant it popped up every load because i stick it at the end of the main loop

but it did work, and very well

~shut

Maybe you didn't call it enough?

Shuttleu

2010-07-22 20:10:08

From: Coh3n
Maybe you didn't call it enough?


i was holding my finger down one whole loop through… :/
i even made it so it would run every time it walked, but it still didnt work, but as soon as i took the IsFKeyDown out it worked fine

~shut

Coh3n

2010-07-22 20:10:52

From: Shuttleu
i was holding my finger down one whole loop through… :/
i even made it so it would run every time it walked, but it still didnt work, but as soon as i took the IsFKeyDown out it worked fine

~shut

But it would only come up after the load?

Shuttleu

2010-07-22 20:22:07

From: Coh3n
But it would only come up after the load?


well when i dotted it around everywhere it was popping up all the time when i took it out, but before i took it out it would never pop up

when i say it, i mean IsFKeyDown

~shut

Coh3n

2010-07-22 22:58:06

From: Shuttleu
well when i dotted it around everywhere it was popping up all the time when i took it out, but before i took it out it would never pop up

when i say it, i mean IsFKeyDown

~shut

I didn't understand that at all. :o

nickrules

2010-07-22 23:21:36

I like it. Lol, It doesn't matter if its 'ugly', if it works. It can always be beautified later :P

As for you FKey problem, (haven't really looked through your code), but you could make a function to check if its down, and then make the form pop up? or keep the form always up? (can that even be done?)

Shuttleu

2010-07-23 02:23:35

From: Coh3n
I didn't understand that at all. :o

when i had the "if IsFKeyDown(1) then" it would never pop up, but if i removed the "if IsFKeyDown(1) then" then it was constantly poping up because i placed it in so many places
From: nickrules
I like it. Lol, It doesn't matter if its 'ugly', if it works. It can always be beautified later :P

As for you FKey problem, (haven't really looked through your code), but you could make a function to check if its down, and then make the form pop up? or keep the form always up? (can that even be done?)

checking if the F key was down is how i was doing it

no you cant, scripts pause when you open a form

~shut

Shuttleu

2010-07-23 03:38:46

updated for the new script which was added yesterday, i also reamed the functions and procedures so it matched the rest of the MSI naming

once again, the same as last time
MSI Form SCAR is for people who want to test it in scar
MSI Form Simba is for people who want to test it in simba
Add to MSI Form includes all the functions and procedures that are needed to be added to MSI for it to run

~shut

Sir R. M8gic1an

2010-07-23 04:49:45

I'd suggest calling the form from MSI_Randoms.

MSI_Randoms should be called often enough that the form will pop up sooner rather than later. I also checked out the form, and I liked it a lot :p

~RM

3Garrett3

2010-07-23 14:20:32

The problem is in Simba I believe with the FKey. A lot of them are shortcuts for stuff, so you have to find one that isn't. I remember doing that with SCAR before, and it seemed to help..

Shuttleu

2010-07-23 15:19:48

From: Rasta Magician
I'd suggest calling the form from MSI_Randoms.

MSI_Randoms should be called often enough that the form will pop up sooner rather than later. I also checked out the form, and I liked it a lot :p

~RM


wow! thanks! that means a lot to me coming from you, it really does
thank you

~shut

Coh3n

2010-07-31 13:33:05

Not sure if you'll like this, but…

program New;

{$i srl/srl.scar}

const
aHowManyPlayers = 6;


SCRIPT_VE_TREES = 0;
SCRIPT_VE_OAKS = 1;
SCRIPT_POWER_CHOP = 2;
SCRIPT_GE_YEWS = 3;
SCRIPT_DB_WILLOWS = 4;
SCRIPT_RM_YEWS = 5;
SCRIPT_PS_WILLOWS = 6;

SCRIPT_POWER_MINE = 7;
SCRIPT_VE_MINER = 8;


LOC_POWER_SKILL = 0;
LOC_LOST = 1;
LOC_VE_TREES = 2;
LOC_VE_OAKS = 3;
LOC_VE_BANK = 4;
LOC_VE_MINE = 5;
LOC_GE_BANK = 6;
LOC_GE_YEWS = 7;
LOC_DB_BANK = 8;
LOC_DB_WILLOWS = 9;
LOC_RM_YEWS = 10;
LOC_FE_BANK = 11;
LOC_PS_WILLOWS = 12;
LOC_PS_DBOX = 13;

type
Playerss = record
Scripts : array of Integer;
Location : Integer;
Active : Boolean;
end;

type
Playersss = record
Active : Boolean;
end;


var
MSI_Players: array of Playerss;
aPlayers: array of Playersss;
x: Integer;

VarPageControl : TPageControl;
TabPages : array of TTabSheet;
frmDesign : TForm;
ActiveLabel : array of TLabel;
ScriptLabel : array of TLabel;
LocationLabel : array of TLabel;
ActiveBox : array of TCheckBox;
Script : array of TComboBox;
Location : array of TComboBox;
Done : array of TButton;
Cancel : array of TButton;

procedure SetupPlayers;
begin
SetArrayLength(MSI_Players, aHowManyPlayers);
SetArrayLength(aPlayers, aHowManyPlayers);

with MSI_Players[0] do
begin
Active:= True;
Location:= LOC_PS_DBOX;
Scripts:= [SCRIPT_PS_WILLOWS];
end;

with MSI_Players[1] do
begin
Active:= True;
Location:= LOC_PS_DBOX;
Scripts:= [SCRIPT_PS_WILLOWS];
end;

with MSI_Players[2] do
begin
Active:= True;
Location:= LOC_PS_DBOX;
Scripts:= [SCRIPT_PS_WILLOWS];
end;

with MSI_Players[3] do
begin
Active:= True;
Location:= LOC_PS_DBOX;
Scripts:= [SCRIPT_PS_WILLOWS];
end;

with MSI_Players[4] do
begin
Active:= True;
Location:= LOC_PS_DBOX;
Scripts:= [SCRIPT_PS_WILLOWS];
end;

with MSI_Players[5] do
begin
Active:= True;
Location:= LOC_PS_DBOX;
Scripts:= [SCRIPT_PS_WILLOWS];
end;
{
with MSI_Players[6] do
begin
Active:= True;
Location:= LOC_PS_DBOX;
Scripts:= [SCRIPT_PS_WILLOWS];
end;

with MSI_Players[7] do
begin
Active:= True;
Location:= LOC_PS_DBOX;
Scripts:= [SCRIPT_PS_WILLOWS];
end;

with MSI_Players[8] do
begin
Active:= True;
Location:= LOC_PS_DBOX;
Scripts:= [SCRIPT_PS_WILLOWS];
end;

with MSI_Players[9] do
begin
Active:= True;
Location:= LOC_PS_DBOX;
Scripts:= [SCRIPT_PS_WILLOWS];
end;

with MSI_Players[10] do
begin
Active:= True;
Location:= LOC_PS_DBOX;
Scripts:= [SCRIPT_PS_WILLOWS];
end;

with MSI_Players[11] do
begin
Active:= True;
Location:= LOC_PS_DBOX;
Scripts:= [SCRIPT_PS_WILLOWS];
end;

with MSI_Players[12] do
begin
Active:= True;
Location:= LOC_PS_DBOX;
Scripts:= [SCRIPT_PS_WILLOWS];
end;
}
end;

function MSI_StringToVar(TheString: string; Location: Boolean): Integer;
begin
case Location of
True: begin
case TheString of
'Power skilling': Result := LOC_POWER_SKILL;

'Varrock east bank': Result := LOC_VE_BANK;

'Varrock east trees': Result := LOC_VE_TREES;

'Varrock east oaks': Result := LOC_VE_OAKS;

'Grand Exchange bank': Result := LOC_GE_BANK;

'Grand Exchange yews': Result := LOC_GE_YEWS;

'Draynor willows': Result := LOC_DB_WILLOWS;

'Draynor bank': Result := LOC_DB_BANK;

'Falador east bank': Result := LOC_FE_BANK;

'Rimmington yews': Result := LOC_RM_YEWS;

'Port Sarim willows': Result := LOC_PS_WILLOWS;

'Port Sarim deposit box': Result := LOC_PS_DBOX;

'Varrock east mines': Result := LOC_VE_MINE;
end;
end;
False: begin
case TheString of
'Varrock east trees': Result := SCRIPT_VE_TREES;

'Varrock east oaks': Result := SCRIPT_VE_OAKS;

'Powerchopper': Result := SCRIPT_POWER_CHOP;

'Grand Exchange yews': Result := SCRIPT_GE_YEWS;

'Draynor Willows': Result := SCRIPT_DB_WILLOWS;

'Rimmington Yews': Result := SCRIPT_RM_YEWS;

'Port Sarim Willows': Result := SCRIPT_PS_WILLOWS;

'Varrock east miner': Result := SCRIPT_VE_MINER;

'Powerminer': Result := SCRIPT_POWER_MINE;
end;
end;
end;
end;

function MSI_VarToString(TheVar: Integer; Location: Boolean): string;
begin
case Location of
True: begin
case TheVar of
LOC_POWER_SKILL: Result := 'Power skilling!';

LOC_VE_BANK: Result := 'Varrock east bank';

LOC_VE_TREES: Result := 'Varrock east trees';

LOC_VE_OAKS: Result := 'Varrock east oaks';

LOC_VE_MINE: Result := 'Varrock east mines';

LOC_GE_BANK: Result := 'Grand Exchange bank';

LOC_GE_YEWS: Result := 'Grand Exchange yews';

LOC_DB_WILLOWS: Result := 'Draynor willows';

LOC_DB_BANK: Result := 'Draynor bank';

LOC_FE_BANK: Result := 'Falador east bank';

LOC_RM_YEWS: Result := 'Rimmington yews';

LOC_PS_WILLOWS: Result := 'Port Sarim willows';

LOC_PS_DBOX: Result := 'Port Sarim deposit box';
end;
end;
False: begin
case TheVar of
SCRIPT_VE_TREES: Result := 'Varrock east trees';

SCRIPT_VE_OAKS: Result := 'Varrock east oaks';

SCRIPT_POWER_CHOP: Result := 'Powerchopper';

SCRIPT_GE_YEWS: Result := 'Grand Exchange yews';

SCRIPT_DB_WILLOWS: Result := 'Draynor Willows';

SCRIPT_RM_YEWS: Result := 'Rimmington Yews';

SCRIPT_PS_WILLOWS: Result := 'Port Sarim Willows';

SCRIPT_POWER_MINE: Result := 'Powerminer';

SCRIPT_VE_MINER: Result := 'Varrock east miner';
end;
end;
end;
end;

procedure MSI_SetupVars;
begin
SetArrayLength(TabPages, Length(MSI_Players));
SetArrayLength(ActiveLabel, Length(MSI_Players));
SetArrayLength(ScriptLabel, Length(MSI_Players));
SetArrayLength(LocationLabel, Length(MSI_Players));
SetArrayLength(ActiveBox, Length(MSI_Players));
SetArrayLength(Script, Length(MSI_Players));
SetArrayLength(Location, Length(MSI_Players));
SetArrayLength(Done, Length(MSI_Players));
SetArrayLength(Cancel, Length(MSI_Players));
end;

Procedure MSI_CancelClick(Sender: TObject);
Begin
WriteLn('Canceling!');
frmDesign.ModalResult:= mrOk;
End;

Procedure MSI_SaveClick(Sender: TObject);
var
ActiveChanged, ScriptChanged, LocationChanged: Boolean;
i: Integer;
Begin
WriteLn('Saving!');
for i:=0 to High(MSI_Players) do
begin
ActiveChanged:= (not(ActiveBox[i].Checked = MSI_Players[i].Active));
ScriptChanged:= (not(Script[i].Text = MSI_VarToString(MSI_Players[i].Scripts[0], False)));
LocationChanged:= (not(Location[i].Text = MSI_VarToString(MSI_Players[i].Location, True)));
if ActiveChanged or ScriptChanged or LocationChanged then
begin
Writeln('Setting vars for player '+IntToStr(i));
MSI_Players[i].Active:= ActiveBox[i].Checked;
aPlayers[i].Active:= ActiveBox[i].Checked;
MSI_Players[i].Location:= MSI_StringToVar(Location[i].Text, True);
MSI_Players[i].Scripts:= [MSI_StringToVar(Script[i].Text, False)];
Writeln(MSI_Players[i].Active);
Writeln(aPlayers[i].Active);
Writeln(MSI_Players[i].Location);
Writeln(MSI_Players[i].Scripts);
end;
end;
frmDesign.ModalResult:= mrOk;
End;

procedure MSI_InitForm;
var
i: Integer;
begin
frmDesign := CreateForm;
with frmDesign do
begin
BorderStyle := bsSingle;
Left := 350;
Top := 150;
Width := 400;
Height := 118;
Caption := 'Change Players';
Color := clBtnFace;
Font.Color := clWindowText;
Font.Height := -11;
Font.Name := 'MS Sans Serif';
Font.Style := [];
PixelsPerInch := 96;
end;
VarPageControl := TPageControl.Create(frmDesign);
with VarPageControl do
begin
Parent := frmDesign;
Align := alClient
end;
for i := 0 to High(MSI_Players) do
begin
TabPages[i]:= TTabSheet.Create(frmDesign);
with TabPages[i] do
begin
Caption := 'Player ' + Inttostr(i);
PageControl := VarPageControl;
end;
end;
for i:=0 to High(MSI_Players) do
begin
ActiveLabel[i] := TLabel.Create(frmDesign);
with ActiveLabel[i] do
begin
Parent := TabPages[i];
Font.Style := [fsBold];
Left := 145;
Top := 10;
Width := 25;
Height := 15;
Caption := 'Active:';
end;
ScriptLabel[i] := TLabel.Create(frmDesign);
with ScriptLabel[i] do
begin
Parent := TabPages[i];
Font.Style := [fsBold];
Left := 145;
Top := 35;
Width := 30;
Height := 15;
Caption := 'Script:';
end;
LocationLabel[i] := TLabel.Create(frmDesign);
with LocationLabel[i] do
begin
Parent := TabPages[i];
Font.Style := [fsBold];
Left := 145;
Top := 60;
Width := 30;
Height := 15;
Caption := 'Location:';
end;
ActiveBox[i] := TCheckBox.Create(frmDesign);
with ActiveBox[i] do
begin
Parent := TabPages[i];
Left := 230;
Top := 8;
Width := 17;
Height := 16;
TabOrder := 8;
Checked := MSI_Players[i].Active;
end;
Script[i] := TComboBox.Create(frmDesign);
with Script[i] do
begin
Parent := TabPages[i];
Left := 230;
Top := 31;
Width := 145;
Height := 21;
ItemHeight := 13;
TabOrder := 9;
Text := MSI_VarToString(MSI_Players[i].Scripts[0], False);
with Items do
begin
Add('Varrock east trees');
Add('Varrock east oaks');
Add('Grand Exchange yews');
Add('Draynor Willows');
Add('Rimmington Yews');
Add('Port Sarim Willows');
Add('Powerchopper');
Add('Varrock east miner');
Add('Powerminer');
end;
end;
Location[i] := TComboBox.Create(frmDesign);
with Location[i] do
begin
Parent := TabPages[i];
Left := 230;
Top := 58;
Width := 145;
Height := 21;
ItemHeight := 13;
TabOrder := 10;
Text := MSI_VarToString(MSI_Players[i].Location, True);
with Items do
begin
Add('Varrock east bank');
Add('Varrock east trees');
Add('Varrock east oaks');
Add('Varrock east mines');
Add('Grand Exchange bank');
Add('Grand Exchange yews');
Add('Draynor willows');
Add('Draynor bank');
Add('Falador east bank');
Add('Rimmington yews');
Add('Port Sarim willows');
Add('Port Sarim deposit box');
Add('Power skilling');
end;
end;
Done[i] := TButton.Create(FrmDesign);
with Done[i] do
begin
Parent := TabPages[i];
Left := 15;
Top := 13;
Height := 25;
Width := 100;
Caption := 'Save';
OnClick := @MSI_SaveClick;
end;
Cancel[i] := TButton.Create(FrmDesign);
with Cancel[i] do
begin
Parent := TabPages[i];
Left := 15;
Top := 48;
Height := 25;
Width := 100;
Caption := 'Cancel';
OnClick := @MSI_CancelClick;
end;
end;
end;

procedure MSI_SafeInitForm;
var
v : TVariantArray;
begin
SetArrayLength(v, 0);
ThreadSafeCall('MSI_InitForm', v);
end;

procedure MSI_ShowInitFormModal;
begin
frmDesign.ShowModal;
end;

procedure MSI_SafeShowInitFormModal;
var
v : TVariantArray;
begin
SetArrayLength(v, 0);
ThreadSafeCall('MSI_ShowInitFormModal', v);
end;

procedure MSI_MainInitForm;
begin
MSI_SafeInitForm;
MSI_SafeShowInitFormModal;
FreeForm(frmDesign);
end;

procedure MSI_ChangePlayerInfo;
begin
begin
Writeln('Change Player Info');
MSI_SetupVars;
MSI_MainInitForm;
end;
end;

{
begin
SetupPlayers;
MSI_SetupVars;
ClearDebug;
for x:=0 to High(MSI_Players) do
Writeln('Player: '+IntToStr(x)+' Active: '+BoolToStr(MSI_Players[x].Active)+' Script: '+MSI_VarToString(MSI_Players[x].Scripts[0], False)+' Location: '+MSI_VarToString(MSI_Players[x].Location, True));
MSI_MainInitForm;
for x:=0 to High(MSI_Players) do
Writeln('Player: '+IntToStr(x)+' Active: '+BoolToStr(MSI_Players[x].Active)+' Script: '+MSI_VarToString(MSI_Players[x].Scripts[0], False)+' Location: '+MSI_VarToString(MSI_Players[x].Location, True));
end.
}

begin
SetupPlayers;
MSI_SetupVars;
ClearDebug;
repeat
if (IsFKeyDown(1)) then
MSI_MainInitForm;
until(False);
end.
Just changed some sizing. Hit F1 to show the form.

Shuttleu

2010-07-31 14:56:37

From: Coh3n
Not sure if you'll like this, but…

program New;

{$i srl/srl.scar}

const
aHowManyPlayers = 6;


SCRIPT_VE_TREES = 0;
SCRIPT_VE_OAKS = 1;
SCRIPT_POWER_CHOP = 2;
SCRIPT_GE_YEWS = 3;
SCRIPT_DB_WILLOWS = 4;
SCRIPT_RM_YEWS = 5;
SCRIPT_PS_WILLOWS = 6;

SCRIPT_POWER_MINE = 7;
SCRIPT_VE_MINER = 8;


LOC_POWER_SKILL = 0;
LOC_LOST = 1;
LOC_VE_TREES = 2;
LOC_VE_OAKS = 3;
LOC_VE_BANK = 4;
LOC_VE_MINE = 5;
LOC_GE_BANK = 6;
LOC_GE_YEWS = 7;
LOC_DB_BANK = 8;
LOC_DB_WILLOWS = 9;
LOC_RM_YEWS = 10;
LOC_FE_BANK = 11;
LOC_PS_WILLOWS = 12;
LOC_PS_DBOX = 13;

type
Playerss = record
Scripts : array of Integer;
Location : Integer;
Active : Boolean;
end;

type
Playersss = record
Active : Boolean;
end;


var
MSI_Players: array of Playerss;
aPlayers: array of Playersss;
x: Integer;

VarPageControl : TPageControl;
TabPages : array of TTabSheet;
frmDesign : TForm;
ActiveLabel : array of TLabel;
ScriptLabel : array of TLabel;
LocationLabel : array of TLabel;
ActiveBox : array of TCheckBox;
Script : array of TComboBox;
Location : array of TComboBox;
Done : array of TButton;
Cancel : array of TButton;

procedure SetupPlayers;
begin
SetArrayLength(MSI_Players, aHowManyPlayers);
SetArrayLength(aPlayers, aHowManyPlayers);

with MSI_Players[0] do
begin
Active:= True;
Location:= LOC_PS_DBOX;
Scripts:= [SCRIPT_PS_WILLOWS];
end;

with MSI_Players[1] do
begin
Active:= True;
Location:= LOC_PS_DBOX;
Scripts:= [SCRIPT_PS_WILLOWS];
end;

with MSI_Players[2] do
begin
Active:= True;
Location:= LOC_PS_DBOX;
Scripts:= [SCRIPT_PS_WILLOWS];
end;

with MSI_Players[3] do
begin
Active:= True;
Location:= LOC_PS_DBOX;
Scripts:= [SCRIPT_PS_WILLOWS];
end;

with MSI_Players[4] do
begin
Active:= True;
Location:= LOC_PS_DBOX;
Scripts:= [SCRIPT_PS_WILLOWS];
end;

with MSI_Players[5] do
begin
Active:= True;
Location:= LOC_PS_DBOX;
Scripts:= [SCRIPT_PS_WILLOWS];
end;
{
with MSI_Players[6] do
begin
Active:= True;
Location:= LOC_PS_DBOX;
Scripts:= [SCRIPT_PS_WILLOWS];
end;

with MSI_Players[7] do
begin
Active:= True;
Location:= LOC_PS_DBOX;
Scripts:= [SCRIPT_PS_WILLOWS];
end;

with MSI_Players[8] do
begin
Active:= True;
Location:= LOC_PS_DBOX;
Scripts:= [SCRIPT_PS_WILLOWS];
end;

with MSI_Players[9] do
begin
Active:= True;
Location:= LOC_PS_DBOX;
Scripts:= [SCRIPT_PS_WILLOWS];
end;

with MSI_Players[10] do
begin
Active:= True;
Location:= LOC_PS_DBOX;
Scripts:= [SCRIPT_PS_WILLOWS];
end;

with MSI_Players[11] do
begin
Active:= True;
Location:= LOC_PS_DBOX;
Scripts:= [SCRIPT_PS_WILLOWS];
end;

with MSI_Players[12] do
begin
Active:= True;
Location:= LOC_PS_DBOX;
Scripts:= [SCRIPT_PS_WILLOWS];
end;
}
end;

function MSI_StringToVar(TheString: string; Location: Boolean): Integer;
begin
case Location of
True: begin
case TheString of
'Power skilling': Result := LOC_POWER_SKILL;

'Varrock east bank': Result := LOC_VE_BANK;

'Varrock east trees': Result := LOC_VE_TREES;

'Varrock east oaks': Result := LOC_VE_OAKS;

'Grand Exchange bank': Result := LOC_GE_BANK;

'Grand Exchange yews': Result := LOC_GE_YEWS;

'Draynor willows': Result := LOC_DB_WILLOWS;

'Draynor bank': Result := LOC_DB_BANK;

'Falador east bank': Result := LOC_FE_BANK;

'Rimmington yews': Result := LOC_RM_YEWS;

'Port Sarim willows': Result := LOC_PS_WILLOWS;

'Port Sarim deposit box': Result := LOC_PS_DBOX;

'Varrock east mines': Result := LOC_VE_MINE;
end;
end;
False: begin
case TheString of
'Varrock east trees': Result := SCRIPT_VE_TREES;

'Varrock east oaks': Result := SCRIPT_VE_OAKS;

'Powerchopper': Result := SCRIPT_POWER_CHOP;

'Grand Exchange yews': Result := SCRIPT_GE_YEWS;

'Draynor Willows': Result := SCRIPT_DB_WILLOWS;

'Rimmington Yews': Result := SCRIPT_RM_YEWS;

'Port Sarim Willows': Result := SCRIPT_PS_WILLOWS;

'Varrock east miner': Result := SCRIPT_VE_MINER;

'Powerminer': Result := SCRIPT_POWER_MINE;
end;
end;
end;
end;

function MSI_VarToString(TheVar: Integer; Location: Boolean): string;
begin
case Location of
True: begin
case TheVar of
LOC_POWER_SKILL: Result := 'Power skilling!';

LOC_VE_BANK: Result := 'Varrock east bank';

LOC_VE_TREES: Result := 'Varrock east trees';

LOC_VE_OAKS: Result := 'Varrock east oaks';

LOC_VE_MINE: Result := 'Varrock east mines';

LOC_GE_BANK: Result := 'Grand Exchange bank';

LOC_GE_YEWS: Result := 'Grand Exchange yews';

LOC_DB_WILLOWS: Result := 'Draynor willows';

LOC_DB_BANK: Result := 'Draynor bank';

LOC_FE_BANK: Result := 'Falador east bank';

LOC_RM_YEWS: Result := 'Rimmington yews';

LOC_PS_WILLOWS: Result := 'Port Sarim willows';

LOC_PS_DBOX: Result := 'Port Sarim deposit box';
end;
end;
False: begin
case TheVar of
SCRIPT_VE_TREES: Result := 'Varrock east trees';

SCRIPT_VE_OAKS: Result := 'Varrock east oaks';

SCRIPT_POWER_CHOP: Result := 'Powerchopper';

SCRIPT_GE_YEWS: Result := 'Grand Exchange yews';

SCRIPT_DB_WILLOWS: Result := 'Draynor Willows';

SCRIPT_RM_YEWS: Result := 'Rimmington Yews';

SCRIPT_PS_WILLOWS: Result := 'Port Sarim Willows';

SCRIPT_POWER_MINE: Result := 'Powerminer';

SCRIPT_VE_MINER: Result := 'Varrock east miner';
end;
end;
end;
end;

procedure MSI_SetupVars;
begin
SetArrayLength(TabPages, Length(MSI_Players));
SetArrayLength(ActiveLabel, Length(MSI_Players));
SetArrayLength(ScriptLabel, Length(MSI_Players));
SetArrayLength(LocationLabel, Length(MSI_Players));
SetArrayLength(ActiveBox, Length(MSI_Players));
SetArrayLength(Script, Length(MSI_Players));
SetArrayLength(Location, Length(MSI_Players));
SetArrayLength(Done, Length(MSI_Players));
SetArrayLength(Cancel, Length(MSI_Players));
end;

Procedure MSI_CancelClick(Sender: TObject);
Begin
WriteLn('Canceling!');
frmDesign.ModalResult:= mrOk;
End;

Procedure MSI_SaveClick(Sender: TObject);
var
ActiveChanged, ScriptChanged, LocationChanged: Boolean;
i: Integer;
Begin
WriteLn('Saving!');
for i:=0 to High(MSI_Players) do
begin
ActiveChanged:= (not(ActiveBox[i].Checked = MSI_Players[i].Active));
ScriptChanged:= (not(Script[i].Text = MSI_VarToString(MSI_Players[i].Scripts[0], False)));
LocationChanged:= (not(Location[i].Text = MSI_VarToString(MSI_Players[i].Location, True)));
if ActiveChanged or ScriptChanged or LocationChanged then
begin
Writeln('Setting vars for player '+IntToStr(i));
MSI_Players[i].Active:= ActiveBox[i].Checked;
aPlayers[i].Active:= ActiveBox[i].Checked;
MSI_Players[i].Location:= MSI_StringToVar(Location[i].Text, True);
MSI_Players[i].Scripts:= [MSI_StringToVar(Script[i].Text, False)];
Writeln(MSI_Players[i].Active);
Writeln(aPlayers[i].Active);
Writeln(MSI_Players[i].Location);
Writeln(MSI_Players[i].Scripts);
end;
end;
frmDesign.ModalResult:= mrOk;
End;

procedure MSI_InitForm;
var
i: Integer;
begin
frmDesign := CreateForm;
with frmDesign do
begin
BorderStyle := bsSingle;
Left := 350;
Top := 150;
Width := 400;
Height := 118;
Caption := 'Change Players';
Color := clBtnFace;
Font.Color := clWindowText;
Font.Height := -11;
Font.Name := 'MS Sans Serif';
Font.Style := [];
PixelsPerInch := 96;
end;
VarPageControl := TPageControl.Create(frmDesign);
with VarPageControl do
begin
Parent := frmDesign;
Align := alClient
end;
for i := 0 to High(MSI_Players) do
begin
TabPages[i]:= TTabSheet.Create(frmDesign);
with TabPages[i] do
begin
Caption := 'Player ' + Inttostr(i);
PageControl := VarPageControl;
end;
end;
for i:=0 to High(MSI_Players) do
begin
ActiveLabel[i] := TLabel.Create(frmDesign);
with ActiveLabel[i] do
begin
Parent := TabPages[i];
Font.Style := [fsBold];
Left := 145;
Top := 10;
Width := 25;
Height := 15;
Caption := 'Active:';
end;
ScriptLabel[i] := TLabel.Create(frmDesign);
with ScriptLabel[i] do
begin
Parent := TabPages[i];
Font.Style := [fsBold];
Left := 145;
Top := 35;
Width := 30;
Height := 15;
Caption := 'Script:';
end;
LocationLabel[i] := TLabel.Create(frmDesign);
with LocationLabel[i] do
begin
Parent := TabPages[i];
Font.Style := [fsBold];
Left := 145;
Top := 60;
Width := 30;
Height := 15;
Caption := 'Location:';
end;
ActiveBox[i] := TCheckBox.Create(frmDesign);
with ActiveBox[i] do
begin
Parent := TabPages[i];
Left := 230;
Top := 8;
Width := 17;
Height := 16;
TabOrder := 8;
Checked := MSI_Players[i].Active;
end;
Script[i] := TComboBox.Create(frmDesign);
with Script[i] do
begin
Parent := TabPages[i];
Left := 230;
Top := 31;
Width := 145;
Height := 21;
ItemHeight := 13;
TabOrder := 9;
Text := MSI_VarToString(MSI_Players[i].Scripts[0], False);
with Items do
begin
Add('Varrock east trees');
Add('Varrock east oaks');
Add('Grand Exchange yews');
Add('Draynor Willows');
Add('Rimmington Yews');
Add('Port Sarim Willows');
Add('Powerchopper');
Add('Varrock east miner');
Add('Powerminer');
end;
end;
Location[i] := TComboBox.Create(frmDesign);
with Location[i] do
begin
Parent := TabPages[i];
Left := 230;
Top := 58;
Width := 145;
Height := 21;
ItemHeight := 13;
TabOrder := 10;
Text := MSI_VarToString(MSI_Players[i].Location, True);
with Items do
begin
Add('Varrock east bank');
Add('Varrock east trees');
Add('Varrock east oaks');
Add('Varrock east mines');
Add('Grand Exchange bank');
Add('Grand Exchange yews');
Add('Draynor willows');
Add('Draynor bank');
Add('Falador east bank');
Add('Rimmington yews');
Add('Port Sarim willows');
Add('Port Sarim deposit box');
Add('Power skilling');
end;
end;
Done[i] := TButton.Create(FrmDesign);
with Done[i] do
begin
Parent := TabPages[i];
Left := 15;
Top := 13;
Height := 25;
Width := 100;
Caption := 'Save';
OnClick := @MSI_SaveClick;
end;
Cancel[i] := TButton.Create(FrmDesign);
with Cancel[i] do
begin
Parent := TabPages[i];
Left := 15;
Top := 48;
Height := 25;
Width := 100;
Caption := 'Cancel';
OnClick := @MSI_CancelClick;
end;
end;
end;

procedure MSI_SafeInitForm;
var
v : TVariantArray;
begin
SetArrayLength(v, 0);
ThreadSafeCall('MSI_InitForm', v);
end;

procedure MSI_ShowInitFormModal;
begin
frmDesign.ShowModal;
end;

procedure MSI_SafeShowInitFormModal;
var
v : TVariantArray;
begin
SetArrayLength(v, 0);
ThreadSafeCall('MSI_ShowInitFormModal', v);
end;

procedure MSI_MainInitForm;
begin
MSI_SafeInitForm;
MSI_SafeShowInitFormModal;
FreeForm(frmDesign);
end;

procedure MSI_ChangePlayerInfo;
begin
begin
Writeln('Change Player Info');
MSI_SetupVars;
MSI_MainInitForm;
end;
end;

{
begin
SetupPlayers;
MSI_SetupVars;
ClearDebug;
for x:=0 to High(MSI_Players) do
Writeln('Player: '+IntToStr(x)+' Active: '+BoolToStr(MSI_Players[x].Active)+' Script: '+MSI_VarToString(MSI_Players[x].Scripts[0], False)+' Location: '+MSI_VarToString(MSI_Players[x].Location, True));
MSI_MainInitForm;
for x:=0 to High(MSI_Players) do
Writeln('Player: '+IntToStr(x)+' Active: '+BoolToStr(MSI_Players[x].Active)+' Script: '+MSI_VarToString(MSI_Players[x].Scripts[0], False)+' Location: '+MSI_VarToString(MSI_Players[x].Location, True));
end.
}

begin
SetupPlayers;
MSI_SetupVars;
ClearDebug;
repeat
if (IsFKeyDown(1)) then
MSI_MainInitForm;
until(False);
end.
Just changed some sizing. Hit F1 to show the form.


yea, i like that, much smaller and compact :)

now we need to find a way to get it to run…

~shut

Sir R. M8gic1an

2010-08-01 08:35:01

From: Shuttleu
yea, i like that, much smaller and compact :)

now we need to find a way to get it to run…

~shut


Maybe we could use Simba's events….

We can make this into an extension and have this run onScriptPause …

~RM

Shuttleu

2010-08-01 11:21:16

From: Rasta Magician
Maybe we could use Simba's events….

We can make this into an extension and have this run onScriptPause …

~RM


is there anyway to check which script is running?
also how would we make the plugin set the scripts variables?
because plugins and scripts run on different threads dont they?

~shut

Sir R. M8gic1an

2010-08-02 06:37:15

From: Shuttleu
is there anyway to check which script is running?
also how would we make the plugin set the scripts variables?
because plugins and scripts run on different threads dont they?

~shut


To be honest, I'm not sure how to do it. For MSI, however it is done - good.

But for the future, the extension could work together with an ini, and the script could work with the ini as well.

~RM

Shuttleu

2010-08-02 06:41:26

From: Rasta Magician
To be honest, I'm not sure how to do it. For MSI, however it is done - good.

But for the future, the extension could work together with an ini, and the script could work with the ini as well.

~RM

ima gonna do a extension, and it shall use ini files :)

~shut

EDIT: no, that wont work, because the extension wont be able to read the script vars

EDIT: got an idea

Sabzi

2010-08-02 06:48:05

^Something like when the script is paused the extension sets (for example) Paused key to true and the script checks that key so the form pops up?
It's the best idea so far, I like it.

EDIT: This was for RM. I went from computer after started writing.

Shuttleu

2010-08-02 06:54:35

From: Sabzi
^Something like when the script is paused the extension sets (for example) Paused key to true and the script checks that key so the form pops up?
It's the best idea so far, I like it.

EDIT: This was for RM. I went from computer after started writing.


what i was thinking was every x minutes its saves the users vars to a ini file, when the script is paused it will pop up the form and save everything in the ini file, then when the script gets back to the x minutes where it usually sets the vars it will see that they have changed and set them in the script before setting them in the ini

~shut

Sir R. M8gic1an

2010-08-02 10:29:44

From: Shuttleu
what i was thinking was every x minutes its saves the users vars to a ini file, when the script is paused it will pop up the form and save everything in the ini file, then when the script gets back to the x minutes where it usually sets the vars it will see that they have changed and set them in the script before setting them in the ini

~shut


Have a boolean in the ini, UserChanged: boolean;

if it is true, then it means that it has been manually changed and therefore you should load the players from there ;)

~RM

Shuttleu

2010-08-02 15:28:58

this is what i have now
this can go in MainLoop.simba at the end of the loop, so it gets run at the end of each load/loop
procedure MSI_SetIniStuff;
var
i: Includes
begin
if StrToBool(ReadIni('Active', 'Active', IncludePath+'SRL\SRL\MSI\Player.INI')) then
begin
WriteINI('Active', 'Active', 'False', IncludePath+'SRL\SRL\MSI\Player.INI');
for i:=0 to High(MSI_Players) do
begin
Players[i].Active:= StrToBool(ReadIni(IntToStr(i), 'Active', IncludePath+'SRL\SRL\MSI\Player.INI'));
MSI_Players[i].Active:= StrToBool(ReadIni(IntToStr(i), 'Active', IncludePath+'SRL\SRL\MSI\Player.INI'));
MSI_Players[i].Location:= StrToInt(ReadIni(IntToStr(i), 'Location', IncludePath+'SRL\SRL\MSI\Player.INI'));
MSI_Players[i].Scripts[0]:= StrToInt(ReadIni(IntToStr(i), 'Scripts', IncludePath+'SRL\SRL\MSI\Player.INI'));
end;
end;
for i:=0 to High(MSI_Players) do
begin
WriteINI('HowMany', 'HowMany', IntToStr(High(MSI_Players)), IncludePath+'SRL\SRL\MSI\Player.INI');
WriteINI(IntToStr(i), 'Active', BoolToStr(Players[i].Active), IncludePath+'SRL\SRL\MSI\Player.INI');
WriteINI(IntToStr(i), 'Location', IntToStr(MSI_Players[i].Location), IncludePath+'SRL\SRL\MSI\Player.INI');
WriteINI(IntToStr(i), 'Scripts', IntToStr(MSI_Players[i].Scripts[0]), IncludePath+'SRL\SRL\MSI\Player.INI');
end;
end;
then this will need to be changed in MainLoop.simba
procedure MSI_ScriptTerminate;
var
i: Integer;
begin
Writeln('Thank-you for using MSI Phoenix scripts!');
MSI_ProgressReport;
FreeSRL;
MSI_FreeAllItems;
for i:=0 to High(MSI_Players) do
begin
DeleteINI(IntToStr(i), 'Active', BoolToStr(ActiveBox[i].Checked), IncludePath+'SRL\SRL\MSI\Player.INI');
DeleteINI(IntToStr(i), 'Location', IntToStr(MSI_StringToVar(Location[i].Text, True)), IncludePath+'SRL\SRL\MSI\Player.INI');
DeleteINI(IntToStr(i), 'Scripts', IntToStr(MSI_StringToVar(Script[i].Text, False)), IncludePath+'SRL\SRL\MSI\Player.INI');
end;
end;
and place this in the extensions folder

~shut

Coh3n

2010-08-02 17:55:37

Looks good Shut. I'm going to try and take a further look/test it later. Correct me if I'm wrong, but you just added a menu item in Simba where you can open the player remote, correct? If so, I like it. :)

One thing I noticed is how all the locations/scripts are setup. Anyone know of an easier way so maybe we don't have to scroll and fine all the times where the script constants/strings are used? In other words, make it easier to update.

Also, I think there should be the option to select multiple scripts. We don't do multiple scripts right now, but we will in the future and it should be taken into consideration.

Shuttleu

2010-08-02 18:04:38

From: Coh3n
Looks good Shut. I'm going to try and take a further look/test it later. Correct me if I'm wrong, but you just added a menu item in Simba where you can open the player remote, correct? If so, I like it. :)

One thing I noticed is how all the locations/scripts are setup. Anyone know of an easier way so maybe we don't have to scroll and fine all the times where the script constants/strings are used? In other words, make it easier to update.

Also, I think there should be the option to select multiple scripts. We don't do multiple scripts right now, but we will in the future and it should be taken into consideration.


i wanted to include globals.simba but simba wouldnt let me for some reason :/
that way we could also add the VarToString and StringToVar functions in MSI which would mean we wouldnt need to update it

~shut

Coh3n

2010-08-02 21:20:50

Hmm I messed around a little to see if I could make it so we wouldn't have to update the extension or without using functions like VarToStr, etc, but I keep getting the same error as you. I posted on this thread.

Shuttleu

2010-08-03 06:16:38

after a bit of talking betwen me and Coh3n we have come up with a way to use it that will not require the extension to be updated

as soon as we can figure out the reason why we cant include MSI into the extension then it will be done and be available to use, i do however have another way of using it, so if you are desperate to use it then just PM me and i will give you everything you need to include it and use it

~shut

Shuttleu

2010-08-03 07:11:39

got another one done, when coh3n comes on i will show it to him and he can decide if he likes it or not

~shut

EDIT: once again, if anyone wants to try it then just let me know

Sir R. M8gic1an

2010-08-03 09:35:01

I'll trust Coh3n to check it out. Post it on the Simba forums as well, someone might want to implement it more generally or just simply have some code to look at ;)

GJ, glad you are doing this :)

~RM

Coh3n

2010-08-03 15:38:58

Just committed. :)

See this thread for more details. The part about the player remote are the first points under "How to setup MSI for autoing".