PDA

View Full Version : [F-Include] Chicken Slayer, Featherer, Prayer, and Cooker



jacoby6000
04-24-2016, 01:36 AM
Hey guys! I originally joined SRL forever ago, but never contributed anything (Except for a few VERY dodgy fixes to old scripts), and now I'm back with something marginally useful!

This is a Chicken Slayer for the Chicken Pen that has the cooking pot in the nearby house in Lumbridge. This script will train combat, prayer, and cooking skills while collecting feathers.

The cooking portion needs some work to help with efficiency, but it works as it is.

This script has some anti-ban in it, but not a ton. Breaking has not been implemented yet.

Road map



Drop FInclude
Improve Cooking
Improve Walking Procedure
More "humanness"


Long term goals

Add Woodcutting training
Add Firemaking training
Add Fighting other mobs (cows/goblins)
Add Food Consumption
Add Mining?
Add Fishing?



Changelog


V1.1

Added breaking
Fixed typo "Defense" to "Defence"
Minor improvement to the cooking phase. Detects when it gets lost and tries to fix it.

V1.0

Initial Release




F-Include
You will need Fitta's F-Include (https://github.com/MichaelHarkins/finclude).
To install, download the file at this link (https://github.com/MichaelHarkins/finclude/archive/master.zip), then extract the zip file to "finclude" inside of the Simba Includes directory.

SEND EMAIL ISSUES / Pro_InitSocket
If you use the revision of unofficial F-include i have linked, you will not have this issue, otherwise read below.

There is currently a PR open to fix this https://github.com/FittaVillavu/finclude/pull/1/files
Go vote for that first, then read below.

If you are having an Error with the SendEmail procedure / Pro_InitSocket, you can get around it by fixing the procedure body for the SendEmail procedure whose definition begins on Line 4 of the Socks file.

procedure SendEmail(URL, Email, Password, Name, Recipient, CC, BCC, Subject, Message, Attachment, AttachmentMime: String);
var
Sock: SSLSocket;
begin
Sock.Init();
Sock.SetSecurityPolicy(false, false, true);
Sock.SetVerbose(true);
Sock.SMTP(PChar(URL), PChar(Email), PChar(Password), PChar(Name), PChar(Recipient), PChar(CC), PChar(BCC), PChar(Subject), PChar(Message), PChar('text/plain; charset=UTF-8'), PChar(Attachment), PChar(AttachmentMime));
Sock.Free();
end;



Sample Report


[15:40:06:655] [Chicken Slayer] [Status] +---------------------------------v1.1-+
[15:40:06:656] [Chicken Slayer] [Status] | |
[15:40:06:658] [Chicken Slayer] [Status] | Chickens Killed: 804 |
[15:40:06:660] [Chicken Slayer] [Status] | Feathers Collected: 3870 |
[15:40:06:662] [Chicken Slayer] [Status] | Bones Buried: 370 |
[15:40:06:665] [Chicken Slayer] [Status] | |
[15:40:06:668] [Chicken Slayer] [Status] | Attack Levels Gained: 11 |
[15:40:06:671] [Chicken Slayer] [Status] | Strength Levels Gained: 0 |
[15:40:06:674] [Chicken Slayer] [Status] | Defence Levels Gained: 0 |
[15:40:06:678] [Chicken Slayer] [Status] | Prayer Levels Gained: 8 |
[15:40:06:681] [Chicken Slayer] [Status] | Cooking Levels Gained: 13 |
[15:40:06:685] [Chicken Slayer] [Status] | |
[15:40:06:689] [Chicken Slayer] [Status] | Time Elapsed: 0d 9h 38m 50s |
[15:40:06:693] [Chicken Slayer] [Status] | Breaking In: 0d 0h 29m 32s |
[15:40:06:697] [Chicken Slayer] [Status] | |
[15:40:06:701] [Chicken Slayer] [Status] +---------------------------------v1.1-+

jstemper
04-24-2016, 02:55 AM
that is some nicely annotated code man. You might want to tell users how to fix the Pro_InitSocket error on this thread though

jacoby6000
04-24-2016, 03:26 AM
Thanks! I tried to make it a point to annotate most of the code that actually does something. I don't usually use Pascal/Lape, so it's more for me than for you ;). Anyway, there are likely bugs in this script! It's my first real contribution to the community. Please let me know if you see any issues.

Ah, right. Thanks for pointing that out. I had forgot that I went through that.

I'll post this in the OP as well.

If you are having an Error with the SendEmail procedure, you can get around it by deleting the procedure body for the SendEmail procedure whose definition begins on Line 4 of the Socks file. Note: This will mean that no simba scripts will be able to send emails! This is not a permanent fix, but if you don't care about scripts sending emails, then it should be fine. Here's what it should look like after your edit


Procedure SendEmail(URL, Email, Password, Name, Recipient, CC, BCC, Subject, Message, Attachment, AttachmentMime: String);
begin

end;

Turpinator
04-24-2016, 03:47 AM
Thanks! I tried to make it a point to annotate most of the code that actually does something. I don't usually use Pascal/Lape, so it's more for me than for you ;). Anyway, there are likely bugs in this script! It's my first real contribution to the community. Please let me know if you see any issues.

Ah, right. Thanks for pointing that out. I had forgot that I went through that.

I'll post this in the OP as well.

