RigidChips
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Animate

3 posters

Go down

Animate Empty Animate

Post by Munchkin9 Sun May 29, 2011 3:15 pm

So this is actually a two-fold call for help:

1. I keep seeing the animate function in other people's lua. I am assuming that this changes the value of a variable step by step. Only problem is I have no idea how to use it and it doesn't appear in a any documentation. Any help would be welcomed.

2. I can't seem to get lua to recognize my key inputs. I am using RCD and when I put an if _keydown statement in the OnFrame function nothing happens what so ever. Once again help is appreciated.

Thanks in advance
-Munchkin9


Last edited by Munchkin9 on Sun May 29, 2011 3:21 pm; edited 2 times in total (Reason for editing : I failed)

Munchkin9
Cube
Cube

Posts : 3
Join date : 2011-05-29

Back to top Go down

Animate Empty Re: Animate

Post by RA2lover Sun May 29, 2011 4:45 pm

1- foo = animate(foo,bar,baz)

2- the RC standard library lua functions need to be called with all letters capital.

this means you need to use _KEYDOWN(foo) instead of _keydown(foo)
RA2lover
RA2lover
Walker
Walker

Posts : 382
Join date : 2010-10-11
Age : 29
Location : Brazil

Back to top Go down

Animate Empty Re: Animate

Post by Munchkin9 Sun May 29, 2011 5:29 pm

1. I literally have no idea what you just said.

2. I do use capitals. I was summing it up. I have actually since found that it does work. Only animate isn't working.

EDIT: What am I doing wrong:
Code:
  if _KEYDOWN(10) > 0 then
      if SWITCH == 0 then
        SWITCH = 1
      else
        SWITCH = 0
        end
    end

  if SWITCH == 1 then
      AIRBRAKES = AIRBRAKES - 10
      AIRBRAKES2 = AIRBRAKES2 + 10
    else
      AIRBRAKES = AIRBRAKES + 10
      AIRBRAKES2 = AIRBRAKES2 - 10
      end

The goal is: pressing 'V' will toggle a value between 1 and 0. If it is 1 then the air brakes deploy, if it is 0 then the air brakes retract. At the moment the air brakes aren't moving at all. The air brakes variables are set as the angles of two different chips (this works if I use keys normally but that requires two keys).


Last edited by Munchkin9 on Sun May 29, 2011 6:18 pm; edited 1 time in total (Reason for editing : Update)

Munchkin9
Cube
Cube

Posts : 3
Join date : 2011-05-29

Back to top Go down

Animate Empty Re: Animate

Post by bwansy Sun May 29, 2011 11:26 pm

The animate function is in my Lua library. In essence, a Lua library is a file that stores functions so that you don't have to copy the same set of common functions into each of your models. My library can be found here: https://rigidchips.forumotion.com/t54-bwansy-s-library

bwansy
Admin

Posts : 170
Join date : 2010-07-15

https://rigidchips.forumotion.com

Back to top Go down

Animate Empty Re: Animate

Post by Munchkin9 Mon May 30, 2011 10:47 am

You know I was thinking it might be only from your library. Since I'm pretty much learning all my programming by studying your stuff.

Mind explaining to me how it works? Looks useful.

Munchkin9
Cube
Cube

Posts : 3
Join date : 2011-05-29

Back to top Go down

Animate Empty Re: Animate

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum