Results 1 to 19 of 19

Thread: Adding a XP/Hour and more to a script

  1. #1
    Join Date
    Apr 2013
    Posts
    12
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default Adding a XP/Hour and more to a script

    Hello, I'm having some trouble adding an XP/Hour, Tickets Gained, Time Running, and games played feature.

    I ripped this just to give me an idea of how it will work, but I keep getting errors with it.
    This is for a range guild script, so there is no set XP.

    It's telling me SMART_DrawText and SMART_ClearCanvas are undefined strings. I just want it to display in the client, above the chat box.

    Code:
    procedure Progress;
    var
    i:Integer;
    begin
      ClearDebug;
      Line[0] :=  '|| XP/Hour: '  + inttostr(((3600*TotalXpGain) / (1+(GetTimeRunning/1000))));
      Line[1] :=  '|| Total Xp: '  + inttostr(TotalXpGain);
      Line[2] :=  '|| Time Running: ' + MsToTime(GetTimeRunning,3);
      for i:=0 to High(Line) do
      begin
           writeln(Line[i]);
      end;
      SMART_ClearCanvas;
      SMART_DrawText(10,270-50,StatChars,Line[0] ,clWhite);
      SMART_DrawText(10,290-50,StatChars,Line[1] ,clWhite);
      SMART_DrawText(10,310-50,StatChars,Line[2] ,clWhite);
    end;
    begin
    SetupSRL;
    P07_DeclarePlayer;
    SetupP07Include;
    ActivateClient;
    ClearDebug;
    TotalXpGain := 0;
    ClearDebug;
    Wait(1000);
    If (Not P07_LoggedIn) then
    begin
      P07_LogInPlayer;
    end;
    DTM;
    repeat
    Progress;
    AntiBan;
    Open_Inv_Tab;
    Start_Comp;
    Click_to_Continue;
    Wield_Arrow;
    AntiBan;
    Fire_Target;
    until(competitionsplayedcount = PlayCompetitions);
      begin
      writeln('Number of Competitions completed!');
      writeln('Logging out...');
      MMouse(644,483,5,5);
      ClickMouse2(mouse_left);
      wait(randomrange(500,1500));
      MMouse(633,378,5,5)
      ClickMouse2(mouse_left);
      end;
    AddOnTerminate('FreeDTMz');
    TerminateScript;
    end.
    Errors:
    [Error] C:\Users\Cameron\Downloads\AutoRangeGuilder_11[1.55] (1).simba(317:3): Unknown identifier 'SMART_ClearCanvas' at line 316
    Compiling failed.
    [Error] C:\Users\Cameron\Downloads\AutoRangeGuilder_11[1.55] (1).simba(318:3): Unknown identifier 'SMART_DrawText' at line 317
    Compiling failed.
    This is at the very bottom of the script.
    Last edited by eXystis; 04-14-2013 at 10:12 PM.

  2. #2
    Join Date
    May 2007
    Location
    England
    Posts
    4,140
    Mentioned
    11 Post(s)
    Quoted
    266 Post(s)

    Default

    This should work fine as long as TotalXpGain is actually a declared variable, which might be one of the errors you're getting/

    Simba Code:
    procedure Progress;
    begin
      ClearDebug;
      WriteLn(' XP/Hour: '  + FloatToStr(TotalXpGain / (GetTimeRunning/3600000)));
      WriteLn(' Total Xp: '  + IntToStr(TotalXpGain));
      WriteLn(' Time Running: ' + TimeRunning);
    end;
    Last edited by Rich; 04-14-2013 at 10:25 PM.
    <3

    Quote Originally Posted by Eminem
    I don't care if you're black, white, straight, bisexual, gay, lesbian, short, tall, fat, skinny, rich or poor. If you're nice to me, I'll be nice to you. Simple as that.

  3. #3
    Join Date
    Apr 2013
    Posts
    12
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    I'm using your way, but now I'm getting an error on this line.
    WriteLn(' Total Xp: ' + IntToStr(TotalXpGain);
    [Error] C:\Users\Cameron\Downloads\AutoRangeGuilder_11[1.55] (1).simba(311:50): Syntax error at line 310
    Compiling failed.

  4. #4
    Join Date
    May 2007
    Location
    England
    Posts
    4,140
    Mentioned
    11 Post(s)
    Quoted
    266 Post(s)

    Default

    My bad, I missed a bracket off the end. Just add an extra closing bracket after TotalXpGain on the line in your post and that should sort it out for you.
    <3

    Quote Originally Posted by Eminem
    I don't care if you're black, white, straight, bisexual, gay, lesbian, short, tall, fat, skinny, rich or poor. If you're nice to me, I'll be nice to you. Simple as that.

  5. #5
    Join Date
    Apr 2013
    Posts
    12
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    Well, it compiled, going to see if it worked now.

  6. #6
    Join Date
    Apr 2013
    Posts
    12
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    Now it's saying
    Error: divide by Zero at line 308
    The following DTMs were not freed: [SRL - Lamp bitmap, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
    The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap, SRL - NavBar Bitmap, SRL - Options Bitmap]
    On this line
    WriteLn(' XP/Hour: ' + FloatToStr(TotalXpGain / (GetTimeRunning/3600000)));

  7. #7
    Join Date
    May 2007
    Location
    England
    Posts
    4,140
    Mentioned
    11 Post(s)
    Quoted
    266 Post(s)

    Default

    To be honest I have no idea. I've been playing around with it for a little bit and I'm still getting the same error. I even grabbed some code from one of my old scripts, adapted that and I was getting the error.

    Sorry bud, can't help you :/
    <3

    Quote Originally Posted by Eminem
    I don't care if you're black, white, straight, bisexual, gay, lesbian, short, tall, fat, skinny, rich or poor. If you're nice to me, I'll be nice to you. Simple as that.

  8. #8
    Join Date
    Mar 2006
    Location
    Belgium
    Posts
    3,564
    Mentioned
    111 Post(s)
    Quoted
    1475 Post(s)

    Default

    TimeRan := (GetTimeRunning / 1000);
    XPHour := (3600 * (XP)) / ((TimeRan));

    Creds to DannyRS for this wonderful sig!

  9. #9
    Join Date
    Mar 2013
    Location
    The Netherlands
    Posts
    185
    Mentioned
    2 Post(s)
    Quoted
    70 Post(s)

    Default

    When you haven't earned any xp yet, it try's to devide by 0. You could exit the procedure to stop that.

    Code:
    procedure Progress;
    begin
      ClearDebug;
      WriteLn(' Time Running: ' + TimeRunning);
      if (TotalXpGain < 1) then exit;
    
      WriteLn(' XP/Hour: '  + FloatToStr(TotalXpGain / (GetTimeRunning/3600000)));
      WriteLn(' Total Xp: '  + IntToStr(TotalXpGain));
    end;
    Last edited by jelknab; 04-14-2013 at 10:59 PM.

  10. #10
    Join Date
    Apr 2013
    Posts
    12
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    Well, I got it to work, but only in the Debug box..

    But it's not actually updating the numbers.. any idea how I can get it to display in the SMART8 Client?

    XP/Hour: 0
    Total Xp: 0
    Time Running: 44 Seconds

    Judge Found! Talking to the Judge...

  11. #11
    Join Date
    Mar 2006
    Location
    Belgium
    Posts
    3,564
    Mentioned
    111 Post(s)
    Quoted
    1475 Post(s)

    Default

    Quote Originally Posted by eXystis View Post
    Well, I got it to work, but only in the Debug box..

    But it's not actually updating the numbers.. any idea how I can get it to display in the SMART8 Client?
    Like in your script:
    Simba Code:
    SMART_DrawText(10,270-50,StatChars,Line[0] ,clWhite);
      SMART_DrawText(10,290-50,StatChars,Line[1] ,clWhite);
      SMART_DrawText(10,310-50,StatChars,Line[2] ,clWhite);

    That would do it.

    It updates everytime u call Progress;

    Creds to DannyRS for this wonderful sig!

  12. #12
    Join Date
    Apr 2013
    Posts
    12
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    Where would my Identifier go for SMART_DrawText?


    [Error] C:\Users\Cameron\Downloads\AutoRangeGuilder_11[1.55] (1).simba(319:3): Unknown identifier 'SMART_DrawText' at line 318
    Compiling failed.

    By the way, thanks for all the help, guys. I appreciate it.

  13. #13
    Join Date
    May 2007
    Location
    England
    Posts
    4,140
    Mentioned
    11 Post(s)
    Quoted
    266 Post(s)

    Default

    Quote Originally Posted by jelknab View Post
    When you haven't earned any xp yet, it try's to devide by 0. You could exit the procedure to stop that.

    Code:
    procedure Progress;
    begin
      ClearDebug;
      WriteLn(' Time Running: ' + TimeRunning);
      if (TotalXpGain < 1) then exit;
    
      WriteLn(' XP/Hour: '  + FloatToStr(TotalXpGain / (GetTimeRunning/3600000)));
      WriteLn(' Total Xp: '  + IntToStr(TotalXpGain));
    end;
    I plugged in some numbers to replace the variables and I was still getting the error.

    Anyway, OP got it working so I suppose that's all that matters.

    With regards to the new SMART related error, I believe you need to add SmartGraphics.simba as an include at the top.
    Last edited by Rich; 04-14-2013 at 11:19 PM.
    <3

    Quote Originally Posted by Eminem
    I don't care if you're black, white, straight, bisexual, gay, lesbian, short, tall, fat, skinny, rich or poor. If you're nice to me, I'll be nice to you. Simple as that.

  14. #14
    Join Date
    Mar 2006
    Location
    Belgium
    Posts
    3,564
    Mentioned
    111 Post(s)
    Quoted
    1475 Post(s)

    Default

    yeah add : {$I SRL-OSR/SRL/Misc/SmartGraphics.Simba}

    Creds to DannyRS for this wonderful sig!

  15. #15
    Join Date
    Apr 2013
    Posts
    12
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    I've been able to display a XP/Hour and Time running, and Total XP. But the only problem is, how do I gather the XP earned from the game? Would I use a competition count/10 and then distribute the XP like that? also, How would I add a Bitmap to the SMART screen, and display live XP/Hour and XP gained, Tickets Gained, etc to the screen?
    Last edited by eXystis; 04-15-2013 at 01:04 AM.

  16. #16
    Join Date
    Apr 2013
    Posts
    12
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    This, so far is what I've done. I haven't been able to figure out how to find a system to find out the XP gained, and XP per hour, because a range guild does not have a set XP rate.

    I could possibly do it on the number of tickets gained, since the amount of tickets received is divided by 10. Maybe there's a way to multiply it by 10, then divide by the XP given for a certain score that is divisible by that number, such as 10.


    4rwztu.png

  17. #17
    Join Date
    Jun 2007
    Location
    The land of the long white cloud.
    Posts
    3,702
    Mentioned
    261 Post(s)
    Quoted
    2006 Post(s)

    Default

    Quote Originally Posted by eXystis View Post
    This, so far is what I've done. I haven't been able to figure out how to find a system to find out the XP gained, and XP per hour, because a range guild does not have a set XP rate.

    I could possibly do it on the number of tickets gained, since the amount of tickets received is divided by 10. Maybe there's a way to multiply it by 10, then divide by the XP given for a certain score that is divisible by that number, such as 10.


    4rwztu.png
    If it was EOC you would just get the amount gained from the XP bar. I guess you could use GetXP when you start the script to get the starting xp, and then call it again to get the amount gained.

    Simba Code:
    function GetXP(skill: variant): integer;

    So maybe something like:

    Simba Code:
    StartXP := GetXP('range');
    which you would call at the beginning of your script after you login.

    Then during your script you would go:
    Simba Code:
    CurrentXP := GetXP('range');
    XPGained := CurrentXP - StartXP;

    As for the SMART paint not updating, you would need to call the procedure (where you use the SMART_draw text) each time you want it to update.


    E: just read the thing about range tickets. Do you get a certain number of XP per ticket? If so you could just get the ticket amount and multiply it.
    Last edited by The Mayor; 04-15-2013 at 04:10 AM.

  18. #18
    Join Date
    Apr 2013
    Posts
    12
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    This isn't for EOC, and no, you get tickets based on your score. Say I got a score of 350, I would get 35 tickets. I'm just wondering, how much XP would it be per 10 score, I could just do something that way.

    This is for a 07 range guild script.

  19. #19
    Join Date
    Jun 2007
    Location
    The land of the long white cloud.
    Posts
    3,702
    Mentioned
    261 Post(s)
    Quoted
    2006 Post(s)

    Default

    Quote Originally Posted by eXystis View Post
    This isn't for EOC, and no, you get tickets based on your score. Say I got a score of 350, I would get 35 tickets. I'm just wondering, how much XP would it be per 10 score, I could just do something that way.

    This is for a 07 range guild script.
    I know, just do what I said

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
  •