Jump to content

Swizzbeat

Members
  • Posts

    7986
  • Joined

  • Last visited

  • Days Won

    58
  • Feedback

    100%

Everything posted by Swizzbeat

  1. Little class I made since I needed basic Camera control in an iOS app I'm making. It may be useful to others as Swift is relatively new. Remember to create a delegate and set it to deal with responses when the user interacts with the camera view. // Copyright (c) 2014 Anthony Puppo. All rights reserved. import Foundation import UIKit var cameraInstance:Camera! func getCameraInstance() -> Camera { if (cameraInstance == nil) { cameraInstance = Camera() } return cameraInstance } class Camera { let cameraUI:UIImagePickerController! private init() { //Singleton Design Pattern if (isAvailable()) { self.cameraUI = UIImagePickerController() } self.cameraUI = nil } func isAvailable() -> Bool { return UIImagePickerController.isSourceTypeAvailable(.Camera) } func open(currentViewController:UIViewController) -> Bool { if (isAvailable() && cameraUI != nil) { currentViewController.presentViewController(cameraUI, animated: true, completion: nil) return true } return false } func setDelegate(delegate:protocol<UINavigationControllerDelegate, UIImagePickerControllerDelegate>) { if (cameraUI != nil) { cameraUI.delegate = delegate } } func setSourceType(sourceType:UIImagePickerControllerSourceType) { if (cameraUI != nil) { cameraUI.sourceType = sourceType } } func setMediaTypes(mediaTypes:AnyObject...) { if (cameraUI != nil) { cameraUI.mediaTypes = mediaTypes } } func setAllowsEditing(allowsEditing:Bool) { if (cameraUI != nil) { cameraUI.allowsEditing = allowsEditing } } }
  2. Swizzbeat

    @Eliot?

    this forum has gotten so shitty
  3. Nah, you burn just as much calories lifting plus you build muscle.
  4. Mate, you really need to learn Java. You've been making countless posts asking to be spoonfed while ignoring the fact that YOU CANNOT SCRIPT WITHOUT JAVA KNOWLEDGE.Also, that code is incorrect and doesn't make a path what so ever. I suggest you look into constructors and what they are.
  5. Iterate over every position in the path to find the closest one to your current position. Once you have that either begin incrementing through the array again from the closest position (if ascending through the path, decrement if descending) checking each position to see whether or not it is within a "walking distance" threshold you set (normally 12-15). If the position is within your threshold, simply store the index and continue checking along the array, storing indexes for positions within the threshold as you go along. Once you reach either the end of the array or a position outside of the threshold return the position at the last stored index. Remember that you should account for what happens if no positions were found within your threshold.
  6. I never did, if you can go back and look at my signature revisions. I changed it to a thread every single time.
  7. either there's some weird issue with my signature or some autistic mod keeps removing the banner I have for divica
  8. This is why only scripters should help scripters
  9. The distance calculation is currently rounding itself off so diagonal entities appear closer than vertical/horizontal. I would change it in the API however I remember asking @Laz about this awhile ago and he liked it how it was.
  10. Meh, not about that muscle car life. Give me one of those new z06 vets and I'll be a happy camper.
  11. @OP We're not trying to be dicks, none of us are coding legends that know absolutely everything so we to are asking questions all the time, however the difference is we'll try different things out until we discover the answer to our question. Not only that, but when we ask and question and it is answered (like here when we said to go back and learn basic Java concepts) we buckle down and tackle whatever we need to do head on. I know it can be frustrating, but there's a reason why there's a limited number of scripters.
  12. Here, I'm adding it to the API as well: private void clearDefaultAntibanBehavior() { for (AntiBan.BehaviorType b : AntiBan.BehaviorType.values()) { antiBan.unregisterBehavior(b); } }
  13. I mine as well just add this to the API.
  14. Be straight up and just ask for a blowy.
  15. Why are people giving him the wrong advice and saying he's using the legacy API? Not only would his code be working instead of throwing errors if he imported all legacy, but he even showed everyone his imports on the first page and they're all for OSBot 2. It told you exactly what was wrong, and if you knew basic Java you'd know it's an incredibly informative error message. Since it seems like no one who has posted so far as any idea what they're talking about, and these posts gave me herpes, I'll just lay it out for you. Ok, this is the error you're getting: What this tells you is the method #setRunning(boolean) does not exist in either the main class or any of it's super classes. With that being said, it should be evident now why the quick fix it gives you is to create the method yourself in the current working class. The rest of the errors you're getting have the same issue. Now, on to your main question about getting a working message listener, just simply override the onMessage method found within the Script class. See the API for more information.
  16. Your IDE will literally tell you the error if you hover over it.
×
×
  • Create New...