jak-project/goal_src/user
Tyler Wilding 00ac12094e
goalc/repl: cleanup of goalc/REPL code and some QoL improvements (#2104)
- lets you split up your `startup.gc` file into two sections
  - one that runs on initial startup / reloads
  - the other that runs when you listen to a target
- allows for customization of the keybinds added a month or so ago
- removes a useless flag (--startup-cmd) and marks others for
deprecation.
- added another help prompt that lists all the keybinds and what they do

Co-authored-by: water <awaterford111445@gmail.com>
2023-01-07 11:24:02 -05:00
..
.gitignore repl: Add a few new quality of life improvements (#2030) 2022-11-20 14:28:41 -05:00
readme.md goalc/repl: cleanup of goalc/REPL code and some QoL improvements (#2104) 2023-01-07 11:24:02 -05:00

This directory holds the user profiles.

To make your own profile, create a new directory here with your username. e.g. for username mark make a directory called mark Inside that directory, create user.gs and user.gc files. These are your own user scripts, loaded after the GOOS library and GOAL library respectively.

Alternatively, if you only have a single folder in goal_src/user/ it will be assumed to be your user folder

The rest of the directory can be used however you please!

To automatically log in as a specific user, create a user.txt file in this directory which contains just the username you want to log in as. That way you don't have to modify multiple scripts when you want to change users.

If you want to make your profile public, edit the .gitignore in this directory.

Additionally, you can provide a repl-config.json to set various REPL settings, an example configuration:

{
  "numConnectToTargetAttempts": 1,
  "jak1": {
    "asmFileSearchDirs": [
      "goal_src/jak1"
    ]
  },
  "jak2": {
    "asmFileSearchDirs": [
      "goal_src/jak2"
    ]
  },
  "appendKeybinds": true,
  "keybinds": [
    {
      "modifier": "ctrl",
      "key": "S",
      "description": "Test Bind",
      "command": "(format 0 \"hello world\")"
    }
  ]
}

And a startup.gc where each line will be executed upon startup

Re-running certain commands upon listening to the target

A common workflow that you might want in your startup.gc is something like the following:

(mi)
(lt)
(dbgc)
(test-play)

This builds the game, connects to the game, attaches the debugger, and runs it.

However, when you crash you ideally want to just be able to:

  • stop the game via (:stop) or the respective keybind
  • fix the code, rebuild just that file
  • re-launch the game and re-connect

Upon which you'd probably want to run all or some of the above startup again. But how can you accomplish this without re-launching the REPL completely? Like so:

(mi)
(lt)
;; og:run-below-on-listen
(dbgc)
(test-play)

As the comment suggests, upon a succesful (lt) it will run any lines below it again.