BettaGeorge Posted February 14, 2022 Posted February 14, 2022 (edited) Hello wise modders! Yes, I have seen the Tutorial section. I have also worked through the Weidu readme, but that seems to have a different focus. What I cannot quite find is how to execute a block of (creature-independent) code when a hotkey is pressed. Looking at some mods that do have hotkeys, I need to do something with a menu file? Maybe? At a very basic level, I would like to know how to display a hardcoded string in the battle log when the player presses a certain key. I work as a programmer, so writing code is fine with me. I just have no idea how the IE works. Thanks in advance for any pointers! PS: I am on BG:EE. Apparently there is now Lua stuff in addition to BCS files? At least the init file changed from .ini to .lua for some reason. If there is a "newer" way to achieve the desired effect that only works on the EEs, I am fine with that. PPS: if you are truly bored, here are some stretch goals: * can the hotkey be made configurable via the ingame "Assign Keys" menu? * can I interpolate a global variable into the string? Do I need to use tokens for that? * can I get a reference to the object that is currently under the cursor? Edited February 14, 2022 by BettaGeorge Quote
lynx Posted February 14, 2022 Posted February 14, 2022 This is usually done with IE scripts (BCS), with the block most commonly added to dplayer*.bcs to not pollute the global script (baldur.bcs). Example: IF HotKey(K) THEN RESPONSE #100 DisplayString(Player1,6150) END - no - no, yes - no Can't speak about lua hacks though. Quote
BettaGeorge Posted February 14, 2022 Author Posted February 14, 2022 Hm, if I cannot find out which object is under the cursor, then how do hotkeys like Ctrl+Y ("kill creature under cursor") work? Quote
lynx Posted February 14, 2022 Posted February 14, 2022 They're handled (hardcoded) by the engine. Here's the list of triggers one can use: https://gibberlings3.github.io/iesdp/scripting/triggers/bgeetriggers.htm Some of them set objects/variables you can then use in actions, but none are mouse related. Quote
BettaGeorge Posted February 14, 2022 Author Posted February 14, 2022 Hm, any idea where I can find help on the lua integration? Quote
lynx Posted February 15, 2022 Posted February 15, 2022 I'd ask one of the modders that use it, I don't think it's documented anywhere. @Bubb should know its limits, since he's the developer behind EEEx. Quote
BettaGeorge Posted February 15, 2022 Author Posted February 15, 2022 (edited) 5 hours ago, lynx said: I don't think it's documented anywhere. Ah, that's too bad. Thank you! I guess I'll go with a workaround for now, like a targetable special ability with 0 casting time. Edited February 15, 2022 by BettaGeorge Quote
Bubb Posted February 15, 2022 Posted February 15, 2022 What exactly are you trying to do? The configurable UI hotkeys are defined in BGEE.LUA by the keybindings table, though the ordinals all have hardcoded meanings and aren't really customizable. Basic custom hotkeys can be defined in UI.MENU by (ab)using a new menu definition. For example, add: menu { name 'B3_HOTKEYS' ignoreEsc label { on M action " Infinity_DisplayString('Hello from B3_HOTKEYS!') " } } and edit the 'START' menu's onOpen to push 'B3_HOTKEYS', (something like): menu { name 'START' align center center ignoreesc onOpen " Infinity_PushMenu('B3_HOTKEYS') What this does is add an invisible, non-closable menu that listens for the "M" key to be pressed, running whatever Lua code is in the label's action. The Lua environment has very little functionality to interact with the game engine though, so depending on what you want to do, it's probably impossible. Quote
subtledoctor Posted February 15, 2022 Posted February 15, 2022 (edited) 4 minutes ago, Bubb said: The Lua environment has very little functionality to interact with the game engine though, We already had a game where scripts can't really talk to spell effects and spell effects can't really talk to scripts. So great that Beamdog added a whole new layer of programmability that cannot talk to either of the existing ones. Edited February 15, 2022 by subtledoctor Quote
Recommended Posts
Join the conversation
You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.