Don't use GameMode, Toaster.
Use Menumode otherwise the code will /NOT/ operate.
Which mode you use depends on where you're waiting for the response. If you open a message in gamemode, then it'll get the button result when the message's MenuMode finishes and it returns to gamemode.
Okay. That's all I've found out. That is this:
* OnActivate does not function in a script inside of a Perk.
* GameMode does not function in a script inside of a Perk.
* OnTrigger does not function in a script inside of a Perk.
* 'This' is not a replacement inside of a Perk.
* GetSelf does not function in a script inside of a perk.
* Menumode DOES function in a script inside of a Perk.
* The Radio box for "Run Immediately" will instantly crash a game when the perk is activated.
Edit: I answered my own question.
* The default reference ID for the script IS the target (In this case the Terminal)
MenuMode is a blocktype and a function- as a function it can be used to check for specific menu types. Blocks aren't meaningful inside result scripts, because the result script just runs once immediately when it's triggered.
GetSelf won't work because you can't declare variables in a result script, but it's unnecessary anyway as object & result scripts assume they'll run on whatever triggered them- the activated object for Perk result scripts, the NPC for package & dialogue result scripts, and so on. If you need variables in a result script, use globals or quest variables (e.g. set myQuest.Var to [whatever], then compare getrandompercent to myQuest.Var).
That's exactly what's happening. That said, you can't even update variables because it's all in the same frame. So variables are completely useless. I'm thinking that's a bug with the game, and I was thinking about maybe bypassing it by creating an object with the actual hacking script on the "OnActivate" trigger.
Then in the perk entry I put Activate "Refid" "Terminal RefId".
Yep, faux functions are a not entirely uncommon way of doing things if you need to use variables in ways you couldn't use them in result scripts- for example there's no way to use variables as arguments (i.e. player.additem MyQuest.Var doesn't work) other than globals, which don't support references. Your script could just be rejigged to use quest variables instead, though.
In addition, because "Run Immediately" doesn't work as a flag, I can't run a script pre activation (Pre priority) to the main dialogue to set the global "TerminalDiff". Thus I can't do a check to make sure the player can even /ACTIVATE/ the terminal because of skill requirements.
That's why you make auto-hack an activate choice, and you conditionalise that choice's display on the terminal lock level and the player's skill. Entirely hijacking the terminal activate behaviour's not going to work, and seems pretty insane when all you want to do is display a menu that's "Activate normally"/"Auto-hack" which is exactly what adding an activate choice would do.