![]() |
Keydown?
I am trying to get keydown to work and it doesn't seem to be working. Does anyone know what I may be doing wrong? I've got:
if (keydown(Q)){ say2 example; } I have tried it several ways, and it just simply doesn't seem to work. Any ideas? |
You can't just have keydown as an event. Either use in a timeout or use keypressed (best).
Also, I don't believe that keydown(Q) will work, you'll have to use numeric indexes, I forgot what they are, but I believe Q is 9? |
Keypressed? I don't believe I've seen this used. Could you elaborate?
As for Q being 9, I see that now that you say that, I missunderstood the description before. Thank you. |
Yes, you'll want to use keypressed.
From commands.rtf: keydown(key) "the specified key is pressed (0..10: up,left,down,right,S,A,D,M,tab,Q,P)" So, yes, Q would be 9. If you want to use other letters not specified in the above info, you would use keydown2. The syntax for keydown2 is similar, keydown2(keycode,ignorecase); So, with that, and using the keycode() thing, you can do things like: NPC Code: In that code, it would check to see if a key was pressed (keypressed), then would check in the x button was pressed (keydown2(keycode(x),true)) and would ignore the case, so X would work as well. If all that was true, it would do the triggeraction. |
Ahh, I see, very awesome, thank you. :)
|
Quote:
|
Ok, I've gotten it working, but I have a question while not keydown related so much as it's related to the same script.
I'm trying to remove all default graal functions, such as, the default GUI, player, animations, sounds etc and I have managed to get rid of everything thus far except sound using the following. NPC Code: Is this the most effecient way to do this, I'm just worried that however they are not showing, that they are still being calculated unnessesarily? Also, I am trying to get rid of the sounds of walking/swords etc. any suggestion on how to achieve this? I tried: NPC Code: However it doesn't do the trick... Thank you again. ^^ |
Quote:
NPC Code:showstats 1+2+4+8+16+32+64+128+256+512; Quote:
Quote:
|
Just wanted to say, thanks for not being a complete jerk to him like some people would to others :)
|
Ahh, so the sound is in relation to the gani and I simply need to replace the gani? I was hoping to have it not process a gani whatsoever, but I suppose replacing with a single frame gani that does nothing would fix the problem? I am sort of putting together a menu, so a gani for it is pointless, but would a comepletely blank, single frame gani be the best solution?
|
I assume you mean to use the arrow keys in the menu to move, and you don't want the walk gani to commence, am I correct?
If that is the case, you should look into the commands disabledefmovement & enabledefmovement, or so. These commands will disable movement and enable it, respectively. It would be useful if you wanted to be able to use the arrow keys in the menu to select things, yet the player would not move and the gani would not play, and thus no walking sound. |
Actually, I don't want anything on the screen at all, what I am making uses a single level of all black tiles, no GUI, so character on screen, or anything. It's all just going to consist of a single large menu. There isn't really going to be any movement to disable or re-enable.
Edit: Quote:
|
Then dont you want...
NPC Code: The showstas command is using whats called a bit field to set lots of options at the same time. Simply sum up the numbers of the gui bits you do want to be seen, and then use showstats with that number. |
Quote:
|
Mh, you could've used keypressed too.
NPC Code: and for the showstats, if you have so many you might want to consider using. NPC Code: |
Quote:
Also, I thought that showstats 0; worked quite well. ^^ |
the variable 'allstats' is the addition of all stats flags, so only 'showstats allstats;' will enable all default status bar stuff again. GoZelda's example was right too, i believe, so 'showstats allstats-1024;' will show everything besides the player.
|
Ugh, one annoyance after another, I replaced the ani, but it still plays the original for a split second when I press arrow keys before it switches to the other animation, just enough time to play that retarded steps.wav once everytime you press an arrow key. :| Is there not a way to make it replace the gani before it gets the chance to start the default gani at all? :\
NPC Code: I appreciate the help. Thank you. ^^ |
The replaceanis should be done in the created block of a default weapon. You may also want to use the:
weaponorder= serveroption, which is a comma separated list of weapons the player should load first. As for the showstats, it's a relatively safe bet that the way you had it first was only showing the last one (512), overriding the others. However, 0 seems more fitting to what you want, unless there is something you still want to preserve. |
Quote:
The way I had it was doing the exact same as showstats 0; only with alot more commands going through obviously, so to do it with one is much better, thank you again. ^^ |
Quote:
|
Quote:
|
This might work?
if (keypressed&&keydown2(keycode(Q),)) { say2 example; } |
Quote:
You just didn't notice the inventory, which was the only thing showing since you had showstats 512;. Quote:
yes, I know this is late, but I didn't read those parts, so blah |
| All times are GMT +2. The time now is 06:45 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.