If you are having an Error with the SendEmail procedure, you can get around it by deleting the procedure body for the SendEmail procedure whose definition begins on Line 4 of the Socks file. Note: This will mean that no simba scripts will be able to send emails! This is not a permanent fix, but if you don't care about scripts sending emails, then it should be fine. Here's what it should look like after your edit


Procedure SendEmail(URL, Email, Password, Name, Recipient, CC, BCC, Subject, Message, Attachment, AttachmentMime: String);
begin

end;


You could just add Procedure SendEmail(URL, Email, Password, Name, Recipient, CC, BCC, Subject, Message, Attachment, AttachmentMime: String); override;
begin
end;
to your script and it would require no edit to the files.

jacoby6000
04-24-2016, 04:31 AM
You could just add Procedure SendEmail(URL, Email, Password, Name, Recipient, CC, BCC, Subject, Message, Attachment, AttachmentMime: String); override;
begin
end;
to your script and it would require no edit to the files.

I tried that just now, and it doesn't appear to work. I assume this is because Lape processes all of the files from the include before continuing on and reading my script.

tls
04-24-2016, 04:34 AM
I tried that just now, and it doesn't appear to work. I assume this is because Lape processes all of the files from the include before continuing on and reading my script.

It's interpreted/parsed top down, and includes are at the top.

jacoby6000
04-24-2016, 04:36 AM
Right. Which would explain why defining my own SendEmail would not fix this.

