Lua help, and RC english documentation

View previous topic View next topic Go down

Lua help, and RC english documentation

Post by Point.Blank on Wed Aug 18, 2010 9:27 pm

If I remember correctly, mouse button 3 (the mouse wheel) could be used as an input via Lua. How would you check if it is pressed? I'm pretty sure it was mentioned somewhere in the RC English documentation, but that was lost along with the Old/New/Dead forums. That, and is there a way to check if a button was pressed, but for it to continue executing a line of script even after it is released? I could do something like this:
Code:
if _KEY(5)=1 then
SWITCH1 = 1
end
if SWITCH1 > 0 then
CHIPANGLE = CHIPANGLE + 1
end
But surely there's a better way?
avatar
Point.Blank
Car
Car

Posts : 24
Join date : 2010-08-11
Age : 23
Location : Ontario, Canada

View user profile

Back to top Go down

Re: Lua help, and RC english documentation

Post by JHaskly on Thu Aug 19, 2010 12:55 am

Code:
if _KEY(5)==1 then
SWITCH1 = 1
end

It depends on what you want exactly. If you are looking for the equivalent of a _KEY(<keynum>) function, then you're after _ML(), _MM(), and _MR(), which are the mouse left, middle, and right.

If you're after the _KEYDOWN and _KEYUP functions, that's a little trickier.


Last edited by JHaskly on Fri Aug 20, 2010 12:58 am; edited 1 time in total

_________________
Previously (and currently) known as Juz.

Please do not write "LUA", beause it's "Lua". It's Moon in Portuguese, not a Limited User Account, Last Universal Ancestor, or the Lukla Airport in Nepal.

JHaskly
Admin

Posts : 235
Join date : 2010-07-16
Age : 21
Location : Brisbane

View user profile

Back to top Go down

Re: Lua help, and RC english documentation

Post by Point.Blank on Thu Aug 19, 2010 6:35 am

The first question was just asking for the code for checking if the middle button was pressed, and the second question was basically asking if you could check if a button was ever pressed. They were not related to each other, but I got an answer that satisfies me, so thank you.
avatar
Point.Blank
Car
Car

Posts : 24
Join date : 2010-08-11
Age : 23
Location : Ontario, Canada

View user profile

Back to top Go down

Re: Lua help, and RC english documentation

Post by JHaskly on Fri Aug 20, 2010 12:58 am

Sure Very Happy

_________________
Previously (and currently) known as Juz.

Please do not write "LUA", beause it's "Lua". It's Moon in Portuguese, not a Limited User Account, Last Universal Ancestor, or the Lukla Airport in Nepal.

JHaskly
Admin

Posts : 235
Join date : 2010-07-16
Age : 21
Location : Brisbane

View user profile

Back to top Go down

Re: Lua help, and RC english documentation

Post by Point.Blank on Mon Aug 23, 2010 10:44 am

Ok, new question: I know it is fairly simple to have something with auto-pilot(i.e. maintain heading), but I would like to know how to do this using a point or reference instead of heading and altitude. I was planning to use this for a squadron model with multiple (2-4) planes following the leader, so I need to have the other planes automatically follow a position relative to the core, attached to the leader. The position should also be changeable, so you can change formation.
avatar
Point.Blank
Car
Car

Posts : 24
Join date : 2010-08-11
Age : 23
Location : Ontario, Canada

View user profile

Back to top Go down

Re: Lua help, and RC english documentation

Post by JHaskly on Tue Aug 24, 2010 2:55 am

It depends on what you want exactly. Do you want a way to get the required heading and altitude, the _EX and _EY values of the target to you, or the local pitch and yaw to the target?

_________________
Previously (and currently) known as Juz.

Please do not write "LUA", beause it's "Lua". It's Moon in Portuguese, not a Limited User Account, Last Universal Ancestor, or the Lukla Airport in Nepal.

JHaskly
Admin

Posts : 235
Join date : 2010-07-16
Age : 21
Location : Brisbane

View user profile

Back to top Go down

Re: Lua help, and RC english documentation

Post by Point.Blank on Tue Aug 24, 2010 3:57 pm

Basically, the X,Y and Z coordinates of a point relative to the core, which the leader plane mounts. One point per wing man, and they follow their assigned point. This way, you should be able to have squadron flight. I was hoping to make it in time for the RC promo video, but it will likely not come to pass. On the other hand, does anyone have a model with squadron flight that I can shamelessly rip code from?
avatar
Point.Blank
Car
Car

Posts : 24
Join date : 2010-08-11
Age : 23
Location : Ontario, Canada

View user profile

Back to top Go down

Re: Lua help, and RC english documentation

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

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