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

Help me please!!!

4 posters

Go down

Help me please!!! Empty Help me please!!!

Post by ReadyPhoenix121 Fri Dec 31, 2010 1:58 am

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>

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
Cube

Posts : 3
Join date : 2010-12-23

Back to top Go down

Help me please!!! Empty Re: Help me please!!!

Post by Sting Auer Fri Dec 31, 2010 10:02 am

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 Crying or Very sad
Sting Auer
Sting Auer
Hover
Hover

Posts : 170
Join date : 2010-09-19
Location : Aw crap i think I'm lost.

Back to top Go down

Help me please!!! Empty Re: Help me please!!!

Post by Doc Fri Dec 31, 2010 10:45 am

Variables are case sensitive. works good now Smile

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
Doc
Car
Car

Posts : 23
Join date : 2010-10-10
Location : On the edge of nowhere

Back to top Go down

Help me please!!! Empty Re: Help me please!!!

Post by JHaskly Fri Dec 31, 2010 12:48 pm

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.

JHaskly
Admin

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

Back to top Go down

Help me please!!! Empty Re: Help me please!!!

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