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

Lua help, and RC english documentation

2 posters

Go down

Lua help, and RC english documentation Empty Lua help, and RC english documentation

Post by Point.Blank 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?
Point.Blank
Point.Blank
Car
Car

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

Back to top Go down

Lua help, and RC english documentation Empty Re: Lua help, and RC english documentation

Post by JHaskly 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

JHaskly
Admin

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

Back to top Go down

Lua help, and RC english documentation Empty Re: Lua help, and RC english documentation

Post by Point.Blank 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.
Point.Blank
Point.Blank
Car
Car

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

Back to top Go down

Lua help, and RC english documentation Empty Re: Lua help, and RC english documentation

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

Sure Very Happy

JHaskly
Admin

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

Back to top Go down

Lua help, and RC english documentation Empty Re: Lua help, and RC english documentation

Post by Point.Blank 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.
Point.Blank
Point.Blank
Car
Car

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

Back to top Go down

Lua help, and RC english documentation Empty Re: Lua help, and RC english documentation

Post by JHaskly 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?

JHaskly
Admin

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

Back to top Go down

Lua help, and RC english documentation Empty Re: Lua help, and RC english documentation

Post by Point.Blank 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?
Point.Blank
Point.Blank
Car
Car

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

Back to top Go down

Lua help, and RC english documentation Empty Re: Lua help, and RC english documentation

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

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