slacky
04-24-2016, 02:07 PM
Right. Which would explain why defining my own SendEmail would not fix this.
You can override a method anywhere after the original method is declared and it will be used instead. You just gotta make sure it matches the original method header perfectly (you can't change any parameters).


{$X+}
procedure Foo(k:Int32);
begin
WriteLn(k); //will not be called directly
end;

Foo(10); //call Foo (will call the one bellow)

procedure Foo(k:Int32); override;
begin
Write('overridden! ');
inherited; //call the parent method
end;

Foo(10); //call Foo again

jacoby6000
04-24-2016, 03:48 PM
The problem is, Lape never even gets to compiling my file. It fails to compile the Socks.simba file contained in F-Include, because it has an invalid implementation. I can override the implementation all I want, but if it can't compile F-Include, it won't matter.

I've tried what you suggested, and still get the same error.


Error: Unknown declaration "Pro_InitSocket" at line 9
Compiling failed.


from this declaration (in Socks.simba from F-Include)


Procedure SendEmail(URL, Email, Password, Name, Recipient, CC, BCC, Subject, Message, Attachment, AttachmentMime: String);
var
Sock: SSLSocket;
begin
Pro_InitSocket(Sock, nil, nil, nil, nil); // Error here
Pro_CreateSocket(Sock, ''); // Probably also here and every line below, but it fails on the above line
Pro_SetSSL(Sock, false, false, true);
Pro_SetVerbose(Sock, true);
Pro_SMTP(Sock, PChar(URL), PChar(Email), PChar(Password), PChar(Name), PChar(Recipient), PChar(CC), PChar(BCC), PChar(Subject), PChar(Message), PChar('text/plain; charset=UTF-8'), PChar(Attachment), PChar(AttachmentMime));
Pro_FreeSocket(Sock);
end;


Even with this override in my code


{
Override the Socks SendEmail procedure, in an attempt to get rid of the errors.
}
Procedure SendEmail(URL, Email, Password, Name, Recipient, CC, BCC, Subject, Message, Attachment, AttachmentMime: String); override;
begin
end;

slacky
04-24-2016, 04:06 PM
The problem is, Lape never even gets to compiling my file. It fails to compile the Socks.simba file contained in F-Include, because it has an invalid implementation. I can override the implementation all I want, but if it can't compile F-Include, it won't matter.

I've tried what you suggested, and still get the same error.


Error: Unknown declaration "Pro_InitSocket" at line 9
Compiling failed.


from this declaration (in Socks.simba from F-Include)


Procedure SendEmail(URL, Email, Password, Name, Recipient, CC, BCC, Subject, Message, Attachment, AttachmentMime: String);
var
Sock: SSLSocket;
begin
Pro_InitSocket(Sock, nil, nil, nil, nil); // Error here
Pro_CreateSocket(Sock, ''); // Probably also here and every line below, but it fails on the above line
Pro_SetSSL(Sock, false, false, true);
Pro_SetVerbose(Sock, true);
Pro_SMTP(Sock, PChar(URL), PChar(Email), PChar(Password), PChar(Name), PChar(Recipient), PChar(CC), PChar(BCC), PChar(Subject), PChar(Message), PChar('text/plain; charset=UTF-8'), PChar(Attachment), PChar(AttachmentMime));
Pro_FreeSocket(Sock);
end;


Even with this override in my code


{
Override the Socks SendEmail procedure, in an attempt to get rid of the errors.
}
Procedure SendEmail(URL, Email, Password, Name, Recipient, CC, BCC, Subject, Message, Attachment, AttachmentMime: String); override;
begin
end;

I see, yes you can't escape compilation errors, in any way.
ProSocks version F-Include relies on is an older version, it's that or you have an older version, but my money is on the one in F-Include.

You might wanna just drop F-Include, and just use reflection it self. Not sure if anyone is actually maintaining F-Include. Can't be of much help outside this, I don't use "ProSocks" nor do I touch the reflection lib.

AFools
04-24-2016, 04:19 PM
"F include"


const
mail_AtTerminate = 1;
mail_AtError = 2;

Procedure SendEmail(URL, Email, Password, Name, Recipient, CC, BCC, Subject, Message, Attachment, AttachmentMime: String);
var
Sock: SSLSocket;
begin
Pro_InitSocket(Sock, nil, nil, nil, nil);
Pro_CreateSocket(Sock, '');
Pro_SetSSL(Sock, false, false, true);
Pro_SetVerbose(Sock, true);
Pro_SMTP(Sock, PChar(URL), PChar(Email), PChar(Password), PChar(Name), PChar(Recipient), PChar(CC), PChar(BCC), PChar(Subject), PChar(Message), PChar('text/plain; charset=UTF-8'), PChar(Attachment), PChar(AttachmentMime));
Pro_FreeSocket(Sock);
end;

Procedure SendEmail(URL, Email, Password, Name, Recipient, CC, BCC, Subject, Message: String); overload;
begin
SendEmail(URL, Email, Password, Name, Recipient, CC, BCC, Subject, Message, '', '');
end;

Procedure SendEmail(URL, Email, Password, Name, Recipient, Subject, Message: String); overload;
begin
SendEmail(URL, Email, Password, Name, Recipient, '', '', Subject, Message);
end;

Updated Finclude





const
mail_AtTerminate = 1;
mail_AtError = 2;

function SendEmail(Url: string): string;
var
S: SSLSocket;
Res: ProMemoryStruct;
begin
S.Init();
S.SetURLFollow(true);
S.SetURL(URL);
S.DoGet(Res);
SetLength(Result, Res.Size);
MemMove(Res.Memory^, Result[1], Res.Size);
S.Free;
end;

Procedure SendEmail(URL, Email, Password, Name, Recipient, CC, BCC, Subject, Message: String); overload;
begin
SendEmail(URL);
end;

Procedure SendEmail(URL, Email, Password, Name, Recipient, Subject, Message: String); overload;
begin
SendEmail(URL, Email, Password, Name, Recipient, '', '', Subject, Message);
end;


Compiles and was sending email reports some months ago. I haven't updated either 'my custom finclude or prosocks' and can't remember if i did anything else.

jacoby6000
04-24-2016, 04:52 PM
There already exists a fork (And a pull request) which contains a fix https://github.com/MichaelHarkins/finclude
I'll probably just link to that fork instead of the official F-include, which hasn't been updated in 10 months.

EDIT: Updated OP

Laquisha
04-24-2016, 11:59 PM
If you want some good advice, drop f-include and never touch it again.

Fitta threw it together because the reflection include was missing some functionality at the time (because elfyyy was very stubborn about adding new code). When people start making 'spin-off' includes obviously the official include is lacking some important material. Since then, elfyyy has added a whole bunch of new things to reflection (antiban etc.). Using these custom includes requires people to download extra clutter, they have 1-2 developers so will eventually die, and nobody can be bothered to learn methods from multiple includes meaning nobody will use it to develop scripts (I think you're the first person to use the f-include since fitta).

P.S. I like your script, but your whole states thing seems overly complicated. Surely you could come up with 10 lines of logic to direct the script?

tls
04-25-2016, 12:07 AM
If you want some good advice, drop f-include and never touch it again.

Fitta threw it together because the reflection include was missing some functionality at the time (because elfyyy was very stubborn about adding new code). When people start making 'spin-off' includes obviously the official include is lacking some important material. Since then, elfyyy has added a whole bunch of new things to reflection (antiban etc.). Using these custom includes requires people to download extra clutter, they have 1-2 developers so will eventually die, and nobody can be bothered to learn methods from multiple includes meaning nobody will use it to develop scripts (I think you're the first person to use the f-include since fitta).

P.S. I like your script, but your whole states thing seems overly complicated. Surely you could come up with 10 lines of logic to direct the script?

States may add some bloat code, but they definitely help you think about and understand the flow of the script better(especially when you pick up code you haven't touched in a while).

Laquisha
04-25-2016, 12:54 AM
States may add some bloat code, but they definitely help you think about and understand the flow of the script better(especially when you pick up code you haven't touched in a while).

Not true at all, if anything it is actually the exact opposite (in this case). Are you saying that understanding the flow of a script by tracking ambiguous states, integers that represent these states, and jumping back and forth through the script to see how these integers change is easier than say:


if inventoryFull() then
begin
buryBones();
cookFood();
end else
begin
fightChickens();
loot();
end;


Also, overly complicated <> bloat, although in most cases they do go together.

tls
04-25-2016, 02:02 AM
I honestly haven't even looked at the script. Obviously in this case it is pretty simple(I'm guessing), and he did over complicate it.

AFools
04-25-2016, 04:47 AM
If you want some good advice, drop f-include and never touch it again.

Fitta threw it together because the reflection include was missing some functionality at the time (because elfyyy was very stubborn about adding new code). When people start making 'spin-off' includes obviously the official include is lacking some important material. Since then, elfyyy has added a whole bunch of new things to reflection (antiban etc.). Using these custom includes requires people to download extra clutter, they have 1-2 developers so will eventually die, and nobody can be bothered to learn methods from multiple includes meaning nobody will use it to develop scripts (I think you're the first person to use the f-include since fitta).

P.S. I like your script, but your whole states thing seems overly complicated. Surely you could come up with 10 lines of logic to direct the script?

Errmmm i agree we shouldn't be trying to form more includes; as the two we currently have are great. With both (AL + Reflection) authors willing and able to add contributions if needed. BUT!

I found Fitta; include easier to find functions; it saved me a lot of time. Plus his coding 'style' is simply eloquent in many cases.

I migrated some of his functions back to the standard include... this familiarized myself with the standard include.

Laquisha
04-25-2016, 10:24 AM
Errmmm i agree we shouldn't be trying to form more includes; as the two we currently have are great. With both (AL + Reflection) authors willing and able to add contributions if needed. BUT!

I found Fitta; include easier to find functions; it saved me a lot of time. Plus his coding 'style' is simply eloquent in many cases.

I migrated some of his functions back to the standard include... this familiarized myself with the standard include.

You are absolutely right about it saving you time; the extra methods in f-include made it easier to write scripts. Fitta’s include is essentially a bunch of useful functions that were used in most reflection scripts (i.e. InteractTile) and some other useful stuff from previous versions of SRL.

This is the reason why it was developed in the first place (see my post above). Include developers (not limited to elfyyy) can be very particular about what code should go in the include. People like to keep it clean, simple, and “not let the include do all the work”. The problem is people end up copying and pasting a stack of methods into every script, so it is just common sense to add methods like these into the include (which is what eventually happened here). It is a common occurrence that people who think logically (i.e., mathematicians/physicists/programmers) lack a bit of common sense :p

Include developers need to take feedback on board and modify includes to suit scripters, rather than being ‘purists’, because at the end of the day an include is for scripters, isn’t it? An include that is easier to use = more people using it = more scripts = more community activity.

Reflection will survive but I can see AeroLib being phased out, and replaced with the hybrid include. It would be nice to see Reflection added back into the SRL repository, and integrated with the hybrid include, so all developers can work together once again (which hasn’t happened since the release of OSR). But that’s a discussion for another time and another thread.

jacoby6000
04-25-2016, 11:38 AM
I've updated the OP, v1.1 is out!

I've added "Drop FInclude" as the next part of the road map. I'll try to work that in.

I do not agree that using a Finite State Machine is something that overcomplicates a system which has state. Especially whenever you consider that to achieve more human-ish behavior, you have to be able to go from any state to any other state.

Determining your state by a bunch of if/else/if/else/if statements is going to get insanely complex insanely fast, and more than anything else, will be very tightly coupled to some conditions you thought of up front.

The state of this is much more complicated than

if inventoryFull() then
begin
buryBones();
cookFood();
end else
begin
fightChickens();
loot();
end;


Writing scripts like this is only fine if you don't care about your player looking completely robotic. This tightly couples your flow of state to your main loop. Using an FSM the way that I have, the application flow is determined by the current state that it's in.

With the system I have, there is a TINY bit of setup to assign each state to an integer which is clearly named. After that small initial setup, I can exit from any state to any other state. If I want to go from wherever I am to.. burying bones, I just run Exit(PRAYING);

The boilerplate that sets up the FSM might be confusing or convoluted because it's so abstract, but it's a small price (maybe 20 lines of code... Most real world systems have thousands of lines of boilerplate) for so easily being able to change states around. Not to mention, adding more states isn't as prone to error as if I had to chain several if/else blocks. Another cool side-effect of this is, if I wanted to, the flow of the application could be represented as a Markov Chain... so that's nice I guess.

I really hate having to justify this here, whenever FSMs are something that have been used in the industry for decades and are widely accepted as good practice.

EDIT:

Surely you could come up with 10 lines of logic to direct the script?

Here's my attempt to represent the application flow in ifs and elses... still ugly without a proper FSM implementation

I'm really not sure how you'd represent any of this if you drop the idea of states at all though


procedure MainLoop;
begin
if(state = fighting) then
begin

if(inv.isFull) then
begin
state = praying;
exit;
end;

fightChicken;
loot;

if (Random(100) > 80) then
begin
state = looting;
exit;
end;

if (Random(100) > 95) then
begin
state = praying;
exit;
end;

end else if(state = praying) then
begin
if(not invHasBones) then
begin
state = cooking;
exit;
end;

buryBones;

if(Random(100) > 80) then
begin
state = cooking;
exit;
exit;

state = fighting;
end else if(state = cooking) then
cookAllFood;
dropAllFood;

state = fighting;
end else if(state = looting) then
loot;

if(Random(100) > 70) then
state = fighting;
end;
end;


And if I were to have written it that way, then adding more states or modifying behavior means decomposing that if-else in my head. With an FSM, I just go to the functions whose behaviors I want to change, and I also don't have to worry about all the crazy logic that's actually going on. I never even conceptualized the above if-else chain til now. And it was much harder to do that than it was just telling the code to exit to other states. The construction of the above logical construct is just a happy side-effect of the way the code is written, and it's flow through different states looks relatively human.

nt4rz
04-25-2016, 01:44 PM
Can you please help me.. When i try to run the script i get this all the time:
Error: Unknown declaration "Pro_InitSocket" at line 9
Compiling failed.

I've even tried to download and replace it..

jacoby6000
04-25-2016, 01:58 PM
Can you please help me.. When i try to run the script i get this all the time:
Error: Unknown declaration "Pro_InitSocket" at line 9
Compiling failed.

I've even tried to download and replace it..

There are details in the OP about how to fix this, but I've also placed it below.

Replace the broken procedure (which contains the line with the error) with the following


procedure SendEmail(URL, Email, Password, Name, Recipient, CC, BCC, Subject, Message, Attachment, AttachmentMime: String);
var
Sock: SSLSocket;
begin
Sock.Init();
Sock.SetSecurityPolicy(false, false, true);
Sock.SetVerbose(true);
Sock.SMTP(PChar(URL), PChar(Email), PChar(Password), PChar(Name), PChar(Recipient), PChar(CC), PChar(BCC), PChar(Subject), PChar(Message), PChar('text/plain; charset=UTF-8'), PChar(Attachment), PChar(AttachmentMime));
Sock.Free();
end;


I'm working to get rid of FInclude so that this is no longer an issue.

Laquisha
04-25-2016, 09:01 PM
I really hate having to justify this here, whenever FSMs are something that have been used in the industry for decades and are widely accepted as good practice.

You don’t have to justify anything; it was merely a suggestion but I’m actually glad that you thought about it in this level of detail. Although, when you bought up FSMs, I’m surprised you didn’t recognise the significance of the 9 lines of code I suggested (they could be interpreted as a FSM, albeit implemented with a greater degree of simplicity). The player having a full inventory is a ‘state’ is it not?


if inventoryFull() then
begin
buryBones();
cookFood();
end else
begin
fightChickens();
loot();
end;



Determining your state by a bunch of if/else/if/else/if statements is going to get insanely complex insanely fast, and more than anything else, will be very tightly coupled to some conditions you thought of up front.

It only needs to be complicated if you make it, and for this particular case, it doesn’t need to get more complicated than those 9 lines of code. What if I told you that these 9 lines of code did exactly the same thing as all of the state logic in your script? I’m surprised you think the script flow of these 9 lines are bound by stricter conditions than your FSM. When designing a FSM, you have to have very well defined criteria when moving from one state to another, which is exactly what you have (and I have). Your states are based on exactly the same criteria mine are (see below for example).


Writing scripts like this is only fine if you don't care about your player looking completely robotic. This tightly couples your flow of state to your main loop. Using an FSM the way that I have, the application flow is determined by the current state that it's in.

You are basing this idea on the premise that your script will perform differently when using your FSM as opposed to the 9 lines of code I posted. Whilst your script logic is based on actual state variables, it still implements your methods in a static circular fashion; the same methods are called in the same order every loop. How is this different from the 9 lines of code I posted? This is not something wrong with your logic, it is just the nature of runescape itself; it is a set of predictable repetitive tasks.

Let me give you an example:

function FightChickens(): Integer;
begin

// Fighting chicken stuff

if(Inv.IsFull) then
Exit(PRAYING);

Exit(Pick(CURRENT_STATE, LOOTING, 45));
end;


In this function you set the state to praying if the inventory is full. That is what the first few lines of my snippet do. If the inventory isn’t full, it may loot, and then it will repeat fighting chickens and looting until the inventory is full. How is that different from my snippet? You are saying your script is more humanlike because you have created physical state variables in your FSM. Based on the above observation that is totally untrue. A few things that would make your script more humanlike are:


Burying the bones when the inventory isn’t full
Rearranging the raw food in the inventory
Rotating the camera
Doing random gametab stuff
Not cooking ‘All’ food every time
Not dropping all the food at the same time, straight after cooking it
Mouse button click times/duration
Etc.


These subtleties are the types of things that make your script more humanlike, not the way you have implemented your FSM.



With the system I have, there is a TINY bit of setup to assign each state to an integer which is clearly named. After that small initial setup, I can exit from any state to any other state. If I want to go from wherever I am to.. burying bones, I just run Exit(PRAYING);

Again, this is hard-coded. You are specifically telling the script to move from A to B. How is that any different from me switching the order of 2 lines in the above snippet?



Here's my attempt to represent the application flow in ifs and elses... still ugly without a proper FSM implementation.

I'm really not sure how you'd represent any of that if you drop the idea of states at all though

It is clear from your code snippet you are thinking about this in the wrong angle. What would happen if you removed all the ‘states’ from this code; the answer is this is the 9 lines of code I posted above. Although, this don’t drop the idea of ‘states’, it just avoids creating physical state variables.

As I said right at the beginning, this was simply a suggestion. If you like your FSM style and it works for you, then use it. Yes, you will sacrifice some readability and intuitive interpretation, but it doesn’t really matter because most people will just run the script without reading to see how it works.

jacoby6000
04-26-2016, 12:56 AM
I still fail to see how using if/else statements will accomplish what I've done in a simpler way, while still being easy to extend the code to implement more states in a non-sequential fashion. The main advantage of what I've done is loose coupling, and it's at very little cost. I don't see what's hard to understand about Exit(COOKING); or Exit(FIGHTING); meaning, exit and go to the X state. Sure, these things are hardcoded. But they're easier to change than mangling a bunch of procedures to change the way stuff gets processed, plus your procedure method is hardcoded anyway, so that's irrelevant. Everything in these scripts is going to be hardcoded except for user input. I'm going to lean on my 8 years of experience here and stick what I have.

kyyskis
04-27-2016, 03:37 PM
was using it today, but found that it get stuck in the house where cooking pot is. After cooking all raw chicken and if the doors are closed, it just clicks to attack chickens and can't get out of the house because the doors are closed and it doesn't open them :) Also its a little bit slow at thinking what to do :) And it changes states too fast, it click on raw chicken, then it should click on pot but instead it clicks to open doors and etc..
p.s. thanks for script, its good to see new scripts :)

jacoby6000
04-28-2016, 03:13 AM
was using it today, but found that it get stuck in the house where cooking pot is. After cooking all raw chicken and if the doors are closed, it just clicks to attack chickens and can't get out of the house because the doors are closed and it doesn't open them :) Also its a little bit slow at thinking what to do :) And it changes states too fast, it click on raw chicken, then it should click on pot but instead it clicks to open doors and etc..
p.s. thanks for script, its good to see new scripts :)

