Skip to content
This repository has been archived by the owner on Jan 19, 2019. It is now read-only.

Commit

Permalink
support compiled scripts, add icon, code cleanup
Browse files Browse the repository at this point in the history
* Support compiled scripts (limited, cannot configure post-install)
* Added icon (for .exe and for system tray)
* Consistent newlines at EOF
* Update .gitignore (add compiled scripts and compiler batch script)
* Improve comments in realmscript.ahk to be dev-friendly
  (assumes no more user editing)
* realm.ahk -> realmscript.ahk for clarity
* Updated README
  • Loading branch information
Jordan Atwood committed May 6, 2015
1 parent 57c1894 commit d04e944
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 13 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
Thumbs.db

# compiled script and ahk2exe batch file
realmscript*.exe
compile.bat
41 changes: 35 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,34 @@ enhancing gameplay with hotkeys for useful text and click macros.

##Download and Setup

There are currently two options for using realmscript: running the source script
or using a compiled .exe of the script. Running the script from source
(recommended!) will allow greater flexibility and full access to realmscript's
features, where using the compiled .exe is a faster and easier way to get
started and does not require you to install AutoHotKey, *but does not support
most customization features*!

###Running from source:

* [Download the project's files
here](https://github.com/Nightfirecat/realmscript/zipball/master).
* Extract the archive to a folder of your choice
* Install [Autohotkey](http://ahkscript.org/) for Windows
* Open `options.ahk` and `hotkeys.ahk` using your preferred text editor
**(Windows users, do not use Notepad; use
[Notepad++](http://notepadplusplus.org/) or some other editor!)**
* Open `options.ahk` and `hotkeys.ahk` using your preferred text editor
**(Windows users, I recommend using
[Notepad++](http://notepadplusplus.org/) or another editor which supports
linux-style line endings)**
* Choose your default settings in `options.ahk` and add, delete, or edit binds
as needed in `hotkeys.ahk`
* Run `realmscript.exe` to initiate the script

##Running the Script
###Running the compiled .exe:

Just open `realm.ahk` after AutoHotKey is installed on your system, and you're
good to go!
* Visit
[the releases page](https://github.com/Nightfirecat/realmscript/releases) and
download the latest compiled script's archive
* Extract the archive to a folder of your choice
* Run the included .exe

##Default Binds

Expand Down Expand Up @@ -86,6 +100,21 @@ good to go!
modifier keys (ctrl, alt, shift) may cause unintended effects for keys
that are used otherwise.
</dd>
<dt>How can I edit my settings or hotkeys using the .exe?</dt>
<dd>
Sadly, you can't. This is one of the notable limitations, because
compiled scripts will incorporate the code of `#include`d files rather
than continue to obey normal `#include` commands, thus it can't be
configured using `options.ahk` and `hotkeys.ahk` like the source script
can.
</dd>
<dt>Can I change the cursor used for the .exe version?</dt>
<dd>
You can replace the `bmj_precision.cur` file that is generated with a
cursor of your choice after the script has begun running. You may also
delete it entirely, though that will cause an error message to appear
each time your game comes into focus.
</dd>
</dl>

##Troubleshooting
Expand Down
Binary file added img/realmscript.ico
Binary file not shown.
Binary file added img/realmscript_paused.ico
Binary file not shown.
2 changes: 1 addition & 1 deletion includes/SetSystemCursor.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,4 @@ RestoreCursors()
{
SPI_SETCURSORS := 0x57
DllCall( "SystemParametersInfo", UInt,SPI_SETCURSORS, UInt,0, UInt,0, UInt,0 )
}
}
33 changes: 28 additions & 5 deletions realm.ahk → realmscript.ahk
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
;;;;; global vars
; include global options
#include options.ahk

;;;;;;;;;;;;;; DO NOT DELETE!!
goto STARTUP ; DO NOT DELETE!!
;;;;;;;;;;;;;; DO NOT DELETE!!
; check version, install files (for compiled scripts), set up global vars,
; start hotkey checking
goto STARTUP

;;;;; hotkeys
; include hotkeys (must happen after window title group creation)
#include hotkeys.ahk


Expand All @@ -20,6 +20,24 @@ STARTUP:
ExitApp
}

; ensure working directories, create dependencies for compiled versions
IfNotExist, img/
FileCreateDir, img
IfNotExist, img/cursors/
FileCreateDir, img/cursors
FileInstall, img/change-high.png, img/change-high.png, 1
FileInstall, img/change-med.png, img/change-med.png, 1
FileInstall, img/change-low.png, img/change-low.png, 1
FileInstall, img/enter-high.png, img/enter-high.png, 1
FileInstall, img/enter-med.png, img/enter-med.png, 1
FileInstall, img/enter-low.png, img/enter-low.png, 1
FileInstall, img/inv-high.png, img/inv-high.png, 1
FileInstall, img/inv-med.png, img/inv-med.png, 1
FileInstall, img/inv-low.png, img/inv-low.png, 1
FileInstall, img/realmscript.ico, img/realmscript.ico, 1
FileInstall, img/realmscript_paused.ico, img/realmscript_paused.ico, 1
FileInstall, img/cursors/bmj_precision.cur, img/cursors/bmj_precision.cur

; set script directives, global settings, global vars
OnExit, ExitSub
#include includes/SetSystemCursor.ahk
Expand All @@ -36,6 +54,9 @@ STARTUP:
SysGet, hBorderWidth, 33
SysGet, titleHeight, 4

; set icon
Menu, Tray, Icon, img/realmscript.ico, , 1

Suspend On
GroupAdd rotmg, % "Realm of the Mad God"
GroupAdd rotmg, % "Realm of the Mad God - Mozilla Firefox"
Expand Down Expand Up @@ -82,6 +103,7 @@ WinActive() {
WinGet, winProcessName, ProcessName, A
global USE_CUSTOM_CURSOR, CUSTOM_CURSOR
Suspend Off
Menu, Tray, Icon, img/realmscript.ico, , 1
if (DISABLE_RESIZE
&& (InStr(winTitle, "Adobe Flash Player")
|| winProcessName=="Realm of the Mad God.exe")) {
Expand All @@ -99,6 +121,7 @@ WinActive() {
WinNotActive() {
global USE_CUSTOM_CURSOR
Suspend on
Menu, Tray, Icon, img/realmscript_paused.ico, , 1
if (USE_CUSTOM_CURSOR) {
RestoreCursors()
}
Expand Down

0 comments on commit d04e944

Please sign in to comment.