Jump to content
Bnywarrior

Barbarian village fly fishing + cooking snippet

Recommended Posts

Posted (edited)

Wasn't satisfied with the available fly fish + cook scripts in the script network.
Here's a simple snippet for you all: 
Simply have feathers and fly fishing rod in your inventory. Make sure inventory slot 2 is empty as the script will always cook the raw fish in this slot first, then will cook the opposite (salmon or trout) after.

FYI: Since cooking on a fire causes the player to go out of animation after every cooking action, using My Player Is Not Animating is not good enough. If your player is cooking and your script enters the IF statement where you select the fish, by the time the script has selected that fish, your player will have cooked that fish. Your script will then attempt to use the selected cooked fish on the fire. Therefore, you must guarantee that once your player has started cooking fish, your script will not enter the initial IF statement of selecting the fish.

To do this, use Zackaery's threaded animation sleep method. The idea is to use an timer to keep track of your player animation. Suppose that the cooking animation lasts 1000 ms and the player exits animation for 500 ms before cooking the next fish, set an animation timer that runs for greater than 1500ms so that your script will recognize your player is animating for >=1500ms instead of 1000ms. In this way, you chain animations together.
In practice, you shouldn't need to know the ms duration of an animation. I use 2 seconds for this timer and it works quite well.

 

<Boolean>CookTrout:false
<Boolean>CookSalmon:false
<Timer>Animating:2000,false,0,false
[0, MyPlayer, isAnimating, {true}]
[0, Timers, reset, 1:[Animating]]
[1, Inventory, isFull, {false}]
[1, MyPlayer, isAnimating, {false}]
[1, Timers, isRunning, {false}, 1:Animating]
[1, Camera, toEntity, 2:1526, 1:NPC]
[1, NPC, interactWith, 2:1526, 1:Lure, 3:true, 3:false, 3:true, 3:false, 3:false]
[1, Sleeping, sleepMoving]
[1, Mouse, moveOutsideScreen]
[2, Inventory, slotContains, {true}, 1:Raw trout, 2:2]
[2, Inventory, isFull, {true}]
[2, Variables, editBoolean, 1:CookTrout, 3:true]
[3, Inventory, slotContains, {true}, 1:Raw Salmon, 2:2]
[3, Inventory, isFull, {true}]
[3, Variables, editBoolean, 1:CookSalmon, 3:true]
[4, Variables, getBoolean, 1:CookSalmon, 3:true]
[4, Inventory, inventoryContainsPartialName, {false}, 1:Raw Salmon, 3:false, 3:true]
[4, Inventory, inventoryContainsPartialName, {true}, 1:Raw trout, 3:false, 3:true]
[4, Variables, getBoolean, 1:CookTrout, 3:false]
[4, Variables, editBoolean, 1:CookSalmon, 3:false]
[4, Variables, editBoolean, 1:CookTrout, 3:true]
[5, Variables, getBoolean, 1:CookSalmon, 3:false]
[5, Variables, getBoolean, 1:CookTrout, 3:true]
[5, Inventory, inventoryContainsPartialName, {true}, 1:Raw salmon, 3:false, 3:true]
[5, Inventory, inventoryContainsPartialName, {false}, 1:Raw trout, 3:false, 3:true]
[5, Variables, editBoolean, 1:CookSalmon, 3:true]
[5, Variables, editBoolean, 1:CookTrout, 3:false]
[6, Variables, getBoolean, 1:CookSalmon, 3:true]
[6, Timers, isRunning, {false}, 1:Animating]
[6, Inventory, interactWith, 1:Raw Salmon, 1:Use]
[7, Variables, getBoolean, 1:CookTrout, 3:true]
[7, Timers, isRunning, {false}, 1:Animating]
[7, Inventory, interactWith, 1:Raw trout, 1:Use]
[8, Inventory, contains, {false}, 1:Raw Salmon, 1:Raw trout]
[8, Timers, isRunning, {false}, 1:Animating]
[8, Inventory, isFull, {true}]
[8, Inventory, dropAllExcept, 1:Feather, 1:Fly fishing rod]
[8, Variables, editBoolean, 1:CookSalmon, 3:false]
[8, Variables, editBoolean, 1:CookTrout, 3:false]
[10, Inventory, isItemSelected, {true}]
[10, Camera, toEntity, 1:Fire, 1:RS2Object]
[10, RS2Object, interactWith, 1:Fire, 1:Use, 3:true, 3:false, 3:true, 3:false, 3:false]
[10, Sleeping, sleepMoving]
[11, RS2Widget, isVisibleContainingText, {true}, 1:[How many]]
[11, Keyboard, pressSpace]
[11, Mouse, moveOutsideScreen]
[11, Sleeping, sleepRandom, 2:800, 2:1000]
[11, Variables, goTo, 2:[0]]


*I'd like to spoiler this above code, please let me know how. Also if I should just go ahead and upload this to the script network, let me know. IMO this is a fully functional script but feels too small.

Edited by Bnywarrior
  • Like 1
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...