Cyber Syndicate
<center><p style='font-size:120%;'><strong>Welcome to Cyber Syndicate!<strong></p>

You are visiting as a guest; please <strong>register</strong> or <strong>log in</strong>.

Being logged in provides many benefits, including access to the useful <strong>Methods forum</strong>, posting permissions, and voting permissions.

<strong>Enjoy.</strong></center>
Cyber Syndicate
<center><p style='font-size:120%;'><strong>Welcome to Cyber Syndicate!<strong></p>

You are visiting as a guest; please <strong>register</strong> or <strong>log in</strong>.

Being logged in provides many benefits, including access to the useful <strong>Methods forum</strong>, posting permissions, and voting permissions.

<strong>Enjoy.</strong></center>
Cyber Syndicate
Would you like to react to this message? Create an account in a few clicks or log in to continue.



 
HomeLatest imagesRegisterLog in

 

 boolean hover(Model model, boolean continueToHover)

Go down 
4 posters
AuthorMessage
Salvation
VIP
VIP



Posts : 15
Join date : 2011-02-28

boolean hover(Model model, boolean continueToHover) Empty
PostSubject: boolean hover(Model model, boolean continueToHover)   boolean hover(Model model, boolean continueToHover) Icon_minitimeThu Mar 24, 2011 2:36 am

With help of other RSBuddy members, just thought I would share
Code:

/**
 * @description hovers a model
 * @param model, the model to hover or to check for being hovered
 * @param continueToHover,
 * true to keep moving the mouse over the model,
 * false to idle the mouse when already hovering
 * @return true when model was being hovered already
 */
private boolean hover(Model model, boolean continueToHover) {
   for(Polygon p : model.getTriangles()){
      if(p.contains(Mouse.getLocation())) {
         if (continueToHover)
            Mouse.move(model.getNextPoint());
         return true;
      }
   }
   Mouse.move(model.getNextPoint());
   return false;
}
Back to top Go down
b0xb0x
Administrator
Administrator



Posts : 130
Join date : 2011-02-25
Age : 28
Location : California

boolean hover(Model model, boolean continueToHover) Empty
PostSubject: Re: boolean hover(Model model, boolean continueToHover)   boolean hover(Model model, boolean continueToHover) Icon_minitimeThu Mar 24, 2011 6:32 am

Nice! Maybe you could add a timeToHover param so that it moves over the model continuously (and avoid misses due to camera/movement) by creating a Timer of timeToHover and then creating a new Timer instance with that variable as its param. While the timer is running, continue to hover. Actually I'll just make it real quick.
Code:
private void hover (Model model, int timeToHover) {
    Timer t = new Timer(timeToHover);
    while (t.isRunning())
        for (Polygon p : model.getTriangles())
            if (!p.contains(Mouse.getLocation()))
                Mouse.move(model.getNextPoint());
            else
                sleep(Random.nextInt(50, 100));
}

Untested but it should work; I'll test it tonight.
Back to top Go down
https://cybersyndicate.forumotion.com
Salvation
VIP
VIP



Posts : 15
Join date : 2011-02-28

boolean hover(Model model, boolean continueToHover) Empty
PostSubject: Re: boolean hover(Model model, boolean continueToHover)   boolean hover(Model model, boolean continueToHover) Icon_minitimeThu Mar 24, 2011 11:01 am

i loop this method while waiting for my current ore to be mined, no need for the time Wink if the antiban turns the screen it will put the mouse back Smile
Back to top Go down
TaffTech
Administrator
Administrator



Posts : 72
Join date : 2011-02-27

boolean hover(Model model, boolean continueToHover) Empty
PostSubject: Re: boolean hover(Model model, boolean continueToHover)   boolean hover(Model model, boolean continueToHover) Icon_minitimeThu Mar 24, 2011 4:09 pm

Nice, it comes in handy, especially for mining, + it's good for an antiban... I've been using something like this for a while, but it never came across my mind to share it here xD
Back to top Go down
b0xb0x
Administrator
Administrator



Posts : 130
Join date : 2011-02-25
Age : 28
Location : California

boolean hover(Model model, boolean continueToHover) Empty
PostSubject: Re: boolean hover(Model model, boolean continueToHover)   boolean hover(Model model, boolean continueToHover) Icon_minitimeThu Mar 24, 2011 5:19 pm

Oh ok, very nice xD
Back to top Go down
https://cybersyndicate.forumotion.com
Remo
Member
Member



Posts : 41
Join date : 2011-03-10

boolean hover(Model model, boolean continueToHover) Empty
PostSubject: Re: boolean hover(Model model, boolean continueToHover)   boolean hover(Model model, boolean continueToHover) Icon_minitimeSat Jun 04, 2011 7:43 am

This already exists in the GameObject class.
Back to top Go down
Sponsored content





boolean hover(Model model, boolean continueToHover) Empty
PostSubject: Re: boolean hover(Model model, boolean continueToHover)   boolean hover(Model model, boolean continueToHover) Icon_minitime

Back to top Go down
 
boolean hover(Model model, boolean continueToHover)
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Cyber Syndicate :: Development :: Methods-
Jump to: