Josh Posted July 31 Author Posted July 31 @Alienhead has reported a problem with this. Quote Let's build cool stuff and have fun.
Alienhead Posted July 31 Posted July 31 Maybe .. just maybe this might help - Here's the first few lines of code in the main.lua require("consolepad") --Load FreeImage plugin (optional) local fiplugin = LoadPlugin("Plugins/FITextureLoader") --Get the displays local displays = GetDisplays() Now if I put a Notify("blah blah") at the very top of the code - Notify("blah blah") require("consolepad") --Load FreeImage plugin (optional) local fiplugin = LoadPlugin("Plugins/FITextureLoader") --Get the displays local displays = GetDisplays() The notification box pops up when I run the compile. So I moved it below the require file, these are the first two lines in the entire project mind you. require("consolepad") Notify("blah blah") --Load FreeImage plugin (optional) local fiplugin = LoadPlugin("Plugins/FITextureLoader") --Get the displays local displays = GetDisplays() This fails. So I opened the require file and put this at the very very top of it. Notify("blah blah") ConsolePadVersion = "2.0" ConsolePadynStatusBars = false This fails, no box pops up and app never takes off. Seems to be a problem with require("") >> Hope this helps some ! Quote Alienhead Components and Software
Josh Posted July 31 Author Posted July 31 This is the error: So I guess the problem is that require() doesn't work with Zip packages. Also, in the next build, the indexes for GetMaterialLayers() will be one-based. If you see an error that says "Index out of range" this is the cause. Loading package "data.zip" Running script "Source/System/ErrorHandler.lua" Running script "Source/System/ComponentSystem.lua" Running script "Source/Components/AH-ArcherController/ArcherController.lua" Running script "Source/Components/AH_UltraFootStepSFX/UltraFootStepSFX.lua" Running script "Source/Components/AI/Monster.lua" Running script "Source/Components/Appearance/ChangeEmission.lua" Running script "Source/Components/Appearance/ChangeVisibility.lua" Running script "Source/Components/Logic/Relay.lua" Running script "Source/Components/Motion/Mover.lua" Running script "Source/Components/Motion/SlidingDoor.lua" Running script "Source/Components/myUtilities/ObjectPool.lua" Running script "Source/Components/Physics/Impulse.lua" Running script "Source/Components/Physics/SlidingDoor.lua" Running script "Source/Components/Physics/SwingingDoor.lua" Running script "Source/Components/Player/CameraControls.lua" Running script "Source/Components/Player/FirstPersonControls.lua" Running script "Source/Components/Player/FPSPlayer.lua" Running script "Source/Components/Player/ThirdPersonControls.lua" Running script "Source/Components/Player/VRPlayer.lua" Running script "Source/Components/Sound/AmbientNoise.lua" Running script "Source/Components/Sound/ImpactNoise.lua" Running script "Source/Components/Triggers/CollisionTrigger.lua" Running script "Source/Components/Triggers/DoorTrigger.lua" Running script "Source/Components/Triggers/PushButton.lua" Running script "Source/Components/UAGC/Console.lua" Running script "Source/Components/UAGC/EcoSystem.lua" Running script "Source/Components/UAGC/Pickup.lua" Running script "Source/Components/UAGC/Poi.lua" Running script "Source/Components/UAGC/Punchingbag.lua" Running script "Source/Components/UAGC/Rope.lua" Running script "Source/Components/UAGC/UAGController.lua" [sol2] An error occurred and has been passed to an error handler: sol: runtime error: [string "source\components\uagc\uagcontroller.lua"]:1: module 'Components/UAGC/Utilities/General' not found: no field package.preload['Components/UAGC/Utilities/General'] no file 'Source/Components/UAGC/Utilities/General.lua' no file 'Modules/Components/UAGC/Utilities/General.dll' stack traceback: [C]: in function 'base.require' [string "source\components\uagc\uagcontroller.lua"]:1: in main chunk sol: runtime error: [string "source\components\uagc\uagcontroller.lua"]:1: module 'Components/UAGC/Utilities/General' not found: no field package.preload['Components/UAGC/Utilities/General'] no file 'Source/Components/UAGC/Utilities/General.lua' no file 'Modules/Components/UAGC/Utilities/General.dll' stack traceback: [C]: in function 'base.require' [string "source\components\uagc\uagcontroller.lua"]:1: in main chunk [string "source\components\uagc\uagcontroller.lua"]:1: in main chunk Quote Let's build cool stuff and have fun.
Alienhead Posted July 31 Posted July 31 Quote So I guess the problem is that require() doesn't work with Zip packages. Oh wow... that slams the door on quite a many of my projects, if not all. Quote Alienhead Components and Software
Alienhead Posted July 31 Posted July 31 Quote Also, in the next build, the indexes for GetMaterialLayers() will be one-based. If you see an error that says "Index out of range" this is the cause. So instead of tbl[num] -1, I'll need to start at 1 for layer one ? 1 Quote Alienhead Components and Software
Alienhead Posted July 31 Posted July 31 How about if we use compiled LUAC as a require(), and just leave them in the directory structure outside of the zip? These function the same as a DLL. In most cases. Quote Alienhead Components and Software
Solution Josh Posted July 31 Author Solution Posted July 31 I am adding a command for Lua: import("Source/file.lua") This acts like require, but only works with .lua files, not DLLs. It will return whatever single value the script returns, if any. It will only get run once if it is called multiple times. It will also work with packages. Do this: import ("Source/Components/UAGC/Utilities/General.lua") import ("Source/Components/UAGC/Utilities/HandtoHand.lua") import ("Source/Components/UAGC/Utilities/RangedCombat.lua") import ("Source/Components/UAGC/Utilities/MeleeCombat.lua") import ("Source/Components/UAGC/Utilities/ItemsDbase.lua") import ("Source/Components/UAGC/Utilities/SoundManager.lua") import ("Source/Components/myUtilities/ObjectPool.lua") You still have some errors because some sound files are not being included in the package, but that is another matter. 1 Quote Let's build cool stuff and have fun.
Recommended Posts
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.