ID:921665
 
(See the best response by Albro1.)
Code:
key_down(k)
if(k == "x")
if(selecting || Dead)
return
if(Stamina <= 0)
move_speed = 8
else if(Stamina >= 0)
move_speed = 15
Stamina -= 5
Stamina_bar.Update()

key_up(k)
if(k == "x")
if(selecting || Dead)
return
if(Stamina >= Staminamax)
Stamina = 100
move_speed = 8
else
Stamina += 5
move_speed = 8


Problem description: In my game i use Forum_accounts Sidecroller library to handle the Pixel Movement in my game. The problem is the key_up and key_down are not responding, neither are my macros are working as well.

I think the problem could be that im working on a Linux OS, It worked before switching to Linux

Best response
Try using client/key_down() instead of mob. Also try some simple debugging output to see if it's being called.
I tried changing key_down() to client but i get a lot of errors for unidentified var (the vars used above are under mob/var).
As for debugging the keys i type are getting outputted the command just isn't going through
Then it's a issue with it being called, mind posting the bit where it's supposed to be called?(Mind you, I'm not familiar with FA's libs)
In response to NNAAAAHH
I don't understand what you when you say "where it's suppose to be called". This codes are suppose to make the mob (user) start run when you hold own x until there stamina runs out or until you release x. There's no other parts to this code except where the icon changes states.

PS. I have other key_down() commands that don't work as well, for example

mob
key_down(k)
if(k == "z")
weakhit()

In response to Aniste
Are you including them all under the same listing? If not, you'll have to insert ..() into the different parts you are defining key_down() in.


And generaly a proc has to be called from one place or another; I'm asking for you to display the code that calls the proc.
Both of the codes I provided are under the same listing it looks something like this:

mob
key_down(k)
if(k == "z")
weakhit()
else if(k == "x")
if(selecting || Dead) return
if(Stamina <= 0)
move_speed = 8
else if(Stamina >= 0)
move_speed = 15
Stamina -= 5
Stamina_bar.Update()

key_up(k)
if(k == "x")
if(selecting || Dead) return
if(Stamina >= Staminamax)
Stamina = 100
move_speed = 8
else
Stamina += 5
move_speed = 8


As for the proc are you asking the the key_down() key_up() proc?
In response to Aniste
Fine, I'll download FA's libary to check for myself.

In the mean time, please do check to find a instance where this is called.
[EDIT]
After spending all of two minutes looking at the lib you are having issues with; I found where the procs are being called.

client
verb
KeyDown(k as text)
set hidden = 1
set instant = 1

// if input is locked, we do nothing.
if(input_lock) return

if(!use_numpad)
if(k == "northeast")
k = "page up"
else if(k == "southeast")
k = "page down"
else if(k == "northwest")
k = "home"
else if(k == "southwest")
k = "end"

// convert numpad keys to their actual symbols
if(translate_numpad_to_numbers)
if(k in __numpad_mappings)
k = __numpad_mappings[k]

keys[k] = 1

if(focus)
if(hascall(focus, "key_down"))
focus.key_down(k, src)
else
CRASH("'[focus]' does not have a key_down proc.")


Note: The above is direct from Forum_account's Keyboard libary.

Please ensure this is included in what you have.
[END EDIT]
I don't have most of that considering i have a older version of his library

This what i have:

client
verb
KeyDown(k as text)
set hidden = 1
set instant = 1

// if input is locked, we do nothing.
if(input_lock) return

keys[k] = 1

if(focus)
if(hascall(focus, "key_down"))
focus.key_down(k, src)
else
CRASH("'[focus]' does not have a key_down proc.")

KeyUp(k as text)
set hidden = 1
set instant = 1

// if input is locked, we still update the keys
// list but that's it.
keys[k] = 0
if(input_lock) return

if(focus)
if(hascall(focus, "key_up"))
focus.key_up(k, src)
else
CRASH("'[focus]' does not have a key_up proc.")

#ifndef NO_KEY_REPEAT
KeyRepeat(k as text)
set hidden = 1
set instant = 1

// if input is locked we do nothing.
if(input_lock) return

if(focus)
if(hascall(focus, "key_repeat"))
focus.key_repeat(k, src)
else
CRASH("'[focus]' does not have a key_repeat proc.")


I could be that I have an older version?
It's probaly better to get his newer version; FA tends improve uppon his libaries rather than bugging them up. Who knows, it might solve your issue.
I just installed the latest update, It didn't help
OK, I looked through the libary further and found several things that could be the cause of this. ensure you're not making focus something it should not be; it's the client itself by default. You should also include key_down(k, client/c) instead of just key_down(k). And you should use ..() inside of the proc. If none of that works I'll spend more than five minutes looking through the libary.
Use client/key_down(). I've had issues with mob/key_down() before. Every client has a mob variable that references the mob it is assigned to. So, you would do this:
client/key_down(k)
if(k == "z")
mob.weakhit()
In response to Albro1
I had assumed he had already tried this and was basing my answers off of the fact that it did not work. I will be upset at time wasted if this is not the case.
In response to Albro1
When using client/key_down I get errors dealing with the vars in other key_down (Like the one used at the start of the post)
You obviously didn't read my post.

The reason you are getting errors is because those variables belong to the mob. So, to grab those variables, you use the client's mob variable.

if(mob.Dead)
In response to Albro1
Welp. It appears I wasted my time with this one. Serves me right, assuming things.