Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

GMEdit

A high-end code editor for all things GameMaker · By YellowAfterlife

Any hope for compiling?

A topic by Leftbones created Jun 14, 2018 Views: 631 Replies: 4
Viewing posts 1 to 3

I love this editor but I hate having to switch back to GM:S2 just to compile the game. Is there any possible way this editor could sort of run that command in GMS:2 to avoid having to switch windows? It's not a big deal when I'm on my desktop with multiple monitors, but I do a lot of laptop coding as well.

Developer (1 edit)

You can make a little AutoIt script to hit F5 in GMS2 when you hit F5 in GMEdit,

$bound = False
$suffix = " - GMEdit"
$suffixLen = StringLen($suffix)
while 1 ; bind/unbind the hotkey as we switch to/from GMEdit
    $title = WinGetTitle("[ACTIVE]")
    $newBound = (StringLen($title) > $suffixLen And StringRight($title, $suffixLen) == $suffix)
    If (Not $bound And $newBound) Then
        HotKeySet("{F5}", "OnRun")
    ElseIf ($bound And Not $newBound) Then
        HotKeySet("{F5}")
    EndIf
    $bound = $newBound
    sleep(250)
wend
Func OnRun()
    $orig = WinGetHandle("[ACTIVE]")
    $title = WinGetTitle("[ACTIVE]")
    $titleLen = StringLen($title)
    ; check that it's still GMEdit just to be really sure:
    $newBound = ($titleLen > $suffixLen And StringRight($title, $suffixLen) == $suffix)
    If (Not $newBound) Then Exit
    ; get the project name from GMEdit window title:
    $project = StringLeft($title, $titleLen - $suffixLen)
    ; make a regular expression to find the matching GM:S/GMS2 editor:
    If (StringRight($project, 4) == ".yyp") Then
        $rx = StringLeft($project, StringLen($project) - 4)
        $rx = StringReplace($rx, ".", "\.")
        $rx = "^" & $rx & " - GameMaker Studio 2"
    Else
        $rx = StringReplace($project, ".", "\.")
        $rx = "^" & $rx & "\*?\b.+\(v[\d.]+\)\s*$" ; "[project name] ... (v1.4.xxxx)"
    EndIf
    ; and send a F5 key there:
    $def = "[REGEXPTITLE:" & $rx & "]"
    $hwnd = WinGetHandle($def)
    $out = ControlSend($hwnd, "", "", "{F5}")
    ConsoleWrite($hwnd & " " & WinGetTitle($hwnd) & " r" & $out & " e" & @error & @CRLF)
EndFunc

Hello, I've downloaded Autoit and copied this script, then compiled into exe and ran, but unfortunately it doesn't work, either with GMS2 or the GMS2 beta. Having spent zero time with Autoit, I figured I'd ask here to see if anyone else has some experience with getting this working? 

The script looks to compile OK and runs in the task-bar tray, but it has "script paused" ticked when I right click the icon, and the icon flashes constantly to a red cross, which my guess is telling me that something's not working...

Developer(+1)

For GMS2 or GMS2 beta you should be using builder plugin, as per wiki. Some 2.3-specific improvements that re made are currently sitting in my fork of the plugin.

Thank you so kindly @YellowAfterlife, brilliant as always!