ID:1751035
 
Hello BYOND,

So im having a problem when i run the Forum account sidescroller library it compiles fine no errors but when in-game appears a runtime error saying this

runtime error:bad index
proc name:action (/mob/proc/action)
source file: movement.dm, 240
usr: null
src: 05edgar
05edgar (/mob): action(0) <--- this line parameter number changes when appear another runtime
05edgar (/mob): movement(0) <--- this one too till index 18 it keep appearing
: movement()
: movement loop()
: New()

Help me out i tried me best to fix it but.... I cant handle too well DM lists, it seems like an list error

If you need more information i will give no problem

Thanks, and sorry for my bad english
Could you post the code for us? I assume it's just you list not being properly defined
Hello, NNAAAAHH

Sorry for the late answer but, nope i didnt write the list or
something i dont know but i throw some screenshots, one in-game runtime errors; http://i.imgur.com/m08aVVv.png, and the another in line 240,movement.dm; http://i.imgur.com/Ae0DNsf.png


Thank you. if more info is needed tell me, i want to get this library fixed as fast as possible :/
Cloud Magic wrote:
You might be better off looking at libs that use actual pixel movement,
Forum_account's libraries use actual pixel movement.

implement gravity, jumping, and movement velocity on your own.
The point of libraries is (partially) to not need to do everything on your own while still getting stuff done. Everyone does this, even if they don't know it, and it's fine.
Pixel Movement: http://www.byond.com/forum/?post=121026

Sidescroller:
v3.0: http://www.byond.com/forum/?post=118422
v4.0: http://www.byond.com/forum/?post=121030

Basically, both Forum_account's Pixel Movement and Sidescroller use native and provide more features.
Hello, Cloud Magic & KaioChao

Yeah literally i wanted to use forum_account library for a fast development, but this error is actually getting annoying :/, there are many sidescroller libs but, forum's account is the best.

Thanks you again.
I believe Forum_account's Keyboard library has had a bug for a while where the keyboard isn't initialized before a library tries to use it. This is because client.keys is initially a string (where the [] list index operation doesn't work, hence the "bad index" runtime error) before set_macros() converts it to a list.

I'm not sure about a fix, since I haven't used his libraries in a while, but it's possible that in the Keyboard library you could move line 180 (set_macros() in client/New()) above the ..() and see if that fixes anything. It might cause other errors somewhere down the line, though, since it's been known that messing with the skin in client/New() has some kind of issue.

Another fix would be to replace all the client.controls[some_key] with a new proc client.CheckKey(some_key), where CheckKey(some_key) returns client.controls[some_key] only if client.controls is a list. This effectively adds a check to avoid the runtime error.
If don't fancy all of the extras in FA's library, you could always use Orange55's more basic approach to sidescrolling.

http://www.byond.com/developer/Orange55/Platformer
Hello, KaioChao

Amazing!, the runtime errors just got fixed thanks to the CheckKey(some_key) code but now the player is not moving, the code i just wrote for the CheckKey() was this

client/proc/CheckKey(some_key)
if(some_key in keys)
return keys[some_key]
else
return

all the runtime errors dissapeared, but now the player is not moving, i want to get a fix because if some other user may be experiencing this problem that people can get it fixed.

Thanks Kaiochao, if more info is needed pls tell me
Hello is there a way i can fix this :/

Thx
In response to 05edgar
I'm not sure. Can you show the library code where you replaced things with CheckKey()?