Yeah, the cooking phase definitely needs work. About it getting stuck in the house though... I think 1.1 has a fix for that. If it fails to attack chickens some number of times, it'll figure out that it needs to open the door. But I could be mistaken and I forgot to include that.

kyyskis
04-28-2016, 07:35 AM
Yeah, the cooking phase definitely needs work. About it getting stuck in the house though... I think 1.1 has a fix for that. If it fails to attack chickens some number of times, it'll figure out that it needs to open the door. But I could be mistaken and I forgot to include that.

Also i forgot to mention that sometimes he runs out of chicken pen and it stuck there near the river in the corner with the house and chicken pen fence ant it keeps trying to attack chickens over the fence but its not able to attack them and it keeps standing just like that :)

P.S. Also i forgot to mention that it doesn't start for me, so i run other script first, when other script loads up smart client, then i stop this script and just then i can run your script successfully. This is the error that i get when i try to run your script the normal way:
[10:42:38:907] [Reflection] [Status] Using world 35.
[10:42:39:021] [Reflection] [Fatal] Failed to spawn SMART client.
[10:42:39:030] [Reflection] [Status] All cached references free'd from memory
Successfully executed.

Also few times got this error and script quits:
Error: Access violation at line 144
Execution failed.
The following bitmaps were not freed: [0]

