Results 1 to 2 of 2

Thread: MouseSpeed Error

  1. #1
    Join Date
    Jul 2007
    Location
    N O R
    Posts
    208
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default MouseSpeed Error

    Hi I have the new srl installed with scar divi 3.11. I have been trying to run one of my scripts I made with srl 3.81. I declared x and y as global variables and all that. The problem is with Mouse(); The script compiles fine, but when I run it, it says
    [Runtime Error] : divide by Zero in line 79 in script C:\Program Files\SCAR 3.11\includes\SRL/SRL/Core/Mouse.scar
    Then it opens up Mouse.scar. The code around the problem area is
    procedure MMouse(x, y, rx, ry: integer);
    var
    cx, cy: integer;
    randSpeed: extended;
    begin
    randSpeed:= (random(MouseSpeed) / 2.0 + MouseSpeed) / 10.0;
    getMousePos(cx,cy);
    x:= x + random(rx);
    y:= y + random(ry);
    WindMouse(cx,cy,x,y,9.0,3.0,10.0/randSpeed,15.0/randSpeed,10.0*randSpeed,10.0*randSpeed);
    end;
    I understand you can't divide a number by 0. So I tried to change
    randSpeed:= (random(MouseSpeed) / 2.0 + MouseSpeed) / 10.0;
    to
    randSpeed:= ((1 + random(MouseSpeed)) / 2.0 + MouseSpeed) / 10.0;
    Then when I ran the script, the mouse was like wierd. So does anyone have any helpfull suggestions?

    Thanks

    EDIT: I figured out that it works, all you have to do is declare your MouseSpeed var at the begining of your main loop... sorry

  2. #2
    Join Date
    Jul 2007
    Location
    America
    Posts
    421
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Nevermind, I saw your edit. Yeah, Mousespeed:= 10;.
    I dunno, those asians are pretty difficult to out-auto, legend has it they don't need sleep or food...~tim0suprem0
    Activity is on the decline - school's got me
    Check out my tutorial[s] on Color Finding!||Procedures and Functions!

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 8
    Last Post: 11-03-2007, 11:17 PM
  2. mousespeed what does it do?
    By man slaughter in forum OSR Help
    Replies: 3
    Last Post: 10-28-2007, 11:52 AM
  3. mousespeed
    By macromacro123 in forum OSR Help
    Replies: 7
    Last Post: 10-22-2007, 11:58 AM

Posting Permissions

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