runw
2012-12-02 12:32:55
Ok, currently I'm experimenting with Simba and working towards making a mining bot for an rsps.
This thread caught my eye: http://villavu.com/forum/showthread.php?t=60451
So I gave it a shot in a hope to create the correct UpTexts for the rsps ingame.
My aim was to help Simba recognise the UpText Font when the mouse hovers over an iron ore rock: The UpText would be 'Mine Rocks / 3 more options'.
I created a new folder named 'RspsUpChars' and placed it in the directory: 'C:\Simba\Fonts'. Within this folder I have the individual .bmp files for the letters: M, i, n, e, R, o, c, k, s. I didn't feel the need to have every letter in the alphabet since I just want this to work for a mining bot.
Now, I'm assuming if I restart Simba that the fonts will load and be implemented into Simba.. so to test if my rsps UpText works I made this script:
When I ran the script the mouse would search for the object and jump from rock to rock but never recognising the UpText.
At this point I took a look at the UpChars folder (in directory 'C:\Simba\Fonts') and noticed that the images had a red fill for the shadows of the letters. So I created a new set of bmp files for the letters 'M, i, n, e, R, o, c, k, s', this time including the shadows in a red fill (code = 255).
After running the script again, it's the same as before: the mouse will jump between rocks but never identifying the UpTexts and so never right clicking and left clicking the option to mine the rocks :(
I'd really appreciate if someone nudged me in the right direction, I'm new to Simba and scripting so for any help offered I give my thanks in advance :)
Oh and this is what my Bmps look like (rescaled heavily.. ^^):

EDIT: I took a good look at the Bpms that are already in Simba in the UpChars folder and found that they were all 14 pixels in height and had 3 pixels below the letter itself, so I did my Bpms of the rsps again and this is what it looks like:

Thanks to Wardancer who assisted me in IRC chat I found that I could use the GetTextAtExWrap function to show me what Simba was seeing in the UpText section (i.e. the top left corner of the client).
0, 0, 90, 25 - The coords where Simba will look for any text, 90 units across 25 down from top left corner of client screen covers the UpText area for 'Mine Rocks'.
0, 10, 1 - Spacing (I have no idea what the spacing is suppose to be or if it's even right).
12896199, 50 - The color and tolerance of the UpText (color I selected was the white/grey ish color in the UpText 'Mine' ingame.
RspsUpChars - The folder in directory 'C:\Simba\Fonts' where my Bmps are for the letters M, i, n, e, R, o, c, k, s.
Using this code I was able to move my mouse over the rocks to bring up the UpText 'Mine Rocks'. However in the debug box I was returned: 'scscn' and sometimes 'scsc' instead of 'Mine'. Has anyone got any idea what I'm suppose to do?
Edit: Fixed, used LoadFont(RspsUpChars, True); at the beginning of my GetText procedure before the wait and it worked :) Thank you Hobbit !
This thread caught my eye: http://villavu.com/forum/showthread.php?t=60451
So I gave it a shot in a hope to create the correct UpTexts for the rsps ingame.
My aim was to help Simba recognise the UpText Font when the mouse hovers over an iron ore rock: The UpText would be 'Mine Rocks / 3 more options'.
I created a new folder named 'RspsUpChars' and placed it in the directory: 'C:\Simba\Fonts'. Within this folder I have the individual .bmp files for the letters: M, i, n, e, R, o, c, k, s. I didn't feel the need to have every letter in the alphabet since I just want this to work for a mining bot.
Now, I'm assuming if I restart Simba that the fonts will load and be implemented into Simba.. so to test if my rsps UpText works I made this script:
program CheckFont;
{$i SRL\SRL.simba}
function CheckText:boolean;
var
X, Y: Integer;
begin
if FindObj(X, Y, [COLOR="Red"]'ine'[/COLOR], 1186611, 20) then [COLOR="Blue"]//Only using the UpText 'ine' in 'Mine' to test this[/COLOR]
begin
Mouse(X, Y, 5, 5, false); [COLOR="Blue"]//Right clicks the rock[/COLOR]
Mouse(X, Y+25, 5, 5, true); [COLOR="blue"]//Left clicks option 'Mine Rocks' (Later hope to use Option or WaitOption functions
if I can get a hang of creating fonts..)[/COLOR]
end;
end;
begin
CheckText;
end.When I ran the script the mouse would search for the object and jump from rock to rock but never recognising the UpText.
At this point I took a look at the UpChars folder (in directory 'C:\Simba\Fonts') and noticed that the images had a red fill for the shadows of the letters. So I created a new set of bmp files for the letters 'M, i, n, e, R, o, c, k, s', this time including the shadows in a red fill (code = 255).
After running the script again, it's the same as before: the mouse will jump between rocks but never identifying the UpTexts and so never right clicking and left clicking the option to mine the rocks :(
I'd really appreciate if someone nudged me in the right direction, I'm new to Simba and scripting so for any help offered I give my thanks in advance :)
Oh and this is what my Bmps look like (rescaled heavily.. ^^):

EDIT: I took a good look at the Bpms that are already in Simba in the UpChars folder and found that they were all 14 pixels in height and had 3 pixels below the letter itself, so I did my Bpms of the rsps again and this is what it looks like:

Thanks to Wardancer who assisted me in IRC chat I found that I could use the GetTextAtExWrap function to show me what Simba was seeing in the UpText section (i.e. the top left corner of the client).
procedure GetText;
begin
Wait(5000);
writeln((ExtractFromStr((replace((lowercase(GetTextAtExWrap([COLOR="red"]0[/COLOR], [COLOR="red"]0[/COLOR], [COLOR="red"]90[/COLOR], [COLOR="Red"]25[/COLOR], [COLOR="Blue"]0[/COLOR], [COLOR="blue"]10[/COLOR], [COLOR="blue"]1[/COLOR], [COLOR="Green"]12896199[/COLOR], [COLOR="green"]50[/COLOR], [COLOR="DarkOrchid"]RspsUpChars[/COLOR]))), '.!', 'i')), Letters)));
end;0, 0, 90, 25 - The coords where Simba will look for any text, 90 units across 25 down from top left corner of client screen covers the UpText area for 'Mine Rocks'.
0, 10, 1 - Spacing (I have no idea what the spacing is suppose to be or if it's even right).
12896199, 50 - The color and tolerance of the UpText (color I selected was the white/grey ish color in the UpText 'Mine' ingame.
RspsUpChars - The folder in directory 'C:\Simba\Fonts' where my Bmps are for the letters M, i, n, e, R, o, c, k, s.
Using this code I was able to move my mouse over the rocks to bring up the UpText 'Mine Rocks'. However in the debug box I was returned: 'scscn' and sometimes 'scsc' instead of 'Mine'. Has anyone got any idea what I'm suppose to do?
Edit: Fixed, used LoadFont(RspsUpChars, True); at the beginning of my GetText procedure before the wait and it worked :) Thank you Hobbit !
selected area where pixels does't match, have no idea how to get that with recaling so it may cause problems thats. idk :D maybe not a big deal and it appeared after rescaling though