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

 

 Mouse Trail

Go down 
4 posters
AuthorMessage
b0xb0x
Administrator
Administrator



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

Mouse Trail Empty
PostSubject: Mouse Trail   Mouse Trail Icon_minitimeWed Mar 09, 2011 11:35 pm

This method can be used to create a mouse trail.

Imports:
Code:
import com.rsbuddy.script.methods.Mouse;
import com.rsbuddy.script.task.LoopTask;
import com.rsbuddy.script.util.Timer;
import java.awt.*;

In your variable declaration
Code:
   private Timer[] mt = { new Timer(50), new Timer(50), new Timer(50),
         new Timer(50), new Timer(50), new Timer(50) };
   Point[] mp = { new Point(0, 0), new Point(0, 0), new Point(0, 0),
         new Point(0, 0), new Point(0, 0), new Point(0, 0) };

Anywhere (as a class ofc)
Code:
   public class TrailTask extends LoopTask {
      public int loop() {
         for (int i=0;i<6;i++) {
            if (!mt[i].isRunning()) {
               mp[i] = Mouse.getLocation();
               mt[i].reset();
               sleep(50);
            }
         }
         return 0;
      }
   }

In your onStart()
Code:
         TrailTask mt = new TrailTask();
         getContainer().submit(mt);

In your onRepaint()
Code:
         for (int j=0;j<6;j++) {
            //instead of using Mouse.getLocation(), use
            //mp[j]
            g.drawLine((mp[j].x - 8), (mp[j].y), (mp[j].x + 8), (mp[j].y));
            // ^ draws a simple line
         }

Enjoy.


Last edited by b0xb0x on Sun Mar 13, 2011 10:27 am; edited 3 times in total
Back to top Go down
https://cybersyndicate.forumotion.com
TaffTech
Administrator
Administrator



Posts : 72
Join date : 2011-02-27

Mouse Trail Empty
PostSubject: Re: Mouse Trail   Mouse Trail Icon_minitimeWed Mar 09, 2011 11:40 pm

And yet again, another awesome method by b0xb0x xD
Come on IRC or something once in a while though!


Last edited by TaffTech on Wed Mar 09, 2011 11:44 pm; edited 1 time in total
Back to top Go down
b0xb0x
Administrator
Administrator



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

Mouse Trail Empty
PostSubject: Re: Mouse Trail   Mouse Trail Icon_minitimeWed Mar 09, 2011 11:43 pm

TaffTech wrote:
And yet again, another awesome method by b0xb0x xD
Come on IRC or something once in a while though!

I haven't lately just because it's so distracting and my time is limited again with school (including sports and driving, excluding homework) taking up 12 hours every day, leaving me with a mere 2 or 3 hours for scripting.
And thanks for the compliment Smile
Back to top Go down
https://cybersyndicate.forumotion.com
b0xb0x
Administrator
Administrator



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

Mouse Trail Empty
PostSubject: Re: Mouse Trail   Mouse Trail Icon_minitimeWed Mar 09, 2011 11:44 pm

TaffTech wrote:
And yet again, another awesome method by b0xb0x xD
Come on IRC or something once in a while though!

Edit: I'm getting an error. Timer(int, actionListener) in Timer cannot be applied to Timer(int) D:

You must be c&p'ing incorrectly somewhere because I've got it working Smile
Back to top Go down
https://cybersyndicate.forumotion.com
TaffTech
Administrator
Administrator



Posts : 72
Join date : 2011-02-27

Mouse Trail Empty
PostSubject: Re: Mouse Trail   Mouse Trail Icon_minitimeWed Mar 09, 2011 11:45 pm

b0xb0x wrote:
TaffTech wrote:
And yet again, another awesome method by b0xb0x xD
Come on IRC or something once in a while though!

I haven't lately just because it's so distracting and my time is limited again with school (including sports and driving, excluding homework) taking up 12 hours every day, leaving me with a mere 2 or 3 hours for scripting.
And thanks for the compliment Smile

