scene.lua is most likely to have errors so it can't loadfile it. Therefore when you call/use loadA, it is nil and crashes.
i rather not put out the code that iv done out like this but i need help as i keep getting an error with my menu.lua for sora adventure. It keeps saying attempt to global 'LoadA' but there seems to be nothing wrong. can anyone help heres the code below
status = "menu"
Black = Color.new(0, 0, 0)
Red = Color.new(255, 0, 0)
--load images--
Background = Image.load("backgrounds/menu.png")
--load files--
LoadA = loadfile("scene.lua")
LoadB = loadfile("instructions.lua")
LoadC = loadfile("credits.lua")
while true do
current = 1
oldpad = Controls.read()
while true do
pad = Controls.read()
screen:clear()
----prints to the screen-------
screen:blit(0, 0, Background)
screen:print(185, 175, "Start Game", Black)
screen:print(185, 195, "Instructions", Black)
screen:print(185, 215, "Credits", Black)
screen:print(314, 263, "Press Home to exit", Black)
screen:print(320, 4, "Gunntims0103-Coder", Black)
-----this code is so that when you highlight an option in a menu it turns red-----
if current == 1 then
screen:print(185, 175, "Start Game", Red)
end
if current == 2 then
screen:print(185, 195, "Instructions", Red)
end
if current == 3 then
screen:print(185, 215, "Credits", Red)
end
-----this makes it so that you can scroll through your menu----
if pad:up() and oldpad:up() ~= pad:up() then
current = current-1
end
if pad:down() and oldpad:down() ~= pad:down() then
current = current+1
end
if current == 4 then
current = 1
end
if current == 0 then
current = 3
end
-----this is to select your menu options------
if pad:cross() and current == 1 then
LoadA()
end
if pad:cross() and current == 2 then
LoadB()
end
if pad:cross() and current == 3 then
LoadC()
end
screen.waitVblankStart()
screen:flip()
oldpad = pad
end
end
scene.lua is most likely to have errors so it can't loadfile it. Therefore when you call/use loadA, it is nil and crashes.
this is the code im using for the scene in the game
i keep getting this errorBlack = Color.new(0, 0, 0)
--load images, this is for the cutscene--
Background = Image.load("backgrounds/scene1.png")
Sora = Image.load("sprites/sora.png")
Enemie = Image.load("sprites/enemie.png")
Talk = Image.load("sprites/talk.png")
--load files--
loadA = loadfile("menu.lua")
pad = Controls.read()
--prints to screen--
Screen:blit(0, 0,Background)
Screen:blit(31, 230,Sora)
Screen:blit(330, 230,Enemie)
Screen:blit(35, 30,Talk)
if pad:cross() then
loadA()
end
Screen:waitVblankStart()
Screen:flip()
end
error: scene.lua:26: <eof> expected near 'end'
what do i do. i also removed the "ingame.lua" loading from my script as there is no such file at the moment so i just made it go back to the menu after you press X.
too many ends....delete 1 of them
thanx worked like a charm
now im having another bug actaully 2 of them
-menu.lua doesnt load instructins or credits when i try to access them the game goes to the scene.lua
-the scene.lua keeps the options of the menu.lua on the screen why this is happening i have no idea
drEN4wt can i email you what i have cause the game is getting bizzare on me and i can fix it
sure , but i cant look at it for a few hours, my psp has been conviscated by my 4 yr old son
will pm my email
drEDN4wt you dont use luaplayerwindows for the computer
o yea thanx for helping me il send you a copy when i get the pm
i did that look at this code
screen clear is in the bold but i still have the problem i pm'ed yaustar as well for help to this problem and sent him a rapidshare link to what i have so far hope i can get this bug fixedBlack = Color.new(0, 0, 0)
--load images, this is for the cutscene--
Background = Image.load("backgrounds/scene1.png")
Sora = Image.load("sprites/sora.png")
Enemie = Image.load("sprites/enemie.png")
Talk = Image.load("sprites/talk.png")
--load files--
LoadA = loadfile("menu.lua")
pad = Controls.read()
screen:clear()
--prints to screen--
screen:blit(0, 0,Background)
screen:blit(31, 230,Sora)
screen:blit(330, 230,Enemie)
screen:blit(35, 30,Talk)
if pad:cross() then
LoadA()
Screen:waitVblankStart()
Screen:flip()
end
Also is it possible to have a cut scene in lua set up like this
have 2 sprites on screen facing each other enemies they will be blit to the screen in the code
then have a talk sprite, the every time you press X the old talk sprite gets cleared and a new one appears. To give the effect of a cut scene and to give the effect as if players are talking. also would i have to use dofiles to do this like
if pad:cross then
loadA()
end
loadA would be the code that blits the new talk sprite to the screen and gets rid of the new one every time you press X
is this even possible im sure it is
im going to try it after the bugs are fixed
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks