Skip to content

Instantly share code, notes, and snippets.

@Novaras
Novaras / b15-overview.md
Last active February 15, 2021 13:20
b15 points of interest
@Novaras
Novaras / sobgroup_fns.md
Last active February 15, 2022 20:25
SobGroup globals

The following is a list of all the globally available SobGroup_ functions during runtime (i.e customCode or mission scripts) Most of these are documented over on Karos (you can use the 'Pages' dropdown on the right to navigate quickly).

You can see the global scope for yourself by invoking the global function globals:

globals(); -- outputs all globals

-- print the contents to HomeworldRM/Bin/Release/HwRM.log
-- (not recursive for subtables)

See the actual, usable definitons file.

Produces wonderful in-editor documentation and discovery:

  • SobGroup_AbilityActivate
  • SobGroup_AddFilterExclude
  • SobGroup_AddFilterInclude
  • SobGroup_AllowPassiveActionsAlways
@Novaras
Novaras / hwrm.lua
Last active August 19, 2021 16:26
EmmyLua annotations for intellisense support when scripting with HWRM globals
-- Documented with EmmyLua format annotations:
-- https://github.com/sumneko/lua-language-server/wiki/EmmyLua-Annotations
-- Most editors probably support EmmyLua somehow, but for vscode users, we can simply install sumneko's amazing Lua Language Server extension:
-- https://marketplace.visualstudio.com/items?itemName=sumneko.lua
-- Custom definitions file to allow sumneko.lua to provide completion/hover/etc. for HWRM globals.
if (nil) then

here's an example mission script showing how modkit allows you to write mission scripts more expressively

I made this from a desire to write linear things like this:

Given a rule A
If A is finished, start rule B
If B is finished, with the result of B, start C or D
..etc.

The following is a list of all the globally available KEY* variables.

You can see the global scope for yourself by invoking the global function globals:

globals(); -- outputs all globals

-- prints them
for k, v in globals() do
  print(k .. ": " .. tostring(v));
-- This file contains all the UIScreens that will be loaded on
-- startup of the app and on startup of the game.
-- Currently the UI only supports one style sheet, support for multiple stylesheets may
-- be supported in the future if needed.
StyleSheets = {
HW2StyleSheet = {
filename = "DATA:\\UI\\NewUI\\Styles\\HWRMStyles.lua",
},
}

wow

The problem:

There is no way to share any variables or state with other LUA scopes which may be running alongside the current one.

For exmaple, a script running the mission rules will be running during gametime, and so will ship customcode scripts, but they have no way to communicate with eachother!.

In order to overcome this, we can write to the UI in a very specific way and keep a string representation of a lua table there!

@Novaras
Novaras / player_fns.md
Created February 15, 2022 20:25
Player globals

The following is a list of all the globally available Player_ functions during runtime (i.e customCode or mission scripts) Most of these are documented over on Karos (you can use the 'Pages' dropdown on the right to navigate quickly).

You can see the global scope for yourself by invoking the global function globals:

globals(); -- outputs all globals

-- print the contents to HomeworldRM/Bin/Release/HwRM.log
-- (not recursive for subtables)
if (makeStateHandle == nil) then
dofilepath("data:scripts/modkit/scope_state.lua");
end
if (REWARD_DIALOG_TRACKER_ROE_VALUES == nil) then
dofilepath("data:leveldata/campaign/say_wha/test_mission/lib.lua");
end
if (PHASE_REWARDS == nil) then
dofilepath("data:scripts/custom_code/horde/phase_rewards.lua");