SRL Archive - Research & Development Lounge

GetCursor


caused

2009-09-03 04:23:45

I really took a night shift for this, haha :D.

Introdcution:
This is an easy to use implementation for scar, that enables you to detect which cursor is active. It's good for creating failsaves, and for checking if the mouse is on a certain object.

Installation:
Unpack the archive in your Scar Folder.

Usage:
1. {.include cursor.scar} in your script.
2. Use GetCursor to get the actual cursor, it will return a string with the cursor name, currently supported are "default", "axe", "sword" and many more… check out the "Plugin/Icons" folder.

Adding own Cursors:
You can easiely add your own cursors :), I added "Cursor Receiver.scar" for that purpose.
Run Cursor receiver, move the mouse so that it becomes the cursor you want, wait a second.
Now you should have a debug window showing the cursor you wanted to grab. Paste that debug window into mspaint, make sure that the dimensions are 32x32. Save it as "mycursor".bmp(or whatever name you want).

Now move your cursor file into the "Scar/Plugins/Icons/" Folder.

GetCursor will now detect your newly added cursor File. It will result the name of the file without ".bmp" when that cursor is active.

Example Script:

program WoodcuttingExample;
{.include Cursor.scar}
var
x,y : Integer;
begin
x:= 251;
y:= 157;
//Find a close tree
If FindColorSpiralTolerance(x,y,3304031,55,5,514,330,22) then
begin
ClickMouse(x,y,True); // Click it
wait(50);
repeat
wait(1000);
untiL not(GetCursor = 'axe'); //and wait until it is cut(the icon changed)
end;
end.

If you feel like supporting me with this you may create 32x32 bitmaps for all the other new ingame cursors ;).

Have fun :).

If you want to use them Cursors in your OS, you can get em here ;). http://www.villavu.com/forum/showthread.php?p=626192#post626192

~caused

3Garrett3

2009-09-03 04:28:01

32*32 with the cursor only, right? You have to black out the backgrounds?

mormonman

2009-09-03 04:29:01

sauce included?

caused

2009-09-03 04:30:23

From: 3Garrett3
32*32 with the cursor only, right? You have to black out the backgrounds?


No, you just take what the debug window gives you ;). I acutally used white as transparent color.

Check out the Files in the "Plugins/Icons" Folder.

~caused

//Edit: Geez. I made a mistake :x.. I didnt free the bitmap in the plugin…. Tell me if that results in any problems and I'll fix it.

3Garrett3

2009-09-03 04:39:22

Well I haven't dled it yet, I wont be able to help until the morning, so if you wanna fix it now, I bet its better now than later.

caused

2009-09-03 04:41:12

From: 3Garrett3
Well I haven't dled it yet, I wont be able to help until the morning, so if you wanna fix it now, I bet its better now than later.


It's just a small thing i guess no one would have noticed it, if i wouldnt have pointed it out.

Gotta fix it now. Fixed in 2 Minutes! :)

~caused

EDIT: Updated! File Fixed.

Main

2009-09-03 09:11:52

Hmm how do I make the script keep on looking for a bitmap/color until it finds it?
also, white back grounds are transparent to bitmaps?

caused

2009-09-03 14:04:16

From: Main_Ftw
Hmm how do I make the script keep on looking for a bitmap/color until it finds it?
also, white back grounds are transparent to bitmaps?


huh? :D, You can basicly set any Color as transparent. Transparent Colors in bmp's are only defined through the output functions, cause bitmap itself does not have transparency.

~caused

Edit: Added the rest of the new cursors. PHEW!.

Sabzi

2009-09-03 17:01:08

What's the difference between cursors and uptext?
They are the same, no?

Gu3st...

2009-09-03 17:02:57

From: Sabzi
What's the difference between cursors and uptext?
They are the same, no?

Cursors are the "thing" you move; the mice while the uptext is the text in the upper-left corner (text to the up, uptext :p)

Sabzi

2009-09-03 17:05:15

From: Zyt3x
Cursors are the "thing" you move; the mice while the uptext is the text in the upper-left corner (text to the up, uptext :p)


Haha, I know this.
I was talking about functionality. They are doing the same. You won't have an uptext of fishing while your cursor is dropping, do you? So uptext for failsafe is enough, I wanted to say this. Or not?
I didn't look in the updates, yet, that's why I am asking.

caused

2009-09-03 17:13:54

From: Sabzi
Haha, I know this.
I was talking about functionality. They are doing the same. You won't have an uptext of fishing while your cursor is dropping, do you? So uptext for failsafe is enough, I wanted to say this. Or not?
I didn't look in the updates, yet, that's why I am asking.


You cant have enough failsaves. And also get uptext sometimes fails. Cursor recognition will fail very seldom :P. And it's also good for things that dont have an uptext that would identify it very well (closedoor, opendoor ie…).

~caused

3Garrett3

2009-09-03 17:27:25

From: caused
You cant have enough failsaves. And also get uptext sometimes fails. Cursor recognition will fail very seldom :P. And it's also good for things that dont have an uptext that would identify it very well (closedoor, opendoor ie…).

