SRL Archive - Discussions and Debates

Half done script


Bonfield

2011-01-25 02:34:05

program AlchAndCurser;

{$i SRL/SRL.scar}
{$i SRL/SRL/Misc/Stats.simba}
{$i SRL/SRL/Misc/Users.scar}
{$i SRL/SRL/Misc/Reports.scar}
{$i SRL/SRL/Skill/Magic.scar}
{$i SRL/SRL/Misc/Debug.scar}

{=========================================================================]
[ ]
[ NAME : Alcher and Curser ]
[ WRITER : Bonfield ]
[ CATEGORY : Magic ]
[ DESCRIPTION : Casts High Level Alchemy and Curse on a NPC ]
{ for pretty quick xp ]
[ CONTACT ]
[ [url]http://villavu.com/forum/private.php?do=newpm&u=2357[/url]
[ ]
[=========================================================================]
[ Instructions ]
[=========================================================================]
[ 1. Have your display settings set to 32 bit TRUE color. ]
[ 2. Fill out DeclarePlayers. ]
[ (For further instructions on how to fill it out, visit this thread: ]
[ [url]http://www.villavu.com/forum/showthread.php?t=5410[/url] ]
[ 3. If you want to use S.M.A.R.T., uncomment line 34, otherwise ]
[ drag the crosshair over the RS client window. ]
[ 4. Start script! ]
[=========================================================================}

const
SCRIPTVERSION = '1.00';

YOURSTATSUSERID = '46'; // User UID from scriptmanager.freehostia.com
YOURSTATSPASS = 'jacob'; // Your pass from scriptmanager.freehostia.com

WORLD = 32; // Smart World
MEMBERS = False; // Use Members World
SIGNED = True; // Use Signed applet

TAKE_SCREENSHOT = True; // Take Screenshot on level up.
DEBUG_SCRIPT = True; // Do you want the script to debug.

USE_BREAKS = True; // Do you want to break?
RANDOM_BREAKTIME = 5; // Adds random time to each breaktime eg. + or - 5 minutes.



type
NPC = record
Name: String;
Uptext: TStringArray;
Color: Integer;
Hue_Mod: Extended;
Sat_Mod: Extended;
Tolerance: Integer;
end;

{type
proc = procedure(); }


var
Curses_Failed, TOT_Curses, TOT_High_Alches: Integer;
MOB : NPC;
Script_Total: array[0..4] of LongInt;

procedure DeclarePlayers;
begin
HowManyPlayers := 1; // How many players declared?
CurrentPlayer := 0; // Number of player to start with.
NumberOfPlayers(HowManyPlayers);

with Players[0] do
begin
Name := 'name'; // Characters full RS username.
Pass := 'pass'; // Characters RS password.
Nick := 'hi'; // 3 non-caps letters of char's RS username
Strings[0] := 'zamorak monk'; // Supports 'Zamorak Monk', 'Lesser Demon'
// 'Curse' and 'High Level Alchemy' if you only want to cast one of them

Integers[5] := 5; // How long before breaking or switching in minutes
Integers[6] := 6; // How long to break for in minutes + or - Random_Breaktime const
Active := True;
end;
end;

{<!--------------------------------------------------------------------------!>}
{<!--------------------------- END OF SETUP! -------------------------------!>}
{<!--------------------------------------------------------------------------!>}

const
//PLAYER INTEGERS

HIGH_ALCHS_CASTED = 0;
CURSES_CASTED = 1;
XP_GAINED = 2;
LEVELS_GAINED = 3;
INV_AMOUNT = 4;
TIME_TILL_BREAK = 5;
TIME_TO_BREAK_FOR = 6;

// SCRIPT TOTALS

TOTAL_TIME_RAN = 0;
TOTAL_HIGH_ALCHES = 1;
TOTAL_CURSES = 2;
TOTAL_XP_GAINED = 3;
TOTAL_STARTS = 4;

// SCRIPT STATS

STATS_HIGH_ALCHES = 1;
STATS_CURSES = 2;
STATS_XP_GAINED = 3;

{*******************************************************************************
procedure Debug(x :string);
Description: Debugs the script if Debug_Script is true
*******************************************************************************}
procedure Debug(x :string);
begin
if (not DEBUG_SCRIPT) then exit;
writeln(x);
end;

{*******************************************************************************
procedure DeactivatePlayer(PlayerNum: Byte; Reason: string);
By: SRL Template
*******************************************************************************}
procedure DeactivatePlayer(PlayerNum: Integer; Reason: string);
begin
LogOut;
Players[PlayerNum].Loc := Reason;
Players[PlayerNum].Active := False;
srl_Warn('Player ' + IntToStr(PlayerNum) + ' (' +Players[PlayerNum].Nick + ')', 'deactivated -- ' + Reason, warn_Debug);
end;

{*******************************************************************************
procedure Antiban;
By: Not sure sorry if this is someones
*******************************************************************************}
procedure Antiban;
var
x, y: Integer;
begin
Debug('Performing AntiBan');
case Random(15) of
0: MMouse(Random(500), Random(500), Random(MIX2), Random(MIX2));
1: SleepAndMoveMouse(Random(500));
2: IdleTime(Random(500), 2, 5.2);
3: begin
MMouse(Random(500), Random(500), Random(MIX2), Random(MIX2));
Wait(200 + Random(100));
if IsUpText('xamine') then
begin
GetMousePos(x, Y);
Mouse(x, y, 0, 0, False);
Wait(200 + Random(100));
ChooseOption('xamine');
end;
end;
4: PickUpMouse;
5: RandomRClick;
6: if MouseSpeed < 15 then
IncEx(MouseSpeed, Random(5))
else
DecEx(MouseSpeed, Random(5));
7: BoredHuman;
end;
end;

{*******************************************************************************
function SetXPTotal(Open: boolean): Boolean;
By: Narcle
Description: Opens the XP counter on the mainscreen.
*******************************************************************************}
function SetXPTotal(Open: boolean): Boolean;
begin
if (GetColor(512, 63) = 4160941) xor Open then
Mouse(519, 48, 29, 29, true);
end;

{*******************************************************************************
function GetXPTotal: boolean;
By: Narcle
Description: Returns the value of the XP in the counter.
*******************************************************************************}
function GetXPTotal: Integer;
begin
Result := StrToInt(ExtractFromStr(GetTextAtExWrap(452, 55, 512, 69, 0, 5, 4, clWhite, 0, 'XPChars'), numbers));
Debug('GetXPTotal: XP is '+IntToStr(Result)+'.');
if (Result = -1) then
begin
srl_Warn('GetXPTotal', 'Failed, REPORT THIS PLEASE' , 0);
DeactivatePlayer(CurrentPlayer,'GetXPTotal Failed.'); ;
end
end;

{*******************************************************************************
function Convert_To_Time(BreakTime: integer): string;
By: Bonfield
Description: Gets the current time and adds BreakTime in ms and dispays that time.
eg. Taking a break at 06:21:43 PM
Breaking for 10 minutes (10 * 60000)
Returning at 06:31:43 PM
*******************************************************************************}
function Convert_To_Time(BreakTime: integer): string;
var
Time, PA: string;
Hours, hh, Minutes, mm, Seconds, ss, Total_Ms : integer;
begin
Time := TheTime;

hh:= StrToInt(Time[1]) * 10 + StrToInt(Time[2]);
mm:= StrToInt(Time[4]) * 10 + StrToInt(Time[5]);
ss:= StrToInt(Time[7]) * 10 + StrToInt(Time[8]);
PA:= time[10]+time[11];

Hours:= (Hh * 3600000);
Minutes:= (Mm * 60000);
Seconds:= (Ss * 1000);
Total_Ms:= Hours + Minutes + Seconds + BreakTime

Result:= MsToTime(Total_Ms,3)+' '+PA;
end;

{*******************************************************************************
function Take_Break: Integer;
By: Bonfield
Description: Break or switches players.
*******************************************************************************}
function Take_Break: Integer;
var
Break_Time: Integer;
begin
if (USE_BREAKS) then
begin
if ((GetTimeRunning mod (Players[CurrentPlayer].Integers[TIME_TILL_BREAK] * 60000)) = 0) then
begin
Players[CurrentPlayer].Loc := 'Breaking.';
Result := Players[CurrentPlayer].Integers[TIME_TO_BREAK_FOR];
Logout;
writeln(thetime);
if (HowManyPlayers > 1) then
begin
NextPlayer(True);
end else
begin
writeln('Taking a break at '+TheTime);
Break_Time := (Result * 60000) + (RandomRange( - RANDOM_BREAKTIME, RANDOM_BREAKTIME) * 60000);
writeln('Breaking for ' + IntToStr(Break_Time / 60000) + ' minutes');
writeln('Returning at '+Convert_To_Time(Break_Time));
wait(Break_Time);
LoginPlayer;
end;
end;
end;
end;

{*******************************************************************************
function Check_Equipment: boolean;
By: Bonfield
Description: Checks that High Level Alchemy and Curse can be casted
also checks if there is anything in inventory slot 15
*******************************************************************************}
function Check_Equipment: Boolean;
var
Spell_Box: TBox;
begin
if (not LoggedIn) then Exit;
if (ExistsItem(15)) then
begin
Players[CurrentPlayer].Loc := 'Check Equipment';
Gametab(tab_Magic);
if (SpellAvailable(Spell_Box, 'High Level Alchemy') and SpellAvailable(Spell_Box, 'Curse')) then
begin
Result := True;
Writeln('Have runes for High Level Alchemy and Curse.');
end else
begin
Writeln('Not enough runes to cast High Level Alchemy and Curse.');
DeactivatePlayer(CurrentPlayer,'Not enough Runes.');
NextPlayer(False);
end;
end else
begin
Writeln('Nothing exists in Inventory slot 15.');
DeactivatePlayer(CurrentPlayer,'Nothing in inv slot 15.');
NextPlayer(False);
end;
end;

{*******************************************************************************
function Load_NPC_Record: NPC;
By: Bonfield
Description: Loads the information for each NPC.
*******************************************************************************}
function Load_NPC_Record: NPC;
begin
case Lowercase(Players[CurrentPlayer].Strings[0]) of

'zamorak monk', 'monk':
with MOB do
begin
Name := 'Zamorak Monk';
UpText := ['onk'];
Color := 2369905;
Hue_Mod := 0.02;
Sat_Mod := 0.09;
Tolerance := 11;
end;

'lesser demon', 'demon':
with MOB do
begin
Name := 'Lesser Demon';
UpText := ['demon', 'emo', 'mon'];
Color := 1318490;
Hue_Mod := 0.11;
Sat_Mod := 1.18;
Tolerance := 10;
end;
else
begin
srl_Warn('Load_NPC_Record', 'Invalid Target to kill change Strings[0]', 0);
DeactivatePlayer(CurrentPlayer,'Wrong NPC set.');
end;
end;
end;

{*******************************************************************************
function Cast_NPC(Which_Spell: String) : Boolean;
By: Bonfield
Description: Finds the NPC and casts a spell.
*******************************************************************************}
function Cast_NPC(Which_Spell: String) : Boolean;
var
CTS, H, i, x, y, S_Mousespeed: integer;
NPC: TPointArray;
ATPA: T2DPointArray;
begin
if (not LoggedIn) then Exit;

CTS := GetColorToleranceSpeed;
S_Mousespeed := MouseSpeed

ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(MOB.Hue_Mod, MOB.Sat_Mod);

FindColorsSpiralTolerance(MSCX, MSCY, NPC, MOB.Color, MSX1, MSY1, MSX2, MSY2, MOB.Tolerance);
ATPA := TPAToATPAEx(NPC, 70, 65);

if (DEBUG_SCRIPT) then DebugATPA(ATPA,'');
SortATPAFromFirstPoint(ATPA, Point(MSCX, MSCY));

H := High(ATPA);
for i := 0 to H do
if (MiddleTPAEx(ATPA[i], x, y)) then
begin
MMouse(x, y, 0, 0);
if (WaitUpTextMulti(MOB.UpText, RandomRange(400, 550))) then
begin
Result := True;
Debug('Found '+MOB.Name+' at x: '+IntToStr(x)+' y: '+IntToStr(y))
MouseSpeed := (25 + Random(5));
Cast(Which_Spell, False);
Mouse(x, y, 5, 5, True);
Exit;
end;
end;
ColorToleranceSpeed(CTS);
SetColorSpeed2Modifiers(0.2, 0.2);
MouseSpeed:= S_MouseSpeed;
end;
{*******************************************************************************
function Level_Up(What_To_Cast: proc): Boolean;
By: Bonfield
Description: Checks for the level up chat message and continues
a chosen procedure.
*******************************************************************************}
function Level_Up(What_To_Cast: procedure): Boolean;
begin
Result := FindNPCChatText('ongratulations', Nothing);
if (not Result) then exit;
if (TAKE_SCREENSHOT) then TakeScreenshotEx(AppPath+'\Scripts\Screenshots\', MSX1, MSY1, MSX2, MSY2);
Inc(Players[CurrentPlayer].Level[SKILL_MAGIC]);
Debug(Players[CurrentPlayer].Name + ' now has ' + ToStr(Players[CurrentPlayer].Level[SKILL_MAGIC]) + 'magic');
Inc(Players[CurrentPlayer].Integers[LEVELS_GAINED]);
What_To_Cast();
end;

{*******************************************************************************
procedure Inc_Curse_Stats;
By: Bonfield
Description: increases player stats, script totals and SRL stats.
*******************************************************************************}
{procedure Inc_Curse_Stats;
begin
// Player
Inc(Players[CurrentPlayer].Integers[CURSES_CASTED]);
Inc(TOT_Curses);

// Script Totals
Inc(Script_Total[TOTAL_CURSES]);
WriteINI('Script_Total', '2', IntToStr(Script_Total[TOTAL_CURSES]), ScriptPath + 'ScriptStats.INI');
IncEx(Script_Total[TOTAL_XP_GAINED], 29);
WriteINI('Script_Total', '3', IntToStr(Script_Total[TOTAL_XP_GAINED]), ScriptPath + 'ScriptStats.INI');

// SRL Stats
Inc(Stats_CustomVars[STATS_CURSES]);
IncEx(Stats_CustomVars[STATS_XP_GAINED], 29);
end; }

{*******************************************************************************
function Wait_Until_XP(Start_XP, Finish_XP, Max_Wait: Integer): Boolean;
By: Bonfield
Description: Finds how long the XP counter takes to change the XP value.
*******************************************************************************}

function Wait_Until_XP(Start_XP, Finish_XP, Max_Wait: Integer): Boolean;
var
t, tt : Integer;
begin
Result := False;
t := GetSystemTime;
tt := GetSystemTime + Max_Wait;
while (GetSystemTime < tt) do
begin
if (Start_XP >= Finish_XP) then
begin
Result := True;
writeln('Wait_Until_XP took ' + IntToStr(GetTimeRunning - t) + ' msec.');
Exit;
end;
Wait(10);
end;
end;

{*******************************************************************************
procedure Cast_Curse;
By: Bonfield
Description: Casts curse on the NPC loaded.
*******************************************************************************}
procedure Cast_Curse;
var
Start_Curse_XP, Finish_Curse_XP, t: Integer;
begin
if (not LoggedIn) then Exit;

Players[CurrentPlayer].Loc := 'Cast_Curse';
t := GetTimeRunning;

Start_Curse_XP := GetXPTotal;
Gametab(tab_Magic);
Cast_Npc('Curse');
Wait(1000);

Finish_Curse_XP := (GetXPTotal - Start_Curse_XP);
if (Finish_Curse_XP >= 29) then
begin
Debug('Cast_Curse on ' + MOB.Name + ' took ' + IntToStr(GetTimeRunning - t) + ' msec.');
Writeln('Successfully casted Curse.');
FindNonInventoryRandoms;
//Inc_Curse_Stats;

Players[CurrentPlayer].Integers[XP_GAINED] := ((Players[CurrentPlayer].Integers[HIGH_ALCHS_CASTED] * 65) +
(Players[CurrentPlayer].Integers[CURSES_CASTED] * 29));
Level_Up(@Cast_Curse);
end else
Writeln('Did not cast Curse.');
Inc(Curses_Failed);
end;

{*******************************************************************************
procedure Inc_High_Alch_Stats;
By: Bonfield
Description: increases player stats, script totals and SRL stats.
*******************************************************************************}
{procedure Inc_High_Alch_Stats;
begin
// Player
Inc(Players[CurrentPlayer].Integers[HIGH_ALCHS_CASTED]);
Inc(TOT_High_Alches);

// Script Totals
Inc(Script_Total[TOTAL_HIGH_ALCHES]);
WriteINI('Script_Total', '1', IntToStr(Script_Total[TOTAL_HIGH_ALCHES]), ScriptPath + 'ScriptStats.INI');
IncEx(Script_Total[TOTAL_XP_GAINED], 65);
WriteINI('Script_Total', '3', IntToStr(Script_Total[TOTAL_XP_GAINED]), ScriptPath + 'ScriptStats.INI');

// SRL Stats
Inc(Stats_CustomVars[STATS_HIGH_ALCHES]);
IncEx(Stats_CustomVars[STATS_XP_GAINED], 65);
end; }

{*******************************************************************************
procedure Cast_High_Alchemy(x: Integer);
By: Bonfield
Description: Casts High Level Alchemy on a Inventory Spot.
*******************************************************************************}
procedure Cast_High_Alchemy;
var
Start_Alch_XP, Finish_Alch_XP, t: Integer;
TB: TBox;
begin
if (not LoggedIn) then Exit;

Players[CurrentPlayer].Loc := 'Cast_High_Alchemy';
t := GetTimeRunning;

Start_Alch_XP := GetXPTotal;
GameTab(tab_Magic);
Cast('high level alchemy', false);

GetInvItemBounds(15, TB);
MouseBox(TB.X1, TB.Y1, TB.X2, TB.Y2, 1);
Wait(1000);

Finish_Alch_XP := (GetXPTotal - Start_Alch_XP);
if (Finish_Alch_XP >= 65) then
begin
Debug('Cast_High_Alchemy ' + MOB.Name + ' took ' + IntToStr(GetTimeRunning - t) + ' msec.');
Writeln('Successfully casted High Alchemy.');
FindNonInventoryRandoms;

//Inc_High_Alch_Stats;

Players[CurrentPlayer].Integers[XP_GAINED] := ((Players[CurrentPlayer].Integers[HIGH_ALCHS_CASTED] * 65) +
(Players[CurrentPlayer].Integers[CURSES_CASTED] * 29));

Level_Up(@Cast_High_Alchemy);
end else
Writeln('Did not cast High Alchemy.');
end;

{*******************************************************************************
function Out_Of_Runes : Boolean;
By: Bonfield
Description: Looks for chat message to show there are not enough runes to
cast a spell
*******************************************************************************}
function Out_Of_Runes: Boolean;
begin
Result := Pos('enough', GetChatBoxText(8, clBlack)) > 0;
DeactivatePlayer(CurrentPlayer,'Out of Runes.');
end;

{*******************************************************************************
function Count_Item(i: Integer): Integer;
By: Bonfield
Description: Returns the number of stacked items in the inventory slot.
*******************************************************************************}
function Count_Item(i: Integer): Integer;
var
TB: TBox;
begin
TB := InvBox(i);
Result := StrToInt(ExtractFromStr(GetTextAtExWrap(TB.X1, TB.Y1, TB.X2, TB.Y2, 0, 15, 10, clYellow, 50, 'StatChars'), numbers));
Debug('Count_Item: '+IntToStr(Result)+'.');
if (Result = -1) then
begin
srl_Warn('Count_Item', 'Failed, REPORT THIS PLEASE' , 0);
DeactivatePlayer(CurrentPlayer,'Count_Item failed.');
end;
end;

{*******************************************************************************
procedure Curse_And_Alch;
By: Bonfield
Description: Casts Curse and High Level Alchemy.
*******************************************************************************}
procedure Curse_And_Alch;
begin
if (not LoggedIn) then Exit;
repeat
Cast_Curse;
Cast_High_Alchemy;
until Out_Of_Runes or (Players[CurrentPlayer].Integers[HIGH_ALCHS_CASTED]>= Players[CurrentPlayer].Integers[INV_AMOUNT]);
end;

{*******************************************************************************
function SRLProgressReport(
ResultType:integer; ScriptName, ScriptAuthor, ScriptVersion: String;
VarNames: TStringArray;
VarValues: TVariantArray
): Variant;
By: Rasta Magician
Description: Prints a Standardized Progress Report, with the variables of your choice
*******************************************************************************}
procedure Progress_Report;
var
Progress_XP_per_Hour, Progress_XP_Gained : Integer;
begin

Progress_XP_Gained := (TOT_High_Alches * 65) + (TOT_Curses * 29);
Progress_XP_per_Hour := Round(Progress_XP_Gained / (GetTimeRunning / 3600000.0));

IncEx(Script_Total[TOTAL_TIME_RAN], GetTimeRunning);
WriteINI('Script_Total', '0', IntToStr(Script_Total[TOTAL_TIME_RAN]), ScriptPath + 'ScriptStats.INI')

SRLProgressReport(
ResultDebugBox, 'Alch and Curse', 'Bonfield', SCRIPTVERSION,
['Time Running','High Alch Casted', 'Curses Casted','XP Gained', 'XP per hour'],
[TimeRunning, TOT_High_Alches, TOT_Curses, Progress_XP_Gained, Progress_XP_per_Hour ]
);

SRLPlayerReport(
ResultDebugBox, 6, False,
[True, False, True, True, False, False],
['High Alchs', 'Curses', 'XP Gained', 'Levels Gained'],
[], [HIGH_ALCHS_CASTED ,CURSES_CASTED ,XP_GAINED ,LEVELS_GAINED], [], []
);

end;

{*******************************************************************************
procedure Script_Totals;
By: Bonfield
Description: Displays the totals for the script user.
*******************************************************************************}
procedure Script_Totals;
var
i : Integer;
begin
for i := 0 to 4 do
Script_Total[i] := StrToIntDef(ReadINI('Script_Total', IntToStr(i), ScriptPath + 'ScriptStats.INI'), 0);

Writeln(' Total Time Ran : ' + MsToTime(Script_Total[TOTAL_TIME_RAN], Time_Formal));
Writeln(' Total High Alches : ' + IntToStr(Script_Total[TOTAL_HIGH_ALCHES]));
Writeln(' Total Curses : ' + IntToStr(Script_Total[TOTAL_CURSES]));
Writeln(' Total XP Gained : ' + IntToStr(Script_Total[TOTAL_XP_GAINED]));
Writeln(' Script Runs : ' + IntToStr(Script_Total[TOTAL_STARTS]));
end;

procedure Script_Terminate;
begin
writeln('[Report]');
Progress_Report;
writeln('');
writeln('Thanks for using my script');
writeln('Please post proggies on forums');
writeln('[/Report]');
end;

{*******************************************************************************
procedure Setup_Script;
By: Bonfield
Description: Sets the script up
*******************************************************************************}
procedure Setup_Script;
begin
if (not DirectoryExists(AppPath+'\Scripts\Screenshots')) then CreateDirectory(AppPath+'\Scripts\Screenshots');
Debug('Script Starting up.');

{ Smart_Server := WORLD;
Smart_Members:= MEMBERS;
Smart_Signed := SIGNED;
Smart_SuperDetail := False; }

SetUpSRL;
SRLRandomsReport;

{Stats_ScriptID := '66';
Stats_UserID := YOURSTATSUSERID;
Stats_Password := YOURSTATSPASS;
Stats_SendReport;
Stats_ManageAccounts; }

DeclarePlayers;
Load_NPC_Record;

Inc(Script_Total[TOTAL_STARTS]);
WriteINI('Script_Total', '4', IntToStr(Script_Total[TOTAL_STARTS]), ScriptPath + 'ScriptStats.INI');

Script_Totals;
AddOnTerminate('Script_Terminate');
ActivateClient;
end;

{*******************************************************************************
procedure Setup_Player;
By: Bonfield
Description: Sets up each player
*******************************************************************************}
procedure Setup_Player;
begin
Debug('Setting up Player['+IntToStr(CurrentPlayer)+'].');
LogInPlayer;
FindNormalRandoms;
if (not LoggedIn) then Exit;;

GetAllLevels;

SetAllChats('on', 'off', 'on', 'off', 'off', 'off');
SetXPTotal(True);

Check_Equipment;

SetAngle(True);
case Lowercase(Players[CurrentPlayer].Strings[0]) of
'zamorak monk', 'monk', 'lesser demon', 'demon': MakeCompass('W');
end

Players[CurrentPlayer].Integers[INV_AMOUNT]:= Count_Item(15);
Debug('Players['+inttostr(CurrentPlayer)+'] INV_AMOUNT is'+inttostr(Players[CurrentPlayer].Integers[INV_AMOUNT])+'.');
end;

procedure Main_Loop;
begin
Setup_Script;
repeat
Setup_Player;
repeat
Curse_And_Alch;
if ((GetTimeRunning mod (10 * 60000)) = 0) then Progress_Report;
Antiban;
Take_Break;
until (AllPlayersInactive);
until(False);
end;

begin
Main_Loop;
end.

here is a script I pretty much finished a while ago, I got to the stage where i had to work out a few bugs but then XPChars broke and was not included in SRL so I sorta lost interest in this now I have kind of found time and wondered if anyone wanted to help me continue this?

also i know how it records the total script time is wrong I have thought of a system where there is a timer and it resets everytime that stat is logged, I also need to rewrite the stats to work with the new system

anyways anyone interested? or any feedback i might be able to work on this a few hours each day

the reason I posted this here is because i think this is a pretty unique idea that will hopefully be a lot of magic xp per hour and thought it would be a members worthy script

thanks in advance
Bonfield

Bonfield

2011-02-02 03:59:12

nobody interested in this script continuing?

Nose Smasher

2011-02-03 23:27:28

I actually am… Now that free trade is back may help making pures ;)

I'll try to remember to test (can't atm, no srl on this comp)

TomTuff

2011-02-03 23:33:40

About the timing….

function TotalTimeWorked: Integer;
var
i: Integer;
begin
for i := 0 to High(Players) do
IncEx(Result, PlayerWorked(i));
end;

Bonfield

2011-02-08 03:30:07

thanks but the problem i had was the way i increase the time running in the ini/stats page

eg
IncEx(Script_Total[TOTAL_TIME_RAN], GetTimeRunning);

that means lets say the script runs for 12 minutes, then calls that ^ then 5 minutes later it calls it again, TOTAL_TIME_RAN would be 29 minutes, when its actually 17 minutes

do you get what i mean? they are the worst numbers to make an example of =]

Bad Boy JH

2011-02-08 05:29:03

well, how about a global var TimeWorkedSinceLastUpdate, which you set after each time you update that variable.

Bonfield

2011-02-08 06:06:50

thats exactly what i was going to do before i stopped continuing this script

3Garrett3

2011-02-08 08:50:14


IncEx(Script_Total[TOTAL_TIME_RAN], GetTimeRunning - Script_Total[TOTAL_TIME_RAN]);

Would work, no?

Bonfield

2011-02-08 21:06:03

Probably, I never thought of that you would probably need to read the ini store it to a var but it's a really good idea thanks

3Garrett3

2011-02-08 21:16:32

From: Bonfield
Probably, I never thought of that you would probably need to read the ini store it to a var but it's a really good idea thanks


Yeah you could easily assign it to a local variable for that purpose.

Bad Boy JH

2011-02-09 02:12:25

From: 3Garrett3

IncEx(Script_Total[TOTAL_TIME_RAN], GetTimeRunning - Script_Total[TOTAL_TIME_RAN]);

Would work, no?


then why not.
Script_Total[TOTAL_TIME_RAN] := GetTimeRunning;

Bonfield

2011-02-09 03:38:03

Let's say the first time Script_Total[TOTAL_TIME_RAN] := GetTimeRunning; is called it returns 60 minutes and then it gets called again in 10 minutes and increases script total 70 minutes, so the ini would read that the total script runtime would be 130 minutes when in actual fact it's only 70 minutes


This could all be solved by AddOnTerminate('Increase time running proc')

Nose Smasher

2011-02-19 22:53:34

From: Bonfield
Let's say the first time Script_Total[TOTAL_TIME_RAN] := GetTimeRunning; is called it returns 60 minutes and then it gets called again in 10 minutes and increases script total 70 minutes, so the ini would read that the total script runtime would be 130 minutes when in actual fact it's only 70 minutes


This could all be solved by AddOnTerminate('Increase time running proc')

You mean for Multi-player? Just use "MarkTime(x)" when player logs on, "YourVariable" := TimeFromMark(x); when player logs out? (Just set "YourVariable" := 0; before marking time) Just incase ;) And Inc your variable after getting "YourVariable" := TimeFromMark…

"YourVariable" can be one of the variables in the "Players(x)" record

Bad Boy JH

2011-02-24 02:50:52

From: Bonfield
Let's say the first time Script_Total[TOTAL_TIME_RAN] := GetTimeRunning; is called it returns 60 minutes and then it gets called again in 10 minutes and increases script total 70 minutes, so the ini would read that the total script runtime would be 130 minutes when in actual fact it's only 70 minutes


This could all be solved by AddOnTerminate('Increase time running proc')


no it wouldn't it wouldn't INCREMENT it by 70 minutes, it would MAKE it 70 minutes.