SRL Archive - First Scripts

Chicken Killer / Feather Collect


dicheddarib

2015-03-06 03:36:41

I know it sounds silly beings how you can get really cheap feathers from the Fisherman, however there is a cap on per day 1k buying from them.

So, I have a fletcher running right now and I noticed that Headless Shaft prices tanked, as a solution in efforts to maintain some decent income, the need to farm feathers is REAL.

Started the script, however im not understanding the scripting process very well even with coding experience. some help with it would be great.

There is potential.



filled in skeleton, alot of wait periods for trial mode.. came up with Error: Don't know which overloaded method to call with params (Int32, Int32, Int32, *unknown*, Int32) at line 37
also took some thought and will add good anti-ban, and pathing whenever I learn and understand better of the scripting process



UPLOADED UPDATED!! IT WORKS kinda.. please help LOL

xBeta

2015-03-06 09:17:56

villavu.com/forum/showthread.php?t=107757

try reading this bro

Renzanity

2015-03-06 09:30:22

And this one if you're having a little trouble with the other link provided.

https://villavu.com/forum/showthread.php?t=109161

Goodluck, champ. :D

the bank

2015-03-06 10:18:33

Good for you that you had the drive to try and make the script! Keep at it, don't give up! Read online resources here, and ask specific questions when you hit a road block. Always try and solve things yourself though, there's nothing more rewarding than figuring out the problem you've been struggling with for hours!

Renzanity

2015-03-06 10:38:25

From: the bank
Good for you that you had the drive to try and make the script! Keep at it, don't give up! Read online resources here, and ask specific questions when you hit a road block. Always try and solve things yourself though, there's nothing more rewarding than figuring out the problem you've been struggling with for hours!


Amen, bro. :norris:

o0Matthius0o

2015-03-06 12:22:03

You finished that quick! Did it only take you that one night?

EDIT: Just looked at the script. Nevermind. lol, ill help you when i get on again.

dicheddarib

2015-03-06 16:56:42

From: o0Matthius0o
You finished that quick! Did it only take you that one night?

EDIT: Just looked at the script. Nevermind. lol, ill help you when i get on again.


the struggle..

dicheddarib

2015-03-06 16:57:53

I am going to attempt to get this up tonight.

EDIT: Finished very rough draft, very basic, however im having troubles still understanding the error codes etc..

Error: Don't know which overloaded method to call with params (Int32, Int32, Int32, *unknown*, Int32) at line 37

reccomendations?

o0Matthius0o

2015-03-06 21:07:12

From: dicheddarib
I am going to attempt to get this up tonight.

EDIT: Finished very rough draft, very basic, however im having troubles still understanding the error codes etc..

Error: Don't know which overloaded method to call with params (Int32, Int32, Int32, *unknown*, Int32) at line 37

reccomendations?


You didnt fill in the parameters correctly. probably forgot a bracket somewhere.

KeepBotting

2015-03-06 21:45:51

From: dicheddarib
I am going to attempt to get this up tonight.

EDIT: Finished very rough draft, very basic, however im having troubles still understanding the error codes etc..

Error: Don't know which overloaded method to call with params (Int32, Int32, Int32, *unknown*, Int32) at line 37

reccomendations?

That means you're passing incorrect parameter types (or amounts) to a function.

"Overloads" are functions within SRL that have the same name, but execute slightly differently and accept different parameters.

So, one function might have five overloads by the same name, and all you have to do to use the one you want is give it the correct parameters for the corresponding overload.

Most of the time, you probably won't even know you're using overloaded functions as they're put into SRL simply to make your life easier: things like accepting a TBox instead of xs, ys, xe, ye variables.

For instance:
Look at all those bankScreen.withdraw() overloads! They are awesome, because they allow us to withdraw by DTM, BMP, slot, mouse-over text… all we need to do is pass the correct params.

At any rate, you error is due to you passing the wrong paramaters to an overloaded function. The script looks at every possible overload for that function - but the combination of parameters you're using doesn't match any of them! SRL freaks out at throws an error.

The fact that you've got an unknown paramater in there means you've probably got it right, but just typed something wrong or missed a bracket at Matthius said. Go to line 37 and see if there's anything glaringly obvious. If you can't get it, post the line here and we can help you out.

Trollcrank

2015-03-06 23:32:18

So I actually looked at the code and found the problem. Basically you forgot/didn't put a comma after a paramater(aka a number or word)

