Booleans YAY Posted December 29, 2016 Share Posted December 29, 2016 increment of bones collected (currently +=1; when clicking the ground item, clicks more than once sometimes so I need to figure out when the player collects the bone to inventory to increment then(any tips that'd be great!). Quote Link to comment Share on other sites More sharing options...
BrainDeadGenius Posted December 29, 2016 Share Posted December 29, 2016 You could put a small pause after clicking/incrementing to insure only one click happens. Also, for your counter, you can just do counterVariable++. You don't need to do counterVariable += 1 Quote Link to comment Share on other sites More sharing options...
Booleans YAY Posted December 29, 2016 Author Share Posted December 29, 2016 You could put a small pause after clicking/incrementing to insure only one click happens. Also, for your counter, you can just do counterVariable++. You don't need to do counterVariable += 1 I was aware of the ++ but was lazy way, anyways. This is my function code for picking up bones, i'm picking them up in random tile locations so pin pointing a timer would be hard due to bones being further away, if it was simple as banking and burying then I wouldn't really have this issue what so ever; but because of random tile distances for the ground items Bones not sure if putting a timer is the right thing to do. Maybe create an event per pickup, if the bone == null then ++ ? i'm not too sure exactly what code should be done to fix this sort of issue regarding my OP. Quote Link to comment Share on other sites More sharing options...
BrainDeadGenius Posted December 29, 2016 Share Posted December 29, 2016 I guess a good question to ask is: Why are you incrementing the number of bones collected? Quote Link to comment Share on other sites More sharing options...
Booleans YAY Posted December 29, 2016 Author Share Posted December 29, 2016 I guess a good question to ask is: Why are you incrementing the number of bones collected? Well, it's just simply based on how many bones collected, if I had died it'd be less score than burried. Honestly i'm a little tempted to remove it based on redundancy and to save time. Side note to anyone who knows, does anyone know how to request a script for review to got to SDN? for future references I mean cause I still want to work and clean up before I give a request. Thanks! Quote Link to comment Share on other sites More sharing options...
BrainDeadGenius Posted December 29, 2016 Share Posted December 29, 2016 So you simply want to know the number of bones collected during say, a 6 hour run period of your script? Instead of incrementing on pickup, increment on bank deposit based on how many bones are in the inventory. Quote Link to comment Share on other sites More sharing options...
Booleans YAY Posted December 29, 2016 Author Share Posted December 29, 2016 So you simply want to know the number of bones collected during say, a 6 hour run period of your script? Instead of incrementing on pickup, increment on bank deposit based on how many bones are in the inventory. This is my function code for picking up bones, i'm picking them up in random tile locations so pin pointing a timer would be hard due to bones being further away This script isn't utilizing the Banking option. Function of script is according: Find local Bone (random tile based due to location demo (Chaos Temple)) Pickup local bone Fill inventory Begin bury process Repeat Side note: I got my goal of 43 prayer, thanks me! XD Quote Link to comment Share on other sites More sharing options...
BrainDeadGenius Posted December 29, 2016 Share Posted December 29, 2016 You weren't clear in what the script was doing, which is why I asked. All you need to do to start the burying process is check to see if the inventory is full. If it is, then begin burying. Once all the bones are buried, then drop any non-bone related items. I'd show you how to do this, but it's been a few years since I've used the API. Also, you should be aware of how to do this if you're actively using the API. I know I used these necessary methods when I used the API, and they weren't that complex. Quote Link to comment Share on other sites More sharing options...
progamerz Posted December 29, 2016 Share Posted December 29, 2016 increment of bones collected (currently +=1; when clicking the ground item, clicks more than once sometimes so I need to figure out when the player collects the bone to inventory to increment then(any tips that'd be great!). Easy solution would be recounting the bones in inventory and storing it to a int on every loop. Quote Link to comment Share on other sites More sharing options...
Hayase Posted December 29, 2016 Share Posted December 29, 2016 (edited) Or just use conditional sleeps: int currentBonerCount = inventory.getItem("Bones").getAmount(); pickUpBone(); new ConditionalSleep(2_000) { @[member='Override'] public boolean condition() throws InterruptedException { return inventory.getItem("Bones").getAmount() > currentBonerCount; } }.sleep(); Edited December 29, 2016 by Hayase Quote Link to comment Share on other sites More sharing options...
Booleans YAY Posted December 29, 2016 Author Share Posted December 29, 2016 Or just use conditional sleeps: int currentBonerCount = inventory.getItem("Bones").getAmount(); pickUpBone(); new ConditionalSleep(2_000) { @[member='Override'] public boolean condition() throws InterruptedException { return inventory.getItem("Bones").getAmount() > currentBonerCount; } }.sleep(); So this is my function for picking up case LOOTING_BONES: if (!myPlayer().isAnimating()) { GroundItem bone = groundItems.closest("bones"); if (bone != null) { bone.interact("Take"); sleep(random(900)); new ConditionalSleep(2_000) { @[member=Override] public boolean condition() throws InterruptedException { return inventory.getItem("bones").getAmount() > currentBonerCount; } }.sleep(); } } break; g.drawString("Bones Collected: " + currentBonerCount, 5, 55); Script doesn't startup Quote Link to comment Share on other sites More sharing options...
BrainDeadGenius Posted December 29, 2016 Share Posted December 29, 2016 If you have trouble with picking up additional items, non-bone related, then I'd suggest implementing the counter after the inventory of bones is buried. What you'd do is bury the bones, count the empty spaces (and increment your counter), then drop all the non-bone items. This could be a better way, if written properly, to A) get an accurate bone count, and B) ensure you don't fill your inventory with non-bones which will cause the script to do nothing. Quote Link to comment Share on other sites More sharing options...
HeyImJamie Posted December 29, 2016 Share Posted December 29, 2016 (edited) So this is my function for picking up case LOOTING_BONES: if (!myPlayer().isAnimating()) { GroundItem bone = groundItems.closest("bones"); if (bone != null) { bone.interact("Take"); sleep(random(900)); new ConditionalSleep(2_000) { @[member='Override'] public boolean condition() throws InterruptedException { return inventory.getItem("bones").getAmount() > currentBonerCount; } }.sleep(); } } break; g.drawString("Bones Collected: " + currentBonerCount, 5, 55); Script doesn't startup Pretty sure he's left a thing or two in there to break it, either intentionally so you can't just copy paste or unintentionally. Read through it logically and I'm sure you'll see it! I can see one at least Also.. I'm not a scripter so don't take this 100% but why have you put a sleep, before a sleep? Edited December 29, 2016 by HeyImJamie Quote Link to comment Share on other sites More sharing options...
Hayase Posted December 30, 2016 Share Posted December 30, 2016 (edited) Coming back to this issue I have a better idea if you want to try it. Instead of taking count of the bones directly what about counting the empty spaces you have in your inventory and once you hit 0 you bury bones/bank and then restart? //Somewhere up at the top of your script or wherever you are keeping track of your bone count: int totalBones = 0; case LOOTING_BONES: if (!myPlayer().isAnimating()) { GroundItem bone = groundItems.closest("bones"); if (bone != null) { int currentFreeSpace = inventory.getEmptySlotCount(); bone.interact("Take"); /* * If you use conditional sleeps it will work more efficiently than static sleeping sleep(random(900)); */ new ConditionalSleep(900) { @[member='Override'] public boolean condition() throws InterruptedException { /* * If our empty slot count is less than before--we must have picked up that bone */ if (inventory.getEmptySlotCount() < currentFreeSpace) { //Increase the bone count totalBones++; return true; } return false; } }.sleep(); } } break; Edited December 30, 2016 by Hayase Quote Link to comment Share on other sites More sharing options...
Team Cape Posted December 30, 2016 Share Posted December 30, 2016 (edited) what? why are you counting freespace? This is all you need to do: GroundItem foundBones = groundItems.closest("Bones"); if(foundBones != null) { long pastBones = inventory.getAmount("Bones"); if(foundBones.interact("Take")) { new ConditionalSleep(5000) { @ Override public boolean condition() throws InterruptedException { return inventory.getAmount("Bones") > pastBones; } }.sleep(); if(inventory.getAmount("Bones") > pastBones) { bonesCollected++; } } } Edit: Also, please never use += 1. Edited December 30, 2016 by Imateamcape Quote Link to comment Share on other sites More sharing options...