Jump to content

Scripting help


ripple

Recommended Posts

I want to be able to -manually- purge cell buffer without having to directly access the console to type 'PCB' (useful for people using game controllers rather than keyboard + mouse). My script won't save in the GECK, so obviously I am doing it wrong. Not surprising since I really haven't a clue what I am doing. Appreciate pointers. Right now the PCB hotkey assigned is 'backspace' (would prefer it to be something like ctrl + backspace).

 

scn PurgeCellBufferHotKeyScript

short PurgeCellBufferKeySetOnce
short PurgeCellBufferKey
short HasPressedKey

Begin GameMode
   if PurgeCellBufferKeySetOnce == 0
       set PurgeCellBufferKeySetOnce to 1
       set PurgeCellBufferKey to 8
   endif
   if isKeyPressed PurgeCellBufferKey == 1
       set HasPressedKey to 1
       PurgeCellBuffer
   elseif HasPressedKey == 1
       set HasPressedKey to 0
   endif
end

Edited by ripple
Link to comment
Share on other sites

Are you using GECK Power Up? It fixes the error reporting in GECK so that it will tell you where the error in your code is. I also suggest Cipscis' code validator, which will tell you about errors in your code.

 

To use multiple keys, you should just be able to check for

if isKeyPressed 14
  if isKeyPressed 29 || isKeyPressed 157

The first one is backspace, the second two are left and right control respectively. You don't need to do the

==1

check because that is the automatic check (1 is true, and if something is true, then the if statement is valid).

 

If you're having trouble with the hotkey press, then I would suggest looking at a mod like CASM for examples. I use it when I'm having trouble with hotkeys. Alternatively, you can also use MCM, which will handle hotkey setting for you when you set up a hotkey section. This would also allow your users to set the hotkey to whatever they want, if they use backspace for something else.

Link to comment
Share on other sites

Thanks for the tip. I do use GECK Power Up with NVSE support but there was no error message when the script did not compile. I used Cipsis' Script Validator and the only error that came back was 'Unknown Function "isKeyPressed"'....I have no idea why. Right now I just want to get this script working. It shouldn't be so hard to hotkey a simple console command but as you can see, I am capable of fubar-ing some simple operations. Once I get it working, I'll think about setting up a customizable hotkey through MCM.

 

How's this for a much simpler script for Hotkey PCB?

 

scn PurgeCellBufferHotKeyScript

Begin GameMode
if isKeyPressed 14
	PurgeCellBuffers
endif
end

 

No error messages in the Script Validator but still won't compile in the GECK though....

Edited by ripple
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...