GTAGaming Forums

GTAGaming Forums (http://www.gtagaming.com/forums/index.php)
-   Grand Theft Auto IV Mods (http://www.gtagaming.com/forums/forumdisplay.php?f=318)
-   -   How to change the "key" in lua scripts (http://www.gtagaming.com/forums/showthread.php?t=112475)

OnyxCrowe21 01-07-2009 07:01 PM

How to change the "key" in lua scripts
 
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 07: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:
Code:

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:
Code:

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 07: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 03:38 AM

why is it some keys cant be used?


All times are GMT -6. The time now is 09:02 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.