Example keybind code from the 2nd screenshot (with checks in place to ensure it can't add too many Eddies):
if Game.GetTransactionSystem() then local ts = Game.GetTransactionSystem() and Game.GetTransactionSystem() or nil if ts and ts:GetItemDataByTDBID(Game.GetPlayer(), "Items.money") then local money = ts:GetItemDataByTDBID(Game.GetPlayer(), "Items.money") if money:GetQuantity() then local quantity = money:GetQuantity() print(tostring(quantity)) if quantity <= 40000000 then Game.AddToInventory("Items.money", 1000000) else print("You already have over 40m Eddies. Did not add any more.") end end end end
Plain English Translation: If the game's transaction system is available (not nil) then do: Declare local variable to store the game's transaction system (or nil if the transaction system isn't found). If we have the transaction system variable defined and we can get the player's money item then do: Declare local variable to store the money item data. If we can get the quantity of the player's money then do: Declare local variable to store the quantity of money. Print the amount of money to CET console log. If money quantity is less than or equal to 40m Eddies then do: Add 1 million Eddies to the player's inventory. else (if quantity is greater than 40m Eddies then do): Print that the player already has 40m Eddies and no more were added in CET console log. ending the if/else statements for quantity being >/=/< 40m Eddies ending the if statement for checking quantity ending the if statement for player's money ending the initial if statement
Note: Declaring the variables as "local" variables causes them to reset and check for everything again each time the game/player event triggers (because they are local to that event's function). It is highly recommended to only use local variables in your code (if you use anything besides console commands) unless you know how to properly check for non-existent variables/update them as needed.
I'm not sure if this is a bug report, or if it's intended behavior, so I'm dropping it in the comments.
There seems to be an artificial character limit on all three of the Run On New Game fields that applies to both the CET overlay as well as the text files they correspond to. I can't tell if this is a CET limitation or one imposed by the command line processor of this mod, but I thought I'd bring it to your attention in any case. If it's a hard limit and there's no fix for it, is there a way to call and run commands stored in a separate file as a workaround? Like maybe defining an alias in the initialization event or function override fields? Sorry if this is something I should already know, I'm still learning Lua.
I'll see if I can help, but I need some more info first. What happens when you use your Cyber Engine Tweaks keybind to open its screen overlay? Do you see a black bar somewhere with "Batch Console Command Executor" somewhere? If not, then either CET or this mod wasn't installed properly. If you do see that, could you describe what you're trying to do, and what happens when you try to do it?
I've got a bug report / feature request, but first, I have to say, this is an incredibly powerful tool you've made here, and I'm extremely grateful for it. The possibilities it opens up are staggering. I've had it installed for a while, and it wasn't until yesterday that I finally got around to playing around with it. Once I realized what I could do with it, I immediately abandoned my current playthrough and spent the rest of the night cooking up ideas and testing out console commands. I'm putting together an entire suite of commands that will completely change everything about the way I play, and once I'm done, I'm going to strip it of my personal preferences, polish it for general use, and upload it to the Nexus so that everyone can see what this tool is really good for.
On to the business: I dunno if this is intended behavior or not, but the Run On Player Entering Combat and its corresponding hook for exiting combat also activate when entering and exiting stealth mode. That kinda puts the kibosh on what I was going to use those hooks for. At the very least, the section header text should be changed to make it more clear to the player when their commands and scripts will execute, but ideally the functions would be separated, so that those two sections only run on entering / exiting combat, with two new sections added that only fire when entering / exiting stealth. That would save me from having to learn Lua in order to create my own conditionals for those states, though I suppose I'll need to do that eventually anyway for what I'm planning.
While I'm on the subject, a really good place to insert another hook would be right after the player gains control following the mission The Heist, when they have the relic and now have to deal with its effects and consequences. I'm sure you can immediately see why that would be desirable. I'll be making extensive use of this tool from now on, so you can expect a lot more feedback from me in the future. Thanks again.
Thanks for the feedback and the report, and no, that was not intentional... I didn't think to test stealth at all (oops...lol), and I don't really use this mod personally, I just made it for other people, so still hadn't noticed...
Went ahead and fixed that, and I'll add the separate "stealth" triggers sometime soon, but it's late tonight so figured I'd just push that quick fix for now... I'll also look into adding a trigger for after the heist, as that could definitely be useful, for sure...
6 comments
if Game.GetTransactionSystem() then
local ts = Game.GetTransactionSystem() and Game.GetTransactionSystem() or nil
if ts and ts:GetItemDataByTDBID(Game.GetPlayer(), "Items.money") then
local money = ts:GetItemDataByTDBID(Game.GetPlayer(), "Items.money")
if money:GetQuantity() then
local quantity = money:GetQuantity()
print(tostring(quantity))
if quantity <= 40000000 then
Game.AddToInventory("Items.money", 1000000)
else
print("You already have over 40m Eddies. Did not add any more.")
end
end
end
end
Plain English Translation:
If the game's transaction system is available (not nil) then do:
Declare local variable to store the game's transaction system (or nil if the transaction system isn't found).
If we have the transaction system variable defined and we can get the player's money item then do:
Declare local variable to store the money item data.
If we can get the quantity of the player's money then do:
Declare local variable to store the quantity of money.
Print the amount of money to CET console log.
If money quantity is less than or equal to 40m Eddies then do:
Add 1 million Eddies to the player's inventory.
else (if quantity is greater than 40m Eddies then do):
Print that the player already has 40m Eddies and no more were added in CET console log.
ending the if/else statements for quantity being >/=/< 40m Eddies
ending the if statement for checking quantity
ending the if statement for player's money
ending the initial if statement
Note: Declaring the variables as "local" variables causes them to reset and check for everything again each time the game/player event triggers (because they are local to that event's function). It is highly recommended to only use local variables in your code (if you use anything besides console commands) unless you know how to properly check for non-existent variables/update them as needed.
There seems to be an artificial character limit on all three of the Run On New Game fields that applies to both the CET overlay as well as the text files they correspond to. I can't tell if this is a CET limitation or one imposed by the command line processor of this mod, but I thought I'd bring it to your attention in any case. If it's a hard limit and there's no fix for it, is there a way to call and run commands stored in a separate file as a workaround? Like maybe defining an alias in the initialization event or function override fields? Sorry if this is something I should already know, I'm still learning Lua.
On to the business: I dunno if this is intended behavior or not, but the Run On Player Entering Combat and its corresponding hook for exiting combat also activate when entering and exiting stealth mode. That kinda puts the kibosh on what I was going to use those hooks for. At the very least, the section header text should be changed to make it more clear to the player when their commands and scripts will execute, but ideally the functions would be separated, so that those two sections only run on entering / exiting combat, with two new sections added that only fire when entering / exiting stealth. That would save me from having to learn Lua in order to create my own conditionals for those states, though I suppose I'll need to do that eventually anyway for what I'm planning.
While I'm on the subject, a really good place to insert another hook would be right after the player gains control following the mission The Heist, when they have the relic and now have to deal with its effects and consequences. I'm sure you can immediately see why that would be desirable. I'll be making extensive use of this tool from now on, so you can expect a lot more feedback from me in the future. Thanks again.
Went ahead and fixed that, and I'll add the separate "stealth" triggers sometime soon, but it's late tonight so figured I'd just push that quick fix for now... I'll also look into adding a trigger for after the heist, as that could definitely be useful, for sure...
Edit: Also, good luck on your mod :)