And yes, i think you forgot to add that function that it opens doors if cant reach chickens

NickWord
04-30-2016, 01:17 AM
Ooo the F-include, I like it so far.

Turpinator
04-30-2016, 01:33 AM
Ooo the F-include, I like it so far.

posts on rs3 and osrs threads? Youve got your jr membs, now stop.

NickWord
04-30-2016, 01:47 AM
posts on rs3 and osrs threads? Youve got your jr membs, now stop.

Botting OSRS with osbuddy and RS3 with SMART to get into NXT. However post count was somewhat of importance to me when posting.

Note
05-05-2016, 01:59 AM
Exception in Script: Unable to find file 'Reflection/Reflection.simba' used from 'C:\Simba\Includes\finclude\finclude.simba'
Could i get some assistance with this please.

Thanks

AFools
05-07-2016, 05:41 AM
Exception in Script: Unable to find file 'Reflection/Reflection.simba' used from 'C:\Simba\Includes\finclude\finclude.simba'
Could i get some assistance with this please.

Thanks

You need to install the F include.

Note
05-17-2016, 09:34 AM
You need to install the F include.

I have installed the include provided however upon checking the folder there was no reflection.simba in it.
http://i.imgur.com/nHAH8C2.png

kristi
05-17-2016, 06:49 PM
I have installed the include provided however upon checking the folder there was no reflection.simba in it.
http://i.imgur.com/nHAH8C2.png

