startUp
The startUp handler is called after all OXPs have been loaded. It can be used to do one-off initialisation such as registering to listen for certain keystrokes etc.
I tried to find some time to have a look at it yesterday (lately spare time has become a short of luxury for me) and was not able to find any indication that Spidermonkey alone can handle key input events. I kept bumping onto references of the JS Event API, which seems to be something different/additional to what we have here and mostly seems to refer to detecting events on browser related scripts.
I think that if something like this were possible, Ahruman would have already made a big bold letter announcement about it. This is the kind of thing that opens new horizons in the game. My best guess at this point is that it is not feasible.
I tried to find some time to have a look at it yesterday (lately spare time has become a short of luxury for me) and was not able to find any indication that Spidermonkey alone can handle key input events. I kept bumping onto references of the JS Event API, which seems to be something different/additional to what we have here and mostly seems to refer to detecting events on browser related scripts.
I think that if something like this were possible, Ahruman would have already made a big bold letter announcement about it. This is the kind of thing that opens new horizons in the game. My best guess at this point is that it is not feasible.
Thanks for looking, i appreciate it.. .
Maybe we should alter the text on the wiki so that other people dont think the same as i did.
Okay, then things remain as they are: No additional key-commands.
While i can add some KeyEvents, in a javascript, they seem not to be affected by pressing any keys... as Another_commander, wrote, its meant for GUI or Browsers...
i´m getting "no properties error", which means, while KeyEvent is a reserved word, i cant use it :-/
dajt’s original JavaScript branch had nominal support for keystrokes, which is what the wiki refers to. I don’t think it actually worked properly.
Reintroducing them has been in the back of my mind, but there are problems: what if a user has mapped a game function to your key? What if multiple scripts define the same key? What if the character you select can’t be typed on the user’s keyboard?
The logical fix would be to add scripted keyboard assignments to the keyboard configuration screen. Oh, that’s right, we don’t have one…
dajt’s original JavaScript branch had nominal support for keystrokes, which is what the wiki refers to. I don’t think it actually worked properly.
Reintroducing them has been in the back of my mind, but there are problems: what if a user has mapped a game function to your key? What if multiple scripts define the same key? What if the character you select can’t be typed on the user’s keyboard?
The logical fix would be to add scripted keyboard assignments to the keyboard configuration screen. Oh, that’s right, we don’t have one…
One way is scrool down beetween availeble Equipment that requires a user input and then use a key to activate it, or select it..
Once it has been selected, further options become availeble, if need be...
sort a like when you pick missiles and cargo-to-eject... you call it a computer Interface thingi.
this.startup()
{
//just like normal startup
}
this.selected() // this is sort a like shiplaunced from staion
{
// in here you can use all the normal script abilites player.target and so on
}
this.keypressed(theKey)
{
// depending on what key is pressed
if(theKey == "a")
{
//do something
}
}
All methods and events that would be make sense should be included...