ClipRange
Result = ClipRange(Value, LowerLimit, UpperLimit)
 
Parameters:

    Value = The value to clip
    LowerLimit = The lower limit of the range
    UpperLimit = The upper limit of the range
Returns:

    Result = The clipped value
 

      ClipRange clips the specified integer value to a range. If the value is less than the lower limit, the lower limit is returned. If the value is greater than the upper limit, the upper limit is returned. Otherwise the ClipRange returns the original value.




Mini Tutorial:


      This example draws a circle at current mouse position. The circle range motion is clipped to within a certain vertical range using the ClipRange function.


  
  Repeat
     Cls RGB(0,0,0)
     
   ; Draw 2 horizontal lines
     Line 0,50GetScreenWidth(),50
     Line 0,150GetScreenWidth(), 150
     
   ; check if the current Y coordinate of the
   ; mouse is within the 2 lines
     YPos = ClipRange(MouseY(), 50150)
     
   ; Draw a small circle that follows the mouse;
   ; if it is with the 2 lines
     Circle MouseX(), YPos, 51
     Sync
  Until EscKey()
  











 
Related Info: ClipRange# | If | Range :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com