PDA

View Full Version : How to change the "key" in lua scripts


OnyxCrowe21
01-07-2009, 08:01 PM
Hey guys, I hope this thread is read. I'm an idiot when it comes to this modding stuff.

I have Notepad++ downloaded in order to read the .lua scripts I download for the Alice program.

I've been noticing that ALL the scripts being released have TAB as the activation key. Is there any way (which I'm sure this is) I can change what key is used to activate the script?

For example: I have currently been using the saveme.lua script. To save anywhere, I just have to hit TAB.

Recently I downloaded the Bullet-time script and the Clear Wanted Level script.
Both of these use TAB as their key.

Can someone tell me/walk me through how to change the activation key so I can be able to use all scripts?

Thanks a lot. Forgive my ignorance! lol

-OC

rappo
01-07-2009, 08:11 PM
hey, don't worry about it - it's not ignorance, everybody's gotta learn somehow! :P I'll use the saveme.lua script as an example.. at the bottom of the file you'll see this line twice:
if (IsKeyPressed(9) == 1) then
this means "if the key pressed is TAB, then..." so basically 9 is the code for TAB. this value is called an ASCII decimal character code. each key on the keyboard has one. here's a huge table of ascii codes... the value you put in the LUA script is the one in the DEC column:

http://www.asciitable.com/asciifull.gif



furthermore you can make the LUA code run on two keypresses by doing something like:
if(IsKeyPressed(9) == 1 && IsKeyPressed(32) == 1) then
in that example the code checks to see if both TAB and SPACE are being pressed

OnyxCrowe21
01-07-2009, 08:26 PM
DUDE!!! You da man. haha

Thank you so much for this. I'm just getting into .lua scripting and modding. So this helps a TON!

Thanks, and probably look for more Q's in the future!

Peace!

-OC

lilmcnessy
04-29-2009, 04:38 AM
why is it some keys cant be used?