Results 1 to 8 of 8

Thread: Finding your HP

  1. #1
    Join Date
    Oct 2010
    Location
    Under a bridge
    Posts
    648
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Finding your HP

    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

    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
    Simba Code:
    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
    Last edited by Troll; 04-16-2011 at 04:42 PM.
    Quote Originally Posted by DD on IRC
    wanted to troll the troll

  2. #2
    Join Date
    Jun 2007
    Location
    Netherlands
    Posts
    137
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I haven't scripted with SRL or something but i guess this is what you need.. not sure
    Simba Code:
    {*******************************************************************************
    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
    Last edited by autoerforlife; 04-16-2011 at 03:30 PM.
    This week is exam week, after that I'll start making my first script

    I've been away for a while, reading about the updates i've missed now

  3. #3
    Join Date
    Oct 2010
    Location
    Under a bridge
    Posts
    648
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    That just what i was looking for thanks.
    Where did you find it?
    Quote Originally Posted by DD on IRC
    wanted to troll the troll

  4. #4
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    Quote Originally Posted by Troll View Post
    That just what i was looking for thanks.
    Where did you find it?
    gametab..
    I am Ggzz..
    Hackintosher

  5. #5
    Join Date
    Oct 2010
    Location
    Under a bridge
    Posts
    648
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks

    E: New question
    Last edited by Troll; 04-16-2011 at 04:43 PM.
    Quote Originally Posted by DD on IRC
    wanted to troll the troll

  6. #6
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Quote Originally Posted by Troll View Post
    E:

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

    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
    Simba Code:
    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
    Simba Code:
    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
    Simba Code:
    Fight(Players[CurrentPlayer].Strings[0]); //Just for an example of calling the var

    Same goes for Integers and Booleans.

  7. #7
    Join Date
    Oct 2010
    Location
    Under a bridge
    Posts
    648
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Really that simple? Thanks NCDS <3
    Quote Originally Posted by DD on IRC
    wanted to troll the troll

  8. #8
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Quote Originally Posted by Troll View Post
    Really that simple? Thanks NCDS <3
    Yeah and no problem.

    The full players type from Players.scar:
    Simba Code:
    { 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.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •