Tabletop Simulator

Tabletop Simulator

Gloomhaven - Fantasy Setup (Scripted UI)
Vax'ion 2020 年 6 月 26 日 下午 1:52
Anyone here know how I could make a script to take a battle goal from my hand, and return it to the deck?
Not a big time-loss or saver, but it would be convenient to be able to return cards quickly
< >
正在显示第 1 - 2 条,共 2 条留言
Sebästschjin 2020 年 6 月 27 日 上午 4:34 
This should do:

function moveBattleGoals(obj, playerColor, altClick) local battleGoalDeck = "dc92d0" for _, card in pairs(Player[playerColor].getHandObjects()) do if isBattleGoal(card) then getObjectFromGUID(battleGoalDeck).putObject(card) end end end function isBattleGoal(object) if object.tag ~= "Card" or not object.getData().CustomDeck then return false end for key, _ in pairs(object.getData().CustomDeck) do return key == 1932 end end

The question would be, how you want to integrate it? So what should trigger this script? Options I see:
  • a button on the table
  • a button in the global UI
  • hitting a key

For the first you'd have code like this on a game component that should have the button
function onLoad(save_state) self.createButton({ click_function = "moveBattleGoals", function_owner = self, label = "Load", position = {0, 0.1, -0.9}, scale = {1.5, 1.5, 1.5}, width = 1200, height = 400, font_size = 200, color = {0.5, 0.5, 0.5, 1}, font_color = {1, 1, 1, 1}, }) end

I don't know yet how you'd best add that to the global UI, as I haven't good experience with it.

For the button press you could use:
function onScriptingButtonDown(index, playerColor) if index == 5 then moveBattleGoals(nil, playerColor) end end
Put that code on the same object you put the code at the top. The example above triggers, when you press the fifth scripting button (with is Numpad 5 per default).
最后由 Sebästschjin 编辑于; 2020 年 6 月 27 日 上午 4:35
Vax'ion 2020 年 6 月 27 日 上午 7:59 
Wow, thats very specific and exactly what I am looking for, thank you.
< >
正在显示第 1 - 2 条,共 2 条留言
每页显示数: 1530 50