Coh3n
2010-12-15 03:16:41
Due to this topic being brought up here recently, I thought it would be a good idea to actually suggest it in case someone would like to try to get it working. :) It's been talked about in the SL section, but was never outlined to the community. It is also one of our earliest "Coming Soon" features that no one has really gotten around to doing. Now that we have Cstrike's World Walker implemented as an Extra, it can be used to walk to the next script location if necessary.
MSI is already written to support multiple scripts as (if you've looked through the code) you've probably noticed that MSI_Players[].Scripts is an array of TScriptSetup, and the variable CurrentScript is used throughout the include. So, with the include already written like that, this really shouldn't be a difficult feature to finish up.
The original plan was to have CurrentScript work basically the same as CurrentPlayer (in SRL), and I see no reason why that can't be done. Since all the skill setup functions include withdrawing the required tools, only a few functions need to be written.
Knowing when to switch to the next script Like NCDS suggested in the other thread:
The smaller, yet important things We have to be sure that if there is any walking involved in changing scripts, that the player's location is reset, otherwise the new script won't work.
A LevelBeforeSwitch variable would be nice so the player will use that script until it's at a certain level.
Additional Features These don't have to be done, but they are nice ideas that have been suggested.
MSI is already written to support multiple scripts as (if you've looked through the code) you've probably noticed that MSI_Players[].Scripts is an array of TScriptSetup, and the variable CurrentScript is used throughout the include. So, with the include already written like that, this really shouldn't be a difficult feature to finish up.
The original plan was to have CurrentScript work basically the same as CurrentPlayer (in SRL), and I see no reason why that can't be done. Since all the skill setup functions include withdrawing the required tools, only a few functions need to be written.
- MSI_NextScript I think this would be best suited in Scripts.simba, and all it would do is the necessary steps to move on to the next script in the player's scripts array. Let's look at an example of a player setup to run 3 different scripts:
with MSI_Players[1] do
begin
Name := '';
Pass := '';
Nick := '';
Pin := '';
Active := True;
Member := False;
Location := ;
BreakLoads := 0;
BreakTime := 0;
TotalLoads := 0;
TotalTime := 0;
with Scripts[0] do
begin
Name := SCRIPT_VE_MINER;
end;
with Scripts[1] do
begin
Name := SCRIPT_VE_OAKS;
end;
with Scripts[2] do
begin
Name := SCRIPT_BBV_FISHER;
end;
end;
MSI_NextScript would have to Inc(CurrentScript) and then walk to the starting location for the next script. In the case of the first two scripts, that wouldn't be necessary since they have the same starting location. If MSI's setup procedures were done correctly, all MSI_NextScript would have to do is increase CurrentScript and then start at the beginning of the mainloop.
In the case of Script[1] to Script[2], Cstrike's World Walker would be called to walk from Varrock East Bank to Draynor Bank. Once in Draynor bank, all you should have to do is start back at the beginning of the mainloop.
From: NCDSSounds pretty good to me. :) We will have to remember to set CurrentScript back to 0 after switching players to avoid out of range errors. We would then check (after switching players) the new player's Script's LoadsToDo and/or TimeToRun attributes and set CurrentScript accordingly to ensure we start with the right script.
We could just make LoadsToDo and TimeToRun be script specific vars, then TotalTime and Time/LoadsBeforeBreak be global. Doesn't seem like that would take too much at all.
From: lordsaturnLike always, things will be added as they come up. If you think about it, this really isn't difficult at all and I think it's a pretty good project if you're interested to familiarize yourself with the MSI include.
How about the user can create their own function to handle script switching.Scripts[1].SwitchFunc := @SwitchFunc;
Scripts[2].SwitchFunc := @SwitchFunc2;
Scripts[3].SwitchFunc := @SwitchOnLevel;
function SwitchFunc: Boolean;
begin
Result := LoadsDone > 50 or TimeFromMark(ScriptStart) > 10*60*1000;
end;
function SwitchFunc2: Boolean;
begin
Result := TookABreak;
end;