Have you installed the reflection include?

Note
05-18-2016, 12:18 PM
Have you installed the reflection include?

Yes i have sir,(i'm running the AIO WOODCUTTER and it works fine) however now im getting a new error

Error: Duplicate declaration "Mouse_MOVE" at line 2
http://i.imgur.com/qslxVDR.png

deffailed
06-15-2016, 06:23 PM
Whats that Mouse_move = 3; error is ! :(

para0714
07-18-2016, 08:42 AM
I have the same error
"
Error: Duplicate declaration "Mouse_MOVE" at line 2
Compiling failed.

"

Aufi
07-18-2016, 09:02 AM
I am not even sure what Mouse_Move = 3 does, but after removing it the script seems to compile. I don't play OSRS anymore so I can't test this myself.

Harrier
07-18-2016, 11:30 AM
I am not even sure what Mouse_Move = 3 does, but after removing it the script seems to compile. I don't play OSRS anymore so I can't test this myself.

Mouse_Left = 1, Mouse_Right = 2, Mouse_Move = 3 (So it's just so it's easier for people to remember/easier for people to learn). Both Mouse_Left and Mouse_Right are included in simba but Mouse_Move isn't so it needs to be included within the include and Mouse_Move (https://github.com/KyleHunter/OSR-Reflection/blob/9808234b9eefda3fa8ceec9f9e03d62da19bf37c/lib/internal/Globals.simba#L506) has been added to reflection and f-include hasn't been updated to reflect this so it gets a dupicate deceation error (You cannot have two global vars with the same name).

prawnqqq
10-17-2016, 04:36 AM
Mouse_Left = 1, Mouse_Right = 2, Mouse_Move = 3 (So it's just so it's easier for people to remember/easier for people to learn). Both Mouse_Left and Mouse_Right are included in simba but Mouse_Move isn't so it needs to be included within the include and Mouse_Move (https://github.com/KyleHunter/OSR-Reflection/blob/9808234b9eefda3fa8ceec9f9e03d62da19bf37c/lib/internal/Globals.simba#L506) has been added to reflection and f-include hasn't been updated to reflect this so it gets a dupicate deceation error (You cannot have two global vars with the same name).

Thanks you helped me to get it working.

Tomazino
01-13-2017, 12:47 PM
Hey guys,

Came back to the business after a long while, I guess I am a newbie again. Didn't really get, how should I edit the script so it would run. I get the same error "Error: Duplicate declaration "Mouse_MOVE" at line 2
Compiling failed.".

Could someone help me with it? I read the last comments, but it wasn't to helpful, still couldn't understand.

rkroxpunk
01-13-2017, 11:35 PM
Hey guys,

Came back to the business after a long while, I guess I am a newbie again. Didn't really get, how should I edit the script so it would run. I get the same error "Error: Duplicate declaration "Mouse_MOVE" at line 2
Compiling failed.".

Could someone help me with it? I read the last comments, but it wasn't to helpful, still couldn't understand.

Find the line mentioned in the post that is four above yours, delete it.

terd
05-02-2017, 10:51 PM
I haven't been able to get the script to pick up feathers, even with feather specified in the loot strings. Otherwise, the script attacks chickens.

lgx
05-19-2017, 01:20 PM
Does this still work? I can't seem to get it to even log me in.

I have made all necessary modifications to get it to compile.

otavioafm
06-05-2017, 12:55 AM
How fix this "Error: Duplicate declaration "Mouse_MOVE" at line 2?

victortjonck
06-05-2017, 12:17 PM
i ran into a problem
i'm a noob at scripting and when i downloaded it i filled in my information and so on

but i keep getting this ''Error: Plugin(prosocks32) has not been found''

i don't know what is causing this error been looking at it for a couple of hours and i don't know it anymore.
someone help me if possible

otavioafm
06-06-2017, 01:53 AM
victor, so maybe a dll from plugins folder on simba directory is missing. But the script is outdated and the var mouse_move is outdated, idk how to repair lets wait for a experiencied member help.

otavioafm
06-06-2017, 03:31 AM
The problem is a second script named of Interact* that apears when I run the script:

const
Mouse_MOVE = 3;

procedure quickMouse(P: TPoint; ClickType: Integer);
begin
Reflect.Mouse.Move(P, 0, 0);
Wait(RandomRange(20, 30));
Reflect.Mouse.Click(ClickType);
end;

function interact(B: TBox; UpText, Option: String; clickType: Integer): boolean;
begin
If (Not locPlayer.isLoggedIn)or(Failed) then
Exit;

Reflect.Mouse.Move(B);

If Reflect.Text.IsUpText(UpText, 50+Random(25))then
begin
If clickType = MOUSE_MOVE then
Exit(True);

Reflect.Mouse.Move(getMousePnt, 0, 0, clickType);
If (clickType = mouse_Right)and(Reflect.Text.ChooseOption(Option, 200+Random(100)))then
Exit(True) else
If (clickType = mouse_Left)then
Exit(True);

end else
begin
If Reflect.Text.IsUpText('Walk here') or (clickType = MOUSE_MOVE) then
Exit(False);
Debug('Looked for "' + UpText + '" in "' + Reflect.Text.GetUpText + '" -> Trying to right click..', False);
Reflect.Mouse.Move(getMousePnt, 0, 0, Mouse_Right);
Result := Reflect.Text.ChooseOption(Option, 200+Random(100));
end;
end;

function interact(P: TPoint; UpText, Option: String; clickType: Integer): boolean; overload;
begin
If (Not locPlayer.isLoggedIn)or(Failed) then
Exit;

Reflect.Mouse.Move(P, 0, 0);

If Reflect.Text.IsUpText(UpText, 50+Random(25))then
begin
If clickType = MOUSE_MOVE then
Exit(True);

Reflect.Mouse.Move(getMousePnt, 0, 0, clickType);
If (clickType = mouse_Right)and(Reflect.Text.ChooseOption(Option, 200+Random(100)))then
Exit(True) else
If (clickType = mouse_Left)then
Exit(True);

end else
begin
If Reflect.Text.IsUpText('Walk here')then
Exit;
Debug('Looked for "' + UpText + '" in "' + Reflect.Text.GetUpText + '" -> Trying to right click..', False);
Reflect.Mouse.Move(getMousePnt, 0, 0, Mouse_Right);
Result := Reflect.Text.ChooseOption(Option, 200+Random(100));
end;
end;

function interactTileOnce(Tile: TPoint; UpText, Option: String; Volume, clickType: Integer; XOffSet: Integer = 0; YOffset: Integer = 0; ZOffset: Integer = 0; WalkHandle: Boolean = True): boolean;
var
P: TPoint;
begin
If (Not locPlayer.isLoggedIn)or(Failed)or(Not TReflectionMap.TileOnMM(Tile))then
Exit;

If (Not TileOnMS(Tile))and(WalkHandle)then
begin
Debug('Tile not on MS -> Walking..', False);
locPlayer.WalkToTileMM(Tile);
Wait(250+Random(200));
waitDistance(Tile, 1);
WaitWalking;
Exit;
end;

P := TReflectionTiles.TileToMS(Tile, XOffset, YOffset, ZOffSet);
Reflect.Math.GaussBox(P.X, P.Y, P.X - Volume, P.Y - Volume, P.X + Volume, P.Y + Volume);
If interact(P, UpText, Option, clickType)then
begin
Exit(True);
afterClick;
end;
end;

function interactTile(Tile: TPoint; UpText, Option: String; Volume, clickType: Integer; XOffset: Integer = 0; YOffset: Integer = 0; ZOffset: Integer = 0): boolean;
var
P: TPoint;
C: Integer;
begin
If (Not locPlayer.isLoggedIn)or(Failed)or(Not TReflectionMap.TileOnMM(Tile))then
Exit;

repeat
If interactTileOnce(Tile, UpText, Option, Volume, clickType, XOffset, YOffset, ZOffset)then
Exit(True)
else
If C > 1 then
randomCompass;
Inc(C);
until(C > 10);
end;

function InteractInvSlot(Slot: Integer; Option: String): boolean;
var
Item: TReflectInvItem;
begin
Item._InvSlot := Slot;
Tab(GameTab_Inventory);
if Interact(Item.GetPoint, Option, Option, mouse_Left)then
Exit(True);
end;

function interactInv(IDs: TIntegerArray; Option: String): boolean;
var
Inv: TReflectInvItemArray;
I: Integer;
begin
If (Not locPlayer.isLoggedIn)or(Failed)then
Exit;

Inv.GetAll;
For I:=0 to High(Inv)do
If InIntArray(IDs, Inv[I].GetID)then
begin
Debug('Correct ID found', False);
Tab(GameTab_Inventory);
if Interact(Inv[I].GetPoint, Option, Option, mouse_Left)then
Exit(True);
end;
end;

function interactInv(Names: TStringArray; Option: String): boolean; overload;
var
Inv: TReflectInvItemArray;
I: Integer;
begin
If (Not locPlayer.isLoggedIn)or(Failed)then
Exit;

Inv.GetAll;
For I:=0 to High(Inv)do
If IsStrInArr(Inv[I].GetName, False, Names)then
begin
Debug('Correct name found', False);
If Not Tab(Gametab_Inventory)then
Exit;
if Interact(Inv[I].GetPoint, Option, Option, mouse_Left)then
Exit(True);
end;
end;

function findBank(BankBooths: TPointArray; UpText, Option: String): boolean;
var
Booths: TPointArray;
CT: TReflectTimer;
timeOut: Integer;
begin
If (Not locPlayer.isLoggedIn)or(Failed) then
Exit;

If Reflect.Bank.isOpen then
Exit(True);

Booths := BankBooths;
SortTPAFrom(Booths, locPlayer.GetTile);

if interactTile(Booths[0], UpText, Option, 8, mouse_Left, 0, 0, 20+Random(30))then
begin
Debug('interact -> Bank Booth', False);
CT.start;
timeOut := 8000+Random(4000);
repeat
Wait(300+Random(200));
Result := (Reflect.Bank.IsOpen)or(Reflect.Bank.IsPinOpen);
until(Result)or(CT.Elapsedtime > timeOut);

If (CT.Elapsedtime > timeOut) then
Exit;

locPlayer.EnterPin;
CT.start;
repeat
Wait(175+Random(80));
until(Reflect.Bank.IsOpen)or(CT.Elapsedtime > timeOut);
end else
randomCompass;
end;

How can I repair it?

MacPooPum
06-23-2017, 08:38 AM
i keep getting

Error: File "Reflection/Reflection.simba" not found at line 12
Compiling failed.

slacky
06-23-2017, 11:06 AM
i keep getting

Error: File "Reflection/Reflection.simba" not found at line 12
Compiling failed.
This script is outdated.

Stanley69
08-09-2018, 03:50 AM
I am getting:

"
const

procedure quickMouse(P: TPoint; ClickType: Integer)

begin
Reflect.Mouse.Move(P, 0, 0);
Wait(RandomRange(20, 30));
Reflect.Mouse.Click(ClickType);
end;
"

Error: Found unexpected token "procedure", expected "Identifier" at line 3
Compiling failed.

Any help with this would be appreciated, thanks!

KeepBotting
08-09-2018, 11:59 AM
I am getting:

"
const

procedure quickMouse(P: TPoint; ClickType: Integer)

begin
Reflect.Mouse.Move(P, 0, 0);
Wait(RandomRange(20, 30));
Reflect.Mouse.Click(ClickType);
end;
"

Error: Found unexpected token "procedure", expected "Identifier" at line 3
Compiling failed.

Any help with this would be appreciated, thanks!

Read the post directly above yours.

Stanley69
08-09-2018, 07:43 PM
Read the post directly above yours.

No offense, but that was not helpful at all! I read the post above. I actually read the post above just before I posted below it.
There is always a fix right? I was hoping for someone who knows what that fix is.
If this is old, why is it not under "outdated scripts"

P1nky
08-09-2018, 08:01 PM
No offense, but that was not helpful at all! I read the post above. I actually read the post above just before I posted below it.
There is always a fix right? I was hoping for someone who knows what that fix is.
If this is old, why is it not under "outdated scripts"

This script is outdated :( ( I have reported it, so a mod/admin can have this thread moved to 'outdated script' ) and I am pretty sure F-Include itsself is outdated too. Btw if you are willing to learn how to script, a chicken slayer/burier/cooker/picker would be an awesome script to learn off.

KeepBotting
08-10-2018, 02:48 AM
No offense, but that was not helpful at all! I read the post above. I actually read the post above just before I posted below it.
There is always a fix right? I was hoping for someone who knows what that fix is.
If this is old, why is it not under "outdated scripts"

To fix this particular script, it will most likely have to be rewritten under a supported (read: not broken) include. Your best bet would be to start here (https://villavu.com/forum/showthread.php?t=118229&p=1391791#post1391791).