Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;Script Editor Script :)
- ;by p3king
- ;You can use the following hotkeys:
- ;- ALT + 1 > Restore the default window size
- ;- ALT + 2 > Change window size to settings below
- ;- ALT + 3 > Change window size to something else defined in the script
- ;- CTRL + S > Trigger "Apply" button to save
- ;- F12 > Leave script editor, save and start game
- ;Automatically resize the script window each time you open it with F11
- AutoResize = 1
- ;Script window resizes to this size when pressing ALT + 2 or AutoResize is enabled
- WindowWidth = 1024
- WindowHeight = 1000
- SidebarWidth = 220
- ;Optional workaround for german keyboard layouts, see bottom of the script.
- ;Set to nonzero to enable.
- UseGermanKeyboardFix = 0
- ;You probably don´t need to touch this.
- ;This could be helpful for non-english versions.
- ;If your Script Editor window is not called "Script Editor"
- ;you can change that here.
- ScriptEditorWindow = Script Editor
- ;Settings stop here :) -------------------------------------------------------
- txt_name = Scintilla1
- bor_name = Static3
- sdb_name = ListBox1
- lsn_name = Static2
- tsn_name = Edit1
- bt1_name = Button1
- bt2_name = Button2
- bt3_name = Button3
- bt4_name = Button4
- defaults_saved = 0
- sidebar_default_w = 196
- margin = 10
- margin_double = 20
- margin_triple = 30
- bottom_space = 50
- ;-----------------------------------------------------------------------------
- ;These are hotkeys, you can look up what other keys are here:
- ;http://www.autohotkey.com/docs/Hotkeys.htm
- #If WinActive(ScriptEditorWindow)
- !1::win_restore()
- !2::win_resize(WindowWidth, WindowHeight, SidebarWidth)
- !3::win_resize(1400, 1000, 260)
- ^s::Send !a
- F12::game_start()
- #If
- #If AutoResize
- F11::
- Send {F11}
- IfWinNotActive, %ScriptEditorWindow%
- {
- WinWaitActive, %ScriptEditorWindow%,,0.3
- win_resize(WindowWidth, WindowHeight, SidebarWidth)
- }
- return
- #If
- ;-----------------------------------------------------------------------------
- win_resize(w, h, sw)
- {
- global
- save_defaults()
- diff_w := w - win_w
- ;Move and resize the window
- WinMove, %ScriptEditorWindow%,,,, w, h
- ;Script Window and Buttons below
- new_button_y := h-margin_triple-margin
- ControlMove, %bt1_name%, bt1_x + diff_w, new_button_y, bt1_w, bt1_h, %ScriptEditorWindow%
- ControlMove, %bt2_name%, bt2_x + diff_w, new_button_y, bt2_w, bt2_h, %ScriptEditorWindow%
- ControlMove, %bt3_name%, bt3_x + diff_w, new_button_y, bt3_w, bt3_h, %ScriptEditorWindow%
- ControlMove, %bt4_name%, bt4_x + diff_w, new_button_y, bt4_w, bt4_h, %ScriptEditorWindow%
- new_script_x := sw+margin_double
- new_script_w := w-sw-margin_triple
- new_script_h := h-bottom_space-margin_triple+1
- new_txt_x := txt_x + sw - sidebar_default_w - 2
- ControlMove, %bor_name%, new_script_x, bor_y, new_script_w, new_script_h, %ScriptEditorWindow%
- ControlMove, %txt_name%, new_txt_x, txt_y, new_script_w-3, new_script_h-4, %ScriptEditorWindow%
- ;Sidebar and script name
- new_sidebar_y := 29 ;hides that scripts headline
- new_sidebar_w := sw
- new_sidebar_h := h-bottom_space-new_sidebar_y
- ControlMove, %sdb_name%, sdb_x, new_sidebar_y, new_sidebar_w, new_sidebar_h, %ScriptEditorWindow%
- new_tsn_y := new_sidebar_y+new_sidebar_h+margin
- ControlMove, %tsn_name%, tsn_x, new_tsn_y, tsn_w + sw - sidebar_default_w, tsn_h, %ScriptEditorWindow%
- new_lsn_y := new_tsn_y + 4
- ControlMove, %lsn_name%, lsn_x, new_lsn_y, lsn_w, lsn_h, %ScriptEditorWindow%
- win_center()
- }
- ;-----------------------------------------------------------------------------
- win_restore()
- {
- global
- WinMove, %ScriptEditorWindow%,, win_x, win_y, win_w, win_h
- ControlMove, %bor_name%, bor_x, bor_y, bor_w, bor_h, %ScriptEditorWindow%
- ControlMove, %txt_name%, txt_x, txt_y, txt_w, txt_h, %ScriptEditorWindow%
- ControlMove, %bt1_name%, bt1_x, bt1_y, bt1_w, bt1_h, %ScriptEditorWindow%
- ControlMove, %bt2_name%, bt2_x, bt2_y, bt2_w, bt2_h, %ScriptEditorWindow%
- ControlMove, %bt3_name%, bt3_x, bt3_y, bt3_w, bt3_h, %ScriptEditorWindow%
- ControlMove, %bt4_name%, bt4_x, bt4_y, bt4_w, bt4_h, %ScriptEditorWindow%
- ControlMove, %sdb_name%, sdb_x, sdb_y, sdb_w, sdb_h, %ScriptEditorWindow%
- ControlMove, %lsn_name%, lsn_x, lsn_y, lsn_w, lsn_h, %ScriptEditorWindow%
- ControlMove, %tsn_name%, tsn_x, tsn_y, tsn_w, tsn_h, %ScriptEditorWindow%
- win_center()
- }
- ;-----------------------------------------------------------------------------
- save_defaults()
- {
- global
- if defaults_saved != 1
- {
- WinGetPos, win_x, win_y, win_w, win_h, %ScriptEditorWindow%
- ControlGetPos, txt_x, txt_y, txt_w, txt_h, %txt_name%, %ScriptEditorWindow%
- ControlGetPos, bor_x, bor_y, bor_w, bor_h, %bor_name%, %ScriptEditorWindow%
- ControlGetPos, bt1_x, bt1_y, bt1_w, bt1_h, %bt1_name%, %ScriptEditorWindow%
- ControlGetPos, bt2_x, bt2_y, bt2_w, bt2_h, %bt2_name%, %ScriptEditorWindow%
- ControlGetPos, bt3_x, bt3_y, bt3_w, bt3_h, %bt3_name%, %ScriptEditorWindow%
- ControlGetPos, bt4_x, bt4_y, bt4_w, bt4_h, %bt4_name%, %ScriptEditorWindow%
- ControlGetPos, sdb_x, sdb_y, sdb_w, sdb_h, %sdb_name%, %ScriptEditorWindow%
- ControlGetPos, lsn_x, lsn_y, lsn_w, lsn_h, %lsn_name%, %ScriptEditorWindow%
- ControlGetPos, tsn_x, tsn_y, tsn_w, tsn_h, %tsn_name%, %ScriptEditorWindow%
- defaults_saved = 1
- }
- }
- ;-----------------------------------------------------------------------------
- win_center()
- {
- global
- WinGetPos,,, ww, wh, %ScriptEditorWindow%
- WinMove, %ScriptEditorWindow%,, (A_ScreenWidth/2)-(ww/2), (A_ScreenHeight/2)-(wh/2)
- }
- ;-----------------------------------------------------------------------------
- game_start()
- {
- global
- ControlFocus, %bt1_name%, %ScriptEditorWindow%
- Send {SPACE}
- Send ^s
- Send {F12}
- }
- ;-----------------------------------------------------------------------------
- ;Below is a AltGr + Q fix for german keyboard layouts.
- ;We can´t type an @ in script editor without toggling
- ;the line comment feature that is on CTRL + Q too.
- #if UseGermanKeyboardFix && WinActive(ScriptEditorWindow)
- <^>!q::
- ^!q::
- save := clipboardall
- clipboard = @
- Send ^v
- clipboard := save
- return
- #if
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement