why does the delay in an applescript editor increase by itself?...***

so im trying to write myself a (very simple) auto typer for an mmorpg i play. i found a script for such an application on http://www.sythe.org/archives/438387-how-make-your-own-mac-auto-typer.html and proceeded to edit it for myself. the problem im having is that the delay is set to 3 for every line, but for **** sake, it just keeps slowing down after about a dozen lines. i have tried shortening the application to only 10 lines, and then clicking the continue button, but upon clicking the continue button it simply keeps upping the delay... WHY THE **** MUST YOUR EDITOR NOT WORK APPLE?!?!?!?!?!


and when i had the application set to do about 30 lines, again the frequency of the typing would significantly decrease after it typed my message about a dozen times. my script is as follows:


tell application "System Events"

set texttosay to "Sample Text"


display dialog "Text to say:" default answer ""

set texttosay to the text returned of the result

repeat

activate application "Old School RuneScape"


keystroketexttosay


keystrokereturn


delay 3


keystroketexttosay


keystrokereturn


delay 3


keystroketexttosay


keystrokereturn


delay 3


keystroketexttosay


keystrokereturn


delay 3


keystroketexttosay


keystrokereturn


delay 3


keystroketexttosay


keystrokereturn


delay 3


keystroketexttosay


keystrokereturn


delay 3


keystroketexttosay


keystrokereturn


delay 3


keystroketexttosay


keystrokereturn


delay 3


keystroketexttosay


keystrokereturn

display dialog the "Do you want to quit?" buttons {"Continue", "Quit"} default button 1

if the button returned of the result is "Quit" then

exit repeat

end if

end repeat

end tell

MacBook Pro, OS X Mavericks (10.9), fix your mfing AppleScript Editor!!

Posted on Nov 10, 2013 1:59 AM

Reply
21 replies

Nov 10, 2013 6:34 AM in response to ooee5

Bots are perceived by various online game developers as a problem for various online gaming environments and communities — including Old School Runescape — and various game maintainers have implemented bot-related detection algorithms.


Put simply, I'd assume that the MMORPG has detected this bot and is rendering the bot less effective.


Inserting delays and access problems, intentionally changing the input patterns, dropping the network connections, reducing or eliminating the rewards received by a bot, and outright bans are all techniques available to game developers to make bot herding more difficult.


You could certainly try a simple AppleScript test of the delays that doesn't involve an MMORPG and determine if this is the game or something with the AppleScript, as I'd expect it's the game itself that's implementing the delays.

This particular AppleScript bot would be trivial to detect, and an increasing command delay within the game would be an obvious and comparatively innocuous evasion technique intended to discourage the bot handler.

Nov 10, 2013 9:28 PM in response to MrHoffman

@MrHoffman: I wondered about that at first, but I also noticed that no other users seemed to suffer this problem. I looked around me and all the other "bots" (which may I add, are simply active players not wanting to type the same thing over and over) worked just fine! That would make me wonder why on earth all the PC users using autotypers would not suffer the same effect


@rccharles: is "can delay" a command or what? I'm not sure what u were trying to say exactly.


Does anyone else have any solutions to my problem? They would be greatly appreciated!

Nov 11, 2013 12:35 AM in response to ooee5

I sincerely think MrHoffman has the right pointer here - your delay is being affected by the game, not AppleScript per se.


As a test, try something simpler that doesn't interact with the game.


For example, make yourself a metronome:


beep

delay 1

beep

delay 1

beep

delay 1

beep


(or, even better:)


repeat 100 times


beep


delay 1

end repeat

OMM, to my untrained ear, I can't detect any change in pace, which indicates that AppleScript is doing what it's supposed to.

If your machine does alter the pace/slow down then maybe there's something else amiss with your system.


As for why other players don't appear to suffer, maybe they're using more sophisticated methods to circumvent the bot detection - using random timers, inputs, etc.

Nov 11, 2013 7:51 AM in response to ooee5

try it this way: save the following as an application (not as a script) and run it.


property texttosay : "Sample Text"


on run


display dialog "Text to say:" default answer ""

set texttosay to the text returned of the result

end run


on idle

tell application "System Events"

if frontmost of process "Old School RuneScape" is false then

set frontmost of process "Old School RuneScape" to true

end if


keystroketexttosay


keystrokereturn

return 3

end tell

end idle


this solves a couple of problems:

  • it keeps the script from constantly trying to activate the OSR app
  • there's no context shift from system events to OSR; the app is activated by system events itself
  • is removes the delay commands and replaces them with a 3 second idle loop. an idle loop puts the app to sleep while a delay command merely halts the execution of the script. the former is much more efficient fromt he processor's perspective.

Nov 11, 2013 9:01 AM in response to ooee5

Well, ooee5.


There running a special variant of an autotyper program.

Runescape Auto Typer

There are a lot of Runescape Auto Typers out there but most of them are poorly made, have no anti-ban features and only work on Microsoft Windows.



Why should I use this particular Auto-Typer?

Because unlike other autotypers/auto talkers, this autotyper has unique anti-ban features that makes your messages look more natural such as by making typos, waiting a random interval between typing each letter and taking random breaks once in a while. Also, this program works on all platforms - even Mac and Linux!


http://www.runescape-proxy.com/runescape-auto-typer/


Notice that there is a Mac version.


Robert

Nov 11, 2013 4:45 PM in response to rccharles

thanks rccharles, i will try this application. HOWEVER, i would like to be able to code my OWN application/script... twtwtw, i tried copying&pasting that script, application or whatever it is into editor, and it did nothing to make it type in the game ffs. I need to know how to make it (repeatedly) type into the GAME, not just in the results section of the applescript editor...

Nov 11, 2013 5:08 PM in response to ooee5

ooee5 wrote:


how do i save something as an application versus a script?

Choose Save... (or possibly Save As...) from the applescript editor's file menu. In the Save File dialog that appears, look down at the bottom where it says 'File Fomat' and change the pull-down menu from 'Script' to 'Application'. Now find the file you just saved in the Finder and doubleclick it; it should run like a normal application.


You may get an error if OSR is not running...

Nov 11, 2013 6:05 PM in response to ooee5

You can't run a script application from the script editor. Close the script editor and run the script like an application.


Also, I forgot to add that when you save the script as an application you need to click the checkbox that says "Stay open after run handler," otherwise it won't call the idle handler. So resave it with that checkbox checked.

Nov 12, 2013 2:17 AM in response to twtwtw

ok thanks twtwtw, but now its giving me some ******** error message: Can't get <<class prcs>> "Old School RuneScape" of application "System Events". I tried doing the thing in system preferences where i allow the application to control the computer, but it STILL gives me this message! Thanks so much for your time!


ooee5

Nov 12, 2013 6:10 AM in response to ooee5

Patience please: things don't always work right the first time around. And (frankly) if you're getting stressed out because you can't cheat your game as quickly as you'd like, it's time for you to unplug your computer and read a book. Don't go back online until you've worked your way through Melville's "Moby Dick". Or maybe Camus' "The Plague", which may put your problems in perspective. 😝


The error message means that that OSR app has a different name in the system than it presents to the user. So you need to find out what that name is. Open a new applescript editor window and run the following:


tell application "System Events"

name of every process whose visible is true

end tell


This will give you a list of the names of the currently running apps. If the name you want isn't obvious post the list here, otherwise go back the the script app and replace "Old School Runescape" with the obvious app name. Then resave the app and run it again.


Don't use Script->Run Application for this. That menu command is intended for Cocoa-AppleScript apps, which is not what we've written here. Just save the script app and double-click it in the Finder.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

why does the delay in an applescript editor increase by itself?...***

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.