Results 1 to 7 of 7

Thread: what do i do here again

  1. #1
    Join Date
    Oct 2007
    Location
    If (Online) then Loc := ('On comp') else Loc := ('Somewhere else!');
    Posts
    2,020
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default what do i do here again

    i deleted my pld topic

    this is what i get

    [Runtime Error] : divide by Zero in line 487 in script C:\Documents and Settings\User\Desktop\cathybanana.scar


    SCAR Code:
    Procedure ProgressReport;
    var totalspent, profit,rateV,rateP, sec : integer;
    begin
      SRLRandomsReport;
       begin
       TotalSpent := Bananas * 10;
       RateP:= 3600 *  Profit / Sec;
       RateV := 3600 * Bananas / Sec;//<---Line 487??
       AddToReport('');

    iwas told to put avoind or somthing like that..?

  2. #2
    Join Date
    Jul 2007
    Location
    Right now? Chair.
    Posts
    8,488
    Mentioned
    3 Post(s)
    Quoted
    12 Post(s)

    Default

    your never set the var "sec" and the default value for an int is 0 so you get divide by zero which is a mathematical impossibility.

    so

    sec := ... ;

    ~RM

    I & I know Zion. It is in the spirit, body and mind of every one of us
    RMouse(obj: TMSIObject): boolean;

  3. #3
    Join Date
    Mar 2008
    Posts
    1,492
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I think what you are intending to do is divide it by TimeRunning...

  4. #4
    Join Date
    Oct 2006
    Location
    finland, helsinki
    Posts
    2,501
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    Sec := GetTimeRunning div 1000+1;

    be4 u use sec.

    Code:
    • Narcle: I recall Jukka releasing a bunch of scripts like this before... Its how he rolls I think. rofl
    • Solarwind: Dude, you are like... t3h s3x.
    • Hy71194: JuKKa you're a machine! You released 3 scripts in 10 minutes! :O
    • benjaa: woah.... Jukka is the man Guildminer pwns all
    • NaumanAkhlaQ: And JuKKa Is my Her0!

  5. #5
    Join Date
    Jan 2007
    Location
    Illinois.. >.<
    Posts
    1,158
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Yeah, do something like this to avoid runtime errors:
    SCAR Code:
    try
    RateV := 3600 * Bananas / Sec;
    except
    Writeln('We can''t divide by zero..');
    end;

    That will help you avoid the runtime error if for some reason, the script doesnt set a var to secs.

  6. #6
    Join Date
    Mar 2007
    Posts
    3,681
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default





    That is why you get that error -,-

  7. #7
    Join Date
    Jan 2007
    Location
    Illinois.. >.<
    Posts
    1,158
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    My math teacher told me that if anyone in our class tried to divide by zero that the math police would bust down the door and come swooping through the windows, and then fall out of the ceiling and haul us away for trying to divide by zero.. Lawl

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
  •