mainscreen.findObject(x, y, 725853, 10 ['Chicken'], MOUSE_LEFT);
//Change this to this: //look right here, I added a comma after 10
mainscreen.findObject(x, y, 725853, 10, ['Chicken'], MOUSE_LEFT);
You also did that with the other mainscreen.findObject in the the script.

dicheddarib

2015-03-07 15:10:32

I got the script to run without errors.. so thats a plus. however, how do i get it to work through SMART?

Clutch

2015-03-07 19:16:03

I may be wrong here but
program new;
{$DEFINE SMART}
{$I SRL-6/SRL.simba}

I'm still learning but I believe this is what you need. You can refer to this - https://villavu.com/forum/showthread.php?t=109161

dicheddarib

2015-03-07 19:25:18

From: Trollcrank
So I actually looked at the code and found the problem. Basically you forgot/didn't put a comma after a paramater(aka a number or word)

mainscreen.findObject(x, y, 725853, 10 ['Chicken'], MOUSE_LEFT);
//Change this to this: //look right here, I added a comma after 10
mainscreen.findObject(x, y, 725853, 10, ['Chicken'], MOUSE_LEFT);
You also did that with the other mainscreen.findObject in the the script.


i updated the new script mind going and checking it out?

dicheddarib

2015-03-08 03:52:35

From: KeepBotting
That means you're passing incorrect parameter types (or amounts) to a function.

"Overloads" are functions within SRL that have the same name, but execute slightly differently and accept different parameters.

So, one function might have five overloads by the same name, and all you have to do to use the one you want is give it the correct parameters for the corresponding overload.

Most of the time, you probably won't even know you're using overloaded functions as they're put into SRL simply to make your life easier: things like accepting a TBox instead of xs, ys, xe, ye variables.

For instance:
Look at all those bankScreen.withdraw() overloads! They are awesome, because they allow us to withdraw by DTM, BMP, slot, mouse-over text… all we need to do is pass the correct params.

At any rate, you error is due to you passing the wrong paramaters to an overloaded function. The script looks at every possible overload for that function - but the combination of parameters you're using doesn't match any of them! SRL freaks out at throws an error.

The fact that you've got an unknown paramater in there means you've probably got it right, but just typed something wrong or missed a bracket at Matthius said. Go to line 37 and see if there's anything glaringly obvious. If you can't get it, post the line here and we can help you out.



hey mind checking out the script? it works.. but only a little.. lol

Renzanity

2015-03-08 04:07:01

I think it'd work a little bit better if you use this more elaborate findObj function.


mainscreen.findObject(var ix, iy: integer; col, tol: integer; colSettings: TColorSettings; sortFrom: TPoint; objWidth, objHeight, minCount: integer; mouseOverText: TStringArray; mouseAction: integer = MOUSE_LEFT)

ix, iy: The coordinates of the object if found (note this is an output variable).
col: The color to be found - this is the color from ACA.
tol: The tolerance of the color - this is the HSL Tol from ACA.
colSettings: The color settings are presented in parentheses (CTS, hue, sat) - these are from ACA.
sortFrom: The TPoint where you want it to sort the array from (don't worry too much about this now - I explain this in my TPA/ATPA sub-tutorial below).
objWidth: The width (in pixels) of the object you're trying to find.
objHeight: The height (in pixels) of the object you're trying to find.
minCount: The minimum number of pixel that must match your color on a single object.
mouseOverText: The mouseOverText of the object.
mouseAction: The action of the mouse. Default is MOUSE_LEFT, but you could also have MOUSE_RIGHT, MOUSE_MOVE.


To find the deposit box I'm going to use this:

mainscreen.findObject(x, y, 5270142, 5, colorSetting(2, 0.07, 0.15), mainscreen.playerPoint, 30, 50, 50, ['eposit', 'box'], MOUSE_LEFT)

I am searching for the color 5270142
with a tolerance of 5
I'm using CTS2 with a hue of 0.07 and sat of 0.15
I'm sorting the matching TPoints from my player
My object has a width of about 30 pixels
My object has a height of about 50 pixels
I want it to find at least 50 matching pixels
The mouseOverText is 'eposit' or 'box'
I'm left clicking the mouse (I could leave this blank as MOUSE_LEFT is actually default)


I'm actually working on making this too. Though I can't figure out how to make it stop checking the same drop all of the time. Goodluck, mate. :norris: