Jump to content

Need help with a script


Attchar

Recommended Posts

I recently began playing Oblivion again, and because of that I decided to make a small mod for my own, personal use. The mod requires some scripting, which I have limited knowledge of (I have some experience with C++ and I've done some Oblivion scripting before though).

 

I had to use OBSE to get some of the functions I needed, and I've got most of the script working now, I think. The script utilizes the SetControl and SetAltControl functions, which I manage to get working just fine. However, I need a way to remove any keybindings from a control, contrary to SetControl which assigns keybindings to controls. I tried using SetControl for the purpose, by assigning the Escape key to the control, but that didn't seem to have any effect at all. I also tried assigning 0 to the control, like this:

 

SetControl 5 0

 

But that didn't work either. So I'm quite on the loss of ideas currently, and was hoping someone could help me out with this.

 

Thanks in advance. :)

Link to comment
Share on other sites

I'm not totally sure what you're after but here are the possible 'functions' you need, I know from OBSE concerning keys:

Use GetKeyPress to do things with (multiple) keys. and IsKeyPressed(2) to track if they are pressed

Disablekey to disallow the usage of keys.

Use Holdkey, or TapKey to fake keypresses.

Link to comment
Share on other sites

No, sorry, that's not really what I'm looking for. I'll try to explain better:

 

In my script I use the SetControl function to bind a key to a control in the game, like SetControl 13 57 would make your character jump when you hit spacebar, as 13 is the value for the jump action and 57 is the value of spacebar within the game. Basicly it's the same as what you do in the controls menu, just that you do it via a script without interrupting the game to go into the menu. Now anyway, if I call the function SetControl 13 57 in the script, the controls will be mapped so that I jump when I hit spacebar. The problem comes when I want to stop spacebar from being associated with jumping, as I don't know what function to call to do that.

 

That probably wasn't much more understandable, but I hope you see what I try to say.

Link to comment
Share on other sites

I think you are, in fact what I want is the opposite. I'll give an example:

 

SetControl 4 256

 

This function assigns the player action 'attack' (in Oblivion script represented by 4) to the left mouse button (represented as 256). If I call this function I will attack by clicking the left mouse button. But later in the script I call this function:

 

SetControl 5 256

 

Here comes the problem, as this function assigns the 'activate' action to left mouse button, which it does. The problem is that even if I call this function Oblivion will associate left mouse button with both attack and activate, thus performing both actions at once. Therefore I need a function that I can call after the second one, which de-assigns (is that a word?) left mouse button from attack. Hopefully that made more sense.

Link to comment
Share on other sites

Ahh... right. Yeah. With ya.

 

Quite why or how I have no idea... but hey.

There'll be a 'clear command' script on one of the mods managers (I would expect. Not done much modding in Oblivion myself, but I do love playing around with some of the stuff you guys come up with :D and I've got scripting experience) What you would likely have to do is clear the command first though. Thats not Oblivion, its just computer logic. They do things in the order they're told to, or they don't do em at all (oh how I wish I could say that for the kids - Clean your room then you can play on the Xbox being the shining example) I'll have a play when I get five mins and see if I can come up with a 'macro' style command chain in one of my toys when I get home to wipe one command and assign another. If I can I'll let you know.

 

~Jen~

Link to comment
Share on other sites

Thank you! :)

 

To be honest it seems quite strange that there wouldn't be a function to do this in the script extender, at least I can't find anything about it on the CS wiki. It just seems like having a function which binds a key to a control, there ought to be a function which removes keys from a control. Well, thanks anyway.

Link to comment
Share on other sites

Sorry for the slow response mate...

I'm having some fun and games with this one too now. Its not as straightforward as it should be, thats for sure. I'll keep on plugging away at it though. Meanwhile, if you solve it before I do, let me know, k? Its bugging me now, lol.

 

Jen.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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