Help me please!!!
4 posters
Page 1 of 1
Help me please!!!
So basically I'm trying to make an automatic landing gear raising and lowering system for my plane with Lua, but I keep getting this error:
"Attempt to compare with a nil number"
I'm trying to make it so that the angle of the chip holding the wheels corresponds to the 'wheels' value in my script.
PLEASE HELP>
"Attempt to compare with a nil number"
I'm trying to make it so that the angle of the chip holding the wheels corresponds to the 'wheels' value in my script.
PLEASE HELP>
- Code:
//plane
Val
{
drive(default=0,min=0,max=100000,step=20000)
updown(default=0,min=-100000,max=100000,step=25000)
turn (default=0,min=-5000,max=5000,step=500)
wheels(default=45,min=0,max=45,step=0)
}
Key
{
4:drive(step=2000)
0:updown(step=25000)
1:updown(step=-25000)
2:turn(step=-1000)
3:turn(step=1000)
}
Body {
Core(){
n:chip(){
//jet
s:jet(angle=-90,power=drive){
}
s:jet(angle=90,power=-drive){
}
w:chip(){
}
e:chip(){
}
n:jet(power=-updown){
}
}
//rightwing
w:chip(){
//flap
s:chip(){
}
w:chip(){
//flap
s:chip(){
}
w:chip(){
w:jet(power=turn){
}
}
}
}
//leftwing
e:chip(){
//flap
s:chip(){
}
e:chip(){
//flap
s:chip(){
}
e:chip(){
e:jet(power=-turn){
}
}
}
}
s:chip(){
s:chip(){
e:chip(angle=wheels){
e:wheel(){
}
}
w:chip(angle=wheels){
w:wheel(){
}
}
s:chip(){
s:chip(){
e:chip(angle=-30){
}
w:chip(angle=-30){
}
}
}
}
}
e:frame(angle=wheels){
e:wheel(){
}
}
w:frame(angle=wheels){
w:wheel(){
}
}
}
}
Lua{
function OnInit()
lndngr = 1
end
function OnReset()
lndngr = 1
end
function OnFrame()
if (_KEY(5)) == 1
then lndngr = 1
end
if (_KEY(6)) == 1
then lndngr = 0
end
if (lndngr == 1) and (wheels < 45)
then wheels = wheels + 1
end
if (lndngr == 0) and (wheels > 0)
then wheels = wheels - 1
end
end
}
ReadyPhoenix121- Cube
- Posts : 3
Join date : 2010-12-23
Re: Help me please!!!
hmmm....
I hardly know anything about Lua, but by the error message it seems that something is trying to use a non-existent number.
If you were using scripting, I could totally help you. Sorry
I hardly know anything about Lua, but by the error message it seems that something is trying to use a non-existent number.
If you were using scripting, I could totally help you. Sorry
Sting Auer- Hover
- Posts : 170
Join date : 2010-09-19
Location : Aw crap i think I'm lost.
Re: Help me please!!!
Variables are case sensitive. works good now
- Code:
function OnInit()
lNDNGR = 1
end
function OnReset()
lNDNGR = 1
end
function OnFrame()
if (_KEY(5)) == 1
then lNDNGR = 1
end
if (_KEY(6)) == 1
then lNDNGR = 0
end
if (lNDNGR == 1) and (WHEELS < 45)
then WHEELS = WHEELS + 1
end
if (lNDNGR == 0) and (WHEELS > 0)
then WHEELS = WHEELS - 1
end
end
Doc- Car
- Posts : 23
Join date : 2010-10-10
Location : On the edge of nowhere
Re: Help me please!!!
First off, Doc is correct.
Secondly, please do not, ever, post a thread with a title like "help me please!!!". Give the thread a title that is relevant to the topic and describes what you want.
Secondly, please do not, ever, post a thread with a title like "help me please!!!". Give the thread a title that is relevant to the topic and describes what you want.
JHaskly- Admin
- Posts : 235
Join date : 2010-07-16
Age : 28
Location : Brisbane
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum