Jump to content

Load map error


TattieBoJangle
 Share

Recommended Posts

Hi guys looking for a little help i followed Ricks tut for loading levels but i am getting an error

OpenAL: AL_INVALID_OPERATION i have went over the lua and cant see what the problem is it loads my second level for a split second the crashes with the above error any help would be great.

 

App.lua

 

--This function will be called once when the program starts
function App:Start()

--Initialize Steamworks (optional)
Steamworks:Initialize()

--Set the application title
self.title="MyGame"

--Create a window
self.window=Window:Create(self.title)
self.window:HideMouse()

--Create the graphics context
self.context=Context:Create(self.window,0)
if self.context==nil then return false end

--Create a world
self.world=World:Create()

--Load a map
local mapfile = System:GetProperty("map","Maps/start.map")
self.mapFile = "Maps/start.map"
if Map:Load(self.mapFile)==false then return false end
self.mapFile =""
return true
end
function App:SwitchLevel(name)
self.mapFile = name
end
function App:ShouldSwitchLevel()
if self.mapFile ~= "" then
self.world:Release()
self.world = World:Create()
Map:Load(self.mapFile)
self.mapFile = ""
end
end
--This is our main program loop and will be called continuously until the program ends
function App:Loop()
self:ShouldSwitchLevel()


--If window has been closed, end the program
if self.window:Closed() or self.window:KeyDown(Key.Escape) then return false end

--Update the app timing
Time:Update()

--Update the world
self.world:Update()

--Render the world
self.world:Render()

--Render statistics
self.context:SetBlendMode(Blend.Alpha)
if DEBUG then
self.context:SetColor(1,0,0,1)
self.context:DrawText("Debug Mode",2,2)
self.context:SetColor(1,1,1,1)
self.context:DrawStats(2,22)
self.context:SetBlendMode(Blend.Solid)
else
--Toggle statistics on and off
if (self.window:KeyHit(Key.F11)) then self.showstats = not self.showstats end
if self.showstats then
self.context:SetColor(1,1,1,1)
self.context:DrawText("FPS: "..Math:Round(Time:UPS()),2,2)
end
end

--Refresh the screen
self.context:Sync(false)

--Returning true tells the main program to keep looping
return true
end

 

LoadLevel.lua

 

Script.entered = false
Script.exited = false
Script.hadCollision = false
Script.Map = "" --path
function Script:UpdatePhysics()
if self.entered then
 if self.hadCollision == false then
	 if self.exited == false then
		 self.exited = true
		 self.component:CallOutputs("TriggerExit")
		 self.entered = false
	 end
 end
end
self.hadCollision = false
end
function Script:Collision(entity, position, normal, speed)
self.hadCollision = true
if self.entered == false then
 self.component:CallOutputs("TriggerEnter")
App:SwitchLevel(self.Map)
 self.entered = true
 self.exited = false
end
end

Asus Extreme v x99, Intel I7, Windows 8.1 64 Bit, SSD, Geforce GTX 980 4GB, 16GB Ripjaw DDR4

Link to comment
Share on other sites

I am now getting this error

 

Problem signature:

Problem Event Name: BEX

Application Name: MyGame.exe

Application Version: 0.0.0.0

Application Timestamp: 53e13953

Fault Module Name: StackHash_5861

Fault Module Version: 0.0.0.0

Fault Module Timestamp: 00000000

Exception Offset: PCH_35_FROM_ntdll+0x0003D2EC

Exception Code: c0000005

Exception Data: 00000008

OS Version: 6.3.9600.2.0.0.768.101

Locale ID: 2057

Asus Extreme v x99, Intel I7, Windows 8.1 64 Bit, SSD, Geforce GTX 980 4GB, 16GB Ripjaw DDR4

Link to comment
Share on other sites

I too have had the same error. I gave up as scripting isnt easy for me but would love to see a solution as I might need it in the future if I stay with leadwerks.

 

I was also wondering why no one seems to want to post some scripts that would help us noobies that cant script get started. Ive seen this in EVERY engine Ive used but Leadwerks. It kinda weighs down the engine for us guys that are just starting to learn. . . . See what i did there? rolleyes.gif Lead = Weight. . . . .

Asus sabertooth 990FX, AMD FX 9590 , Windows 7 Home Premium 64 Bit, 4 HDD's Western Digital Caviar Black set in Raid 0, 16 GB Crucial Ballistix Elite, Asus Radeon R9 270 X 4GB, Corsair CM750M,

Link to comment
Share on other sites

For whatever reason, sounds are failing with the command Release(). By using Release() to free the sound it causes the 'OpenAL: AL_INVALID_OPERATION' error. By changing the script 'ReleaseTableObjects.lua' to set the variable to 'nil' instead of Release() prevents the error from occurring, but I am not too convinced the sound has been properly released from memory.

function ReleaseTableObjects(t)

if type(t)=="table" then

local key,value

for key,value in pairs(t) do

if type(value)=="table" then

ReleaseTableObjects(value)

elseif type(value)=="userdata" then

--value:Release()

value=nil

end

end

end

end

 

 

I was also wondering why no one seems to want to post some scripts that would help us noobies that cant script get started. Ive seen this in EVERY engine Ive used but Leadwerks. It kinda weighs down the engine for us guys that are just starting to learn. . .

There are a lot of example scripts on this forum provided officially by Leadwerks and its community members. One community member, Aggror, has even taken the time to make several tutorial videos to help out. If you are not watching those as a 'noobie' then you are probably missing out on decent information to help you get started. And as always, use the forum to search for answers, and if you can't find the answer then post a question on the forum. So far I don't think many people have had their questions go completely unanswered.

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

I would assume it has to do with this error posted in this bug report (assuming you followed the suggestions that Aggror and I have both showed): http://www.leadwerks.com/werkspace/topic/10386-bug-with-included-tutorial-07-ai-and-eventsmap/page__st__20#entry77022

 

Josh had mentioned he found an issue with emitters being released before its supposed to happen in his previous status.

 

If you comment out the following lines in the fpsweapons.lua script, it should allow you to avoid that crash (at least it does for me):

function Script:Release()

--self.emitter[1]:Release()

--self.emitter[0]:Release()

self.emitter=nil

end

 

Keep in mind these are bugs and the workarounds I am showing you are not exactly recommended for actual use as I suspect its introducing other problems by not actually releasing these sounds and emitters properly.

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...