~caused


Uptext fails fairly often considering how important it is.

Getuptext returns 'Mithril ure' 'Mithril or' 'Mithril re' instead of 'Mithril ore'. So I would say that an extra failsafe should be used. (I know it isnt a good situation for it, but it proves the point)

Main

2009-09-03 21:11:50

how do i set a color to transparent?

caused

2009-09-03 22:48:32

From: Main_Ftw
how do i set a color to transparent?


Can you please add a context to your question ;) ?

All you need to know about this plugin is in post1 in this thread ;).

~caused

Home

2009-09-04 10:55:56

Caused this looks pretty cool :) Hopefully this will be used Rep and big cookie for you :)
~Home

caused

2009-09-04 16:50:52

From: Home
Caused this looks pretty cool :) Hopefully this will be used Rep and big cookie for you :)
~Home


:D I'm glad someone said thanks :'D.

Thanks, and yeah i hope so too :).

Its a great failsafe and.. another plus is, that its not depending on the english runescape. I wrote my first scripts that work on french and german servers too :). (Not with randoms ofc..).

~caused

Alligaattor

2009-09-24 17:14:27

This is good script. :D
If it had a proggy tho… :P

rogeruk

2009-09-24 17:20:38

From: Alligaattor
This is good script. :D
If it had a proggy tho… :P


Spam enough?

Alligaattor

2009-09-27 05:15:30

From: rogeruk
Spam enough?


Yea… Noticed just now that I put it in the wrong topic… sry
And sorry again :(

d3vil151

2009-10-04 12:22:10

dude this is stupid i dont even anderstand half of wut i have to do!!!! i got so pissed over diz!

Sabzi

2009-10-04 13:57:40

From: d3vil151
dude this is stupid i dont even anderstand half of wut i have to do!!!! i got so pissed over diz!


Then maybe learn english first then try again.
From how you write I don't think you want to write a script using this rather leech, sorry if I am wrong.
So your part is easier.
I never done this because my uptexts works for me.
I suppose in the archive there is a cursor.scar, right? Place that file into your Include folder, that's in your main scar folder.
And I suppose there is a .dll too. Place that in the plugins folder, that's in your main scar folder too.
Than you can use caused's great scripts, but don't forget to post him proggies.

After I have wrote that^ I downloaded it to be sure I am right. And to be honest it's so obvious. Place the inside of the downloaded Include folder in your scar's include folder, same with Plugins.

p.s.: I just written down the same as caused, I know, but how else this can be written down?

caused

2009-10-05 15:35:18

Thanks, Sabzi.

I splitted up the Instructions to "Installation" and "Usage". Maybe some people got that mixed-up.

~caused

Baked0420

2009-10-26 11:12:11

getting this error:

Unknown identifier 'GetCursorBitmap' in script C:\Program Files\Scar 3.22\includes\cursor.scar

since it's unknown in the include, it must be something with the plug-in, and yes, I do have the plug-in and icons folder in the plug-ins folder, but I get that error when trying to run the script. My only guess is you had GetCursorBitmap in your plug-in and renamed/removed it, either that or I'm way off and have no clue what I'm talking bout :p

caused

2009-10-26 13:59:58

You will need to restart scar after installing new plugins.

Baked0420

2009-10-26 14:12:41

that might be why… thanks, I'll try, I'll let you know if it fixed it or not, I'm going to take your word on it though, and say that's most likely why.

EDIT:

thanks it works now :p

poisike323

2010-02-23 08:57:08

Line 49: [Error] (21775:14): Unknown identifier 'GetCursorBitmap' in script C:\Documents and Settings\Poisike\Desktop\includes\cursor.scar
Need little help here:)

Gu3st...

2010-02-23 09:09:41

From: poisike323
Line 49: [Error] (21775:14): Unknown identifier 'GetCursorBitmap' in script C:\Documents and Settings\Poisike\Desktop\includes\cursor.scar
Need little help here:)
Take a look at the date the last post was posted before posting please. It was 4 months ago!

caused

2010-02-23 09:25:10

It should still work though. I gotta have a testrun with the latest scar lateron :]…

caused

2010-02-26 06:14:35

It still works btw. I may rewrite the Plugin though…

FEAR

2010-02-27 12:13:29

Nice :) But if this was used in a script it has to be without S.M.A.R.T :( But I guess it can be used if up-text goes crazy again :D

AzulDrake

2010-08-05 08:45:47

Sorry for grave digging the thread, but I've been using this alot and now with Simba release, I'd like to start using it with Simba.

As I don't play Runescape, I use the GetCursor function to harvest on Eternal lands. Unfortunately this does not work in Simba. I have added the DLL to the plugins directory and the cursor.scar in the includes directory in Simba, but no luck. Is the GetCursor function something in Scar and not yet implemented in Simba or am I barking up the wrong tree?

Regards

Nava2

2010-08-05 09:49:13

Based on the Assumption of this was written for SCAR, it will have been written in Delphi, thus would have to be ported into FPC before being used with Simba.

Also, I believe the use of plugins is different for using with Simba.