SRL Archive - OSR Help

Finding your HP


Troll

2011-04-16 11:20:22

Ok so can you find your HP, by using SRL or do i need to make a custom function? Also how would i go about that ?

Thanks :)

E:

Also, ill ask here as there is no point in anouther thread, it will seem like im spaming :p

Um for declare player, how do you add custom var's? So i want to add what to fight as a string, also how can i call it later in the script

Here

Procedure DeclarePlayers;
Begin
HowManyPlayers := 1;
CurrentPlayer := 0;
NumberOfPlayers(HowManyPlayers);

With Players[0] Do
Begin
Name := '';
Pass := '';
Nick := '';
Pin := '';
Member := False;
Active := True;
End;

End;
Thanks again

autoerforlife

2011-04-16 11:27:56

I haven't scripted with SRL or something but i guess this is what you need.. not sure ;)

{*******************************************************************************
function HpPercent: Integer;
By: Wizzup?
Description: Returns Hp left as a percentage.
Does not switch tabs if Players[CurrentPlayer].Level[SKILL_HITPOINTS] (HP level) is set.
Returns -1 if failed.
*******************************************************************************}
function HPPercent: Integer;
var
ColorString: string;
begin
if (Players[CurrentPlayer].Level[SKILL_HITPOINTS] < 1) then
Players[CurrentPlayer].Level[SKILL_HITPOINTS] := Max(1, GetSkillInfo('hitpoints', False));

if (Players[CurrentPlayer].Level[SKILL_HITPOINTS] > 1) then
Result := Round(GetMMLevels('hp', ColorString) * 10 / Players[CurrentPlayer].Level[SKILL_HITPOINTS])
else
Result := -1;
end;

Well you don't need the entire function but you need to call it in your script

Troll

2011-04-16 11:46:10

That just what i was looking for thanks. :)
Where did you find it?

Brandon

2011-04-16 11:55:17

From: Troll
That just what i was looking for thanks. :)
Where did you find it?


gametab..

Troll

2011-04-16 11:56:09

Thanks :)

E: New question

NCDS

2011-04-16 13:09:57

From: Troll

E:

Also, ill ask here as there is no point in anouther thread, it will seem like im spaming :p

Um for declare player, how do you add custom var's? So i want to add what to fight as a string, also how can i call it later in the script

Here

Procedure DeclarePlayers;
Begin
HowManyPlayers := 1;
CurrentPlayer := 0;
NumberOfPlayers(HowManyPlayers);

With Players[0] Do
Begin
Name := '';
Pass := '';
Nick := '';
Pin := '';
Member := False;
Active := True;
End;

End;
Thanks again


Procedure DeclarePlayers;
Begin
HowManyPlayers := 1;
CurrentPlayer := 0;
NumberOfPlayers(HowManyPlayers);

With Players[0] Do
Begin
Name := '';
Pass := '';
Nick := '';
Pin := '';
Member := False;
Active := True;

Strings[0] := 'WhatToFightHere';
End;

End;

Then when you want to access it in the script just do

Fight(Players[CurrentPlayer].Strings[0]); //Just for an example of calling the var

Same goes for Integers and Booleans. :)

Troll

2011-04-16 13:11:50

Really that simple? Thanks NCDS <3

NCDS

2011-04-16 13:22:58

From: Troll
Really that simple? Thanks NCDS <3


Yeah and no problem.

The full players type from Players.scar:

{ type TUser;
Description: The User Record. }
type
TUser = record
Name: string; // * User Name
Pass: string; // * User Pass
Pin: string; // * Current Users Pin Number
Member: boolean; // * For Login
WorldInfo: TVariantArray; // * [Members {Boolean}, World {Integer}, PVP {Boolean}]
Nick: string; // * Screen Name for random detection
{NickTPA: TPointArray; // * TPA Of Player Name}
Level: array[0..24] of Integer; // * Levels of all skills.
Active: Boolean; // * Set to True if Ok, False if Lost.
Loc: string; // * User Location
Status: string; // * User Status
Skill: string; // * User Action to Perform
Worked: Integer; // * Time User has worked
Banked: Integer; // * Number of Banks User has done
Rand: string; // * Current Random
Booleans: array of Boolean; // * For reports, etc.
Integers: array of Integer; // * For reports, etc.
Strings: array of string; // * For reports, etc.
Extendeds: array of Extended; // * For reports, etc.
Arrays: array of TVariantArray; // * For custom arrays.
BoxRewards: TStringArray; // * Partial texts for rewards, place in desired order.
end;
Take a while sometime and read through the include, you'll learn tons. ;)