Yeah, I think the script was using another Timer class instead of the com.rsbuddy.util.Timer one xD
Back to top Go down
b0xb0x
Administrator
Administrator



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

Mouse Trail Empty
PostSubject: Re: Mouse Trail   Mouse Trail Icon_minitimeWed Mar 09, 2011 11:46 pm

TaffTech wrote:
Yeah, I think the script was using another Timer class instead of the com.rsbuddy.util.Timer one xD

Easy fix Very Happy
Back to top Go down
https://cybersyndicate.forumotion.com
Silent Fang
Member
Member



Posts : 1
Join date : 2011-03-12

Mouse Trail Empty
PostSubject: Re: Mouse Trail   Mouse Trail Icon_minitimeSat Mar 12, 2011 4:51 pm

awesome, thanks
Back to top Go down
Remo
Member
Member



Posts : 41
Join date : 2011-03-10

Mouse Trail Empty
PostSubject: Re: Mouse Trail   Mouse Trail Icon_minitimeSun Mar 13, 2011 6:15 am

Doesn't seem to be working, I'm getting a crap-ton of errors. Still, thanks for the contribution Very Happy
Back to top Go down
b0xb0x
Administrator
Administrator



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

Mouse Trail Empty
PostSubject: Re: Mouse Trail   Mouse Trail Icon_minitimeSun Mar 13, 2011 8:49 am

Remo wrote:
Doesn't seem to be working, I'm getting a crap-ton of errors. Still, thanks for the contribution Very Happy

Possible you are forgetting the imports? Editing method code now to say what imports are required.
Back to top Go down
https://cybersyndicate.forumotion.com
Remo
Member
Member



Posts : 41
Join date : 2011-03-10

Mouse Trail Empty
PostSubject: Re: Mouse Trail   Mouse Trail Icon_minitimeSun Mar 13, 2011 9:39 am

b0xb0x wrote:
Remo wrote:
Doesn't seem to be working, I'm getting a crap-ton of errors. Still, thanks for the contribution Very Happy

Possible you are forgetting the imports? Editing method code now to say what imports are required.

That's weird. It says that the imports can't be found.
Back to top Go down
b0xb0x
Administrator
Administrator



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

Mouse Trail Empty
PostSubject: Re: Mouse Trail   Mouse Trail Icon_minitimeSun Mar 13, 2011 9:55 am

Remo wrote:
b0xb0x wrote:
Remo wrote:
Doesn't seem to be working, I'm getting a crap-ton of errors. Still, thanks for the contribution Very Happy

Possible you are forgetting the imports? Editing method code now to say what imports are required.

That's weird. It says that the imports can't be found.

Is your IDE hooked up correctly?
Back to top Go down
https://cybersyndicate.forumotion.com
Remo
Member
Member



Posts : 41
Join date : 2011-03-10

Mouse Trail Empty
PostSubject: Re: Mouse Trail   Mouse Trail Icon_minitimeSun Mar 13, 2011 10:05 am

b0xb0x wrote:
Remo wrote:
b0xb0x wrote:
Remo wrote:
Doesn't seem to be working, I'm getting a crap-ton of errors. Still, thanks for the contribution Very Happy

Possible you are forgetting the imports? Editing method code now to say what imports are required.

That's weird. It says that the imports can't be found.

Is your IDE hooked up correctly?

"Hooked up"? Well, RSBuddy.jar is the referenced Java archive file, but maybe it's 1.0.9. Let me try with 1.12

EDIT: Yep, that worked Very Happy
Back to top Go down
Sponsored content





Mouse Trail Empty
PostSubject: Re: Mouse Trail   Mouse Trail Icon_minitime

Back to top Go down
 
Mouse Trail
Back to top 
Page 1 of 1
 Similar topics
-
» Rotating Mouse

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