Jump to content
LordJashin

OSI, ConstrainToRSBounds, and other recent updates!

Recommended Posts

Latest Commit: https://github.com/OSI1/OSI1/commit/fe5610f7ea8ca1a9adfa93294c49c287f444cc42

 

I've set up constraints for all the mouse functions only if RS2 is defined. I changed RSX1, RSY1, etc. The client constants into variables, and added a new setup function for them called RSGlobalVars. Recently I have restructured OSI a lot for the better. I revised UpdateRSClient, and made a new function called RevertRSClient, so that everything would work with an internet browser. The thing is though, is that SMART works a lot better than the browser with OSI. For one the mouse in SMART compared the browser is much different. The mouse could be covering something up on the client for the internet browser while in SMART I don't think that can happen at all. I updated OSI with better WriteLn's as well, and everywhere.

 

If you use the browser, it can login for you, and usually gets through things. But be careful, if you had previously loaded SMART. That changes the graphics settings. So if after that happens you go straight to the browser, and run the script it could click totally off the browser in random places. You have to make sure you do everything just right. WriteLn's will tell you this.

 

Anyway, the important thing you guys should look at is the new Constrain function! This is the one I made to constrain the mouse functions but I want to use it in a lot more places! Basically it will, based on what booleans you put in the params, check if the coordinates are within or equal to (RSX1, RSY1, RSX2, RSY2). If they are not, a writeln is made, and the variable you put in is replaced with RSX1 or one of them...

 

[sCAR]

{=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

procedure ConstrainToRSBounds(cRSX1, cRSY1, cRSX2, cRSY2: Boolean; var x1, y1, x2, y2: Integer);

Contributors: LordJashin

Description: Constrains to RS2 bounds. Returns true if had to contrain.

Date Created: October 2nd, 2012. By LordJashin. RS2 Build 735.

Last Modified: October 2nd, 2012. By LordJashin. RS2 Build 735.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}

 

procedure ConstrainToRSBounds(cRSX1, cRSY1, cRSX2, cRSY2: Boolean; var x1, y1, x2, y2: Integer);

begin

if cRSX1 then

if (x1 < RSX1) or (x1 > RSX2) then

begin

x1 := RSX1;

WriteLn('OSI: RS2: Constrained x1 to RSX1!');

end;

if cRSX2 then

if (x2 < RSX1) or (x2 > RSX2) then

begin

x2 := RSX2;

WriteLn('OSI: RS2: Constrained x2 to RSX2!');

end;

if cRSY1 then

if (y1 < RSY1) or (y1 > RSY2) then

begin

y1 := RSY1;

WriteLn('OSI: RS2: Constrained y1 to RSY1!');

end;

if cRSY2 then

if (y2 < RSY1) or (y2 > RSY2) then

begin

y2 := RSY2;

WriteLn('OSI: RS2: Constrained y2 to RSY2!');

end;

end;

[/sCAR]

 

Also there is a new variable I added called RSBlank:

[sCAR]

RSBlank := 0; // Blank var 4 functions // 10/2/2012 LordJashin 725

[/sCAR]

 

You can use this blank variable if you only wanted to check one coordinate e.g: ConstrainToRSBounds(True, False, False, False, varExample, RSBlank, RSBlank, RSBlank);

 

Eventually I am going to make more functions use this idea. The mouse functions are major though prevents weird coordinates from happening. I imagine sometimes on a browser this would become more of an issue. This might also prevent stupid invalid search area errors if we implement it more.

Edited by LordJashin
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
  • Create New...