Jump to content

Search the Community

Showing results for tags 'Lua'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Blogs

  • Development Blog
  • Canardian's Blog
  • Beyond Civilization Blog Ext
  • Tyler's Blog
  • macklebee's Blog
  • B-Byrnes' Blog
  • Marleys Ghost's Blog
  • omid3098's Blog
  • Richardsimpo123456's Blog
  • DJDD's Blog
  • Rick's Blog
  • --
  • xtreampb's Blog
  • Economically Disadvantaged
  • klepto2's Blog
  • Old Blog
  • Chris Paulson's Blog
  • Davaris' Blog
  • nil
  • Rekindled Phoenix's Blog
  • Flexman's Blog
  • Kattemaksu Online
  • Marcousik's Creations Blog
  • EVE LBS Studio
  • Rendering puzzles
  • Screen Size Utility
  • Niosop's Blog
  • 1299 RTS Game Project
  • Blitzbat's Blog
  • gordonramp's Blog
  • Andy Gilbert's Blog
  • Marcus' Blog
  • JornAggror Blog
  • diedir's Blog
  • wayneg's Blog
  • Masterxilo's Blog
  • Dave Lee's Blog
  • peubuy's blog
  • OD Arts -Leadwerks Blog
  • The progression......
  • Ultra Software Company Blog
  • The Progression
  • Pancake's Blog
  • Test Blog
  • BLaBZ Blog
  • Pure³d's Blog
  • dreamhead Blog
  • RVL's Blog
  • DB's Blog
  • Toxin Games Development Blog
  • CombatHelo Blog (RSS Import)
  • Foolish's Blog
  • ZioRed's Corner
  • Toxin Games Twitter
  • Shard - Third Initiative
  • Shard's Blog
  • Soamp's Blog
  • Soamp's Blog
  • Laurens' Blog
  • JT`s warehouse district
  • Kennar's Blog
  • KiteFuchs' Blog
  • KiteFuchs' Blog
  • Rachel's Dev-Blog
  • Eagle's Blog
  • zaphos' Blog
  • please delete this blog
  • Afke's Blog
  • Richard Simpson
  • knowledgegranted's Blog
  • EdzUp(GD)'s Blog
  • aGameLife's Kelasel MMORPG Blog
  • tournamentdan's Blog
  • Beyond Civilization Blog
  • smashthewindow
  • AnniXa's Blog
  • AnniXa's Blog
  • Elemental Development
  • DigitalHax Blog
  • Aria's Blog
  • Strogg76's Blog
  • Clackdor's Blog
  • Leadwerks Project Status
  • simpleprogrammer's Blog
  • Pathfinding in LE.2.x
  • Naughty Alien's Blog
  • smashthewindow's Blog
  • Ali Salehi's Blog
  • Jardar's Blog
  • Chris Vossen's Development Blog
  • Scarlet Thread Studios' Blog
  • Kronos' Blog
  • Benton's Blog
  • ChrisV's Blog
  • tjheldna's Blog
  • shadmar's Blog
  • 3D Masons, LLC
  • Andy Gilbert's Enviro Models
  • ParaToxic's Blog
  • NarkLord's Blog
  • ChrisMAN's Blog
  • ChrisMAN's Blog
  • CGMan's Blog
  • The Game
  • Chris Tutorials
  • Leadwerks 3 Experience
  • An Alien Saga
  • klepto2 & Leadwerks 3
  • Inside the mind of eternal insomniac
  • josk's Blog
  • Shader Development in Leadwerks 3.1
  • 3D Coat : Column game making of
  • Einlander's Blog
  • Ginger George's Blog
  • I have a problem
  • Michael_J's Blog
  • nasamydifol's Blog
  • Digman's Blog
  • noesisGUI
  • SavageDogg38's Blog
  • Built from Ruins
  • Remaining Days
  • test_external_blog
  • The Hunt For Food Blog
  • Crazy Minnow Studio
  • CrazyMinnowStudio
  • Guppy's Blog
  • Playing Online
  • Evayr's Blog
  • DerRidda's Blog
  • Karl's Blog
  • whiterabbit's Blog
  • Tinyboss Games
  • abendkleider's Blog
  • sacguccireplica's Blog
  • Arena
  • Imchasinyou's Blog
  • xtom's Blog
  • Lua is better than you think.
  • mdgunn's Blog
  • Crime Closer
  • lxFirebal69xl's Blog
  • Wedmer's Blog
  • Lockdown, going forward.
  • Pump-Action Captain
  • Igor's Blog
  • Dead Anyway
  • Runenrise and more
  • reepblue's Blog
  • Slippy's Corner
  • LUA Musings
  • severjack's Blog
  • mikeporter's Blog
  • miko93's Blog
  • Megalocerous' Blog
  • lxFirebal69xl's Blog
  • aiaf's Blog
  • Lostghbear's Blog
  • echo $BLOG_NAME > blog_title.tmpl
  • johnadam111's Blog
  • Dwarf Beard
  • burgelkat's Blog
  • Charrua's Blog
  • peterpaul's Blog
  • joshmathews' Blog
  • Martin Kearl's Blog
  • Brutile's blog
  • tipforeveryone's Blog
  • Glushchenko Blog
  • Express Lab Games Blog
  • Blueapples' Blog
  • DooMAGE's Blog
  • Structura devblog
  • UltraEngine - Experiences, add-ons and other Stuff
  • martyj's Blog
  • Dragonfreak's Blog
  • Brutile's Blog
  • assigmenthelp
  • Case Study Assignment Help
  • How to deal with bad grade ?
  • How to deal with bad grade ?
  • GameDev Blog
  • devcjohnson's Blog
  • devcjohnson's Blog
  • THE WHAT? Blog
  • The Demurian Scribe
  • GUI Editor
  • GUI Tutorial
  • noob_shaders
  • The Seventh World
  • Phodex Games Blog
  • Leadwerks VS Source 2
  • Work in Progress - Scifi PBR Media
  • [C++] First Player game start
  • The Blog of Yue
  • Snowboarding Development Blog
  • Ocean: Rendering in Leadwerks 4
  • Game Ready Maps
  • Ultra App Kit (Advanced Custom Widgets)
  • Poking around
  • SALVATIONLAND
  • Blender tutorials
  • Usefull Scripts & Components
  • Thirsty Panther
  • Ultimate Action Game Controller

Forums

  • Software
    • General Discussion
    • Programming
    • Game Artwork
    • Showcase
    • Suggestion Box
    • Bug Reports
  • Addons
    • Extensions & Plugins
    • Components
    • Addon Development
  • Platforms
    • Windows
    • Linux
    • macOS

Categories

  • Streams and Events
  • Tutorials
  • Games
  • Work in Progress

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Location

  1. I have been working on a simple laser deflection game that dynamically creates geometry-based beams that automatically calculate deflection, bounce angles, and allow the player to rotate deflectors to guide the beam to the goal. As I familiarize myself with the Leadwerks API, I thought I might share my experiences and code examples here if anyone is interested. Please let me know if this sounds interesting and I will continue.
  2. FYI, Math:Abs() is not listed in the command reference. It's available, and works as expected, just not documented. http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/math/
  3. I have a script with a function that prints text to the console: function Script:TestFunction() System:Print("TEST PRINT") end When I import this script into player script and call this function in Script:Start everything works fine. import "Scripts/Player/TestScript.lua" ... function Script:Start() self:TestFunction() ... But when I also import this script into MonsterAI script calling this function from player script gives me error like this function doesn't exist there (attemt to call method 'TestFunction' (a nil value)). I wanted my RPG related functions to be imported into player script and NPC script and be able to access their variables through these RPG functions. For example: function Script:IncreaseSkill(skill, progress) self.skills[skill]=self.skills[skill]+progress if self.skills[skill]>100 then self.skills[skill]=100 end end I noticed that default scripts like ReleaseTableObjects.lua use global functions and only variables passed to these functions. Do I have to do the same? function IncreaseSkill(character, skill, progress) character.skills[skill]=character.skills[skill]+progress if character.skills[skill]>100 then character.skills[skill]=100 end end
  4. I've managed to get a Buffer (and Texture) filled with the current screen. I want to write it to a file, so my game will have a builtin screenshot feature. Leadwerks 2 apparently had a function SaveBuffer which would do exactly what I want, but as far as I can tell it doesn't exist or has been renamed to something else. So, before I try to manually write the bytes to a file, does anyone know if there is a current function for writing a buffer to an image file? (Or maybe there is complete function for taking a screenshot that I don't know about?) EDIT: How do I even get individual values out of a buffer?
  5. I've gotten render to texture working using this code http://leadwerks.wikidot.com/wiki:render-to-texture-security-cam but the Buffer functions are nowhere to be found in the current documentation. Unless I missed it, in which case please point it out Buffer isn't even highlighted in the script editor. I wasn't sure whether to post this in Bug Reports as it's not to do with the program itself...
  6. Taking the risk that this is another derpy bug report on my part because today is the day I miss obvious things. After a fellow forumite has kindly pointed out to me how to get the mousewheel with the z axis of Window::GetMousePosition() I tried to do just that and I'm just not seeing a value in the z component other than 0. To make sure the fast update doesn't simply always reset my text output I made sure to only capture values other than 0. if self.window:GetMousePosition().z ~= 0 then mwheel = self.window:GetMousePosition().z end self.context:DrawText("Mouse Wheel axis: " ..mwheel,2,14) Directly below the FPS counter in App.lua. I defined mwheel in App:Start() as 0.1, turns out it never changes, ergo the z axis is never not 0. This works for x and y without problems but z is always 0 so I'm fairly certain this is not being an idiot again.
  7. Forgive me if this is a silly question, but my previous experience with collision normals is as follows: collision on X should return Vec3(1,0,0) collision on -X should return Vec3(-1,0,0) collision on Y should return Vec3(0,1,0) collision on -Y should return Vec3(0,-1,0) collision on Z should return Vec3(0,0,1) collision on -Z should return Vec3(0,0,-1) Leadwerks pickinfo.normal returns a fraction depending on where on a face the collision occurs. Is pickinfo.face the "normal" function I'm used to, and maybe pickinfo.normal is describing the hit point? If this is the case, how do you use pickinfo.face, I couldn't find much documentation on it? Thanks!
  8. The title says it all. It seems like I would have to iterate through all valid keys/mouse buttons if I just wanted to know what was just pressed/what is held down without having any expectation of what should be pressed/down. I just wanted to find out how Leadwerks deals with keys not found on a US keyboard like (Ä, Ö, Ü) and mice with more than three buttons. I couldn't find anything that would just get an input event and tell me what it is. This would also be very useful in dealing with options menus for key rebinding though this is still doable with iterating through all valid keys it just seems simpler and more powerful to just get the input event.
  9. as per: http://www.leadwerks.com/werkspace/topic/10573-lua-dynamic-libraries-not-enabled/ (I've request the topic moved or merged with this but I've no idea how to do that ) Seems LUA_USE_LINUX and/or LUA_USE_DLOPEN needs to be defined to enable dynamic library loading. I've provided a simple library to test with in the original thread.
  10. I get "Lua Error: error loading module 'plugin/libLua-test' from file './plugin/libLua-test.so':|dynamic libraries not enabled; check your Lua installation" When I try to load my own library. This thread http://www.leadwerks.com/werkspace/topic/10566-require/page__hl__require suggests that turning off sandbox will do the trick - I've tried it both in the LE editor and in c++ neither makes any difference. Since he made it work I'm thinking this could be the linux version having different lua permissions? Or is removing the sandbox check mark and doing Interpreter::sandboxmode=false; in App::Start() before loading the map not enough to turn off sandbox?
  11. NewPalette

    require

    I'm just starting out with scripting in Leadwerks, having had a fair bit of experience with Love2d, and I'm having trouble with some standard Lua functions that I think should be working. In particular, I'm having trouble loading modules using the require function. I see people using the require function in examples, but when I try it I get "attempt to call global 'require' (a nil value)". It's as though the Lua standard libraries aren't loaded. Is there something I'm missing? Thank you, ye more-experienced-than-me, for any help.
  12. I'm familiarizing myself with Leadwerks and so I have a simple test map that lets me place block prefabs like Minecraft. How can I retrieve the name from a pickinfo.entity? I tried the following, but it throws an error in Print in the window:MouseDown(1) check: (argument #3 is 'string'; '[no object]' expected.) function Script:UpdateWorld() if block == nil then block = Prefab:Load("Prefabs/CM/Block.pfb") block:SetKeyValue("name","Block") block:SetCollisionType(Collision.Prop) end local pickinfo = PickInfo() local mousePos = window:GetMousePosition() if (self.player.script.camera:Pick(mousePos.x, mousePos.y, pickinfo, pickradius, true)) then block:SetPosition(Vec3(math.floor(pickinfo.position.x), math.floor(pickinfo.position.y), math.floor(pickinfo.position.z)) + Vec3(pickinfo.normal.x, pickinfo.normal.y/2, pickinfo.normal.z)) end if window:MouseDown(2) then -- Place the block block = nil end if window:MouseDown(1) then -- Delete the block if pickinfo ~= nil then if pickinfo.entity ~= nil then System:Print(pickinfo.entity:GetKeyValue("name")) end --if pickinfo.entity:GetKeyValue("Name") == "Block" then -- pickinfo.entity:Release() --end end end end The other issue I'm having is that the placed prefabs have no physics collision. Thanks, Mike
  13. How would I go about setting up a perpetually rotating hinge joint? Once its reaches the SetAngle value, it will stop and I have no clue how to cleanly reset it without interrupting the process. The dirty way is to use GetAngle to capture the value just as it nears the SteAngle value and add a ton more to the SetAngle value and just add some more on top but that will break eventually as the numerical value reaches the maximum for floats. Which might take a ton of time but I truly hate conceptually broken code. Anyone got any ideas? Script.pin = Vec3(0,0,1) --Vec3 "Hinge Pin" Script.limitsenabled=false--bool "Enable limits" Script.limits = Vec2(-45,45) --Vec2 "Limits" Script.parent= nil --entity "Parent entity" function Script:Start() startrotation = self.entity:GetRotation() local pos = self.entity:GetPosition() local parent_pos = self.parent:GetPosition() local abs_pos = pos + parent_pos self.joint = Joint:Hinge(abs_pos.x, abs_pos.y, abs_pos.z, self.pin.x, self.pin.y, self.pin.z, self.entity, self.parent) if self.limitsenabled then self.joint:EnableLimits() end self.joint:SetAngle(1080) self.joint:EnableMotor() self.joint:SetMotorSpeed(360) self.joint:SetLimits(self.limits.x,self.limits.y) end function Script:UpdateWorld() --feed me! end
  14. I was trying to use Math:DeltaAngle but it doesn't seem to exist. I guess it is a C++ function that hasn't been exposed to Lua. I'm using this as a temporary fix and it seems to do the job: function Math:DeltaAngle(a,B) local d = b-a d = d + (( (d>180) and -360 ) or ( (d<-180) and 360) or 0) return d end
  15. I tried to do: local DateRan = os.date("%Y.%m.%d.%H.%M.%S") but got attempt to index global 'os' (a nil value) I did a search and couldn't see an obvious alternative.
  16. Quick question, what is the execution order of Lua scripts? For example, if I have a scene with 3 entities with Lua scripts, is the Lua script of the entity that is listed first always called first? I apologize if this is a repeated question since this sounds pretty basic, I tried searching but I couldn't find anything
  17. When using the lua script to load a prefab made from csg's the collision does not load.
  18. I have a model of a sphere with a collision mesh imported into Leadwerks and I wanted to control how 'bouncy' it was. Did a google search and came across the functions SetElasticity and SetSoftness (seems like they were called SetBodyElasticity and SetBodySoftness in older versions). The current docs don't mention these functions, or at least not on Entity, and when I try to call them they obviously don't exist. Does anyone know if they've been renamed, not available to Lua, removed for some reason? Just a few things I found: http://www.leadwerks.com/werkspace/topic/2546-balls/ (This has a Lua script that calls SetElasticity which makes me think it did exist at some point) http://www.leadwerks.com/werkspace/page/Documentation/le2/_/command-reference/bodies/setbodyelasticity-r58 (Old docs) http://www.leadwerks.com/werkspace/topic/4683-problem-with-collision-callback/ (C++ but calls SetElasticity)
  19. Based on this forum post where an error was occurring during switching of maps: http://www.leadwerks.com/werkspace/topic/10459-load-map-error/#entry76909 It appears that using Release() on a sound that has been played will cause the OpenAl error. If you release the sound before being played, then no issues. example script to show the problem: function App:Start() self.window=Window:Create("Sound Bug Example",0,0,200,150,Window.Titlebar+Window.Center) self.context=Context:Create(self.window) self.world=World:Create() self.camera = Camera:Create() --import "Scripts/Functions/ReleaseTableObjects.lua" sound = {} sound[1] = Sound:Load("Sound/Footsteps/Concrete/step1.wav") sound[2] = Sound:Load("Sound/Footsteps/Concrete/step2.wav") return true end function App:Loop() if self.window:Closed() or self.window:KeyDown(Key.Escape) then return false end if self.window:KeyHit(Key.Space) then local r = math.random(1,2) if sound~=nil then if sound[r]~=nil then sound[r]:Play() end end end if self.window:KeyHit(Key.Up) then if sound~=nil then --ReleaseTableObjects(sound) sound[1]:Release() sound[2]:Release() sound = nil end end Time:Update() self.world:Update() self.world:Render() self.context:Sync() return true end If you press the Up arrow key prior to playing the sounds then there are no issues. If you hit the Space key and play a sound then try to release the sound it will cause the error. Since the fpsplayer script uses the 'ReleasetableObjects' function, it causes this same error when switching maps and the player has been released.
  20. I just tried using Math:Lerp for the first time and get the error: attempt to call method 'Lerp' (a nil value) This is how I am calling it, I have also tried Math.Lerp and just Lerp, they don't work either. local R = Math:Lerp(self.DayAmbient.x,self.NightAmbient.x,Intense) As as a test I did I for k,v in pairs(Math) do print(k,v) end and I couldn't see Lerp anywhere in the output I understand how Lerp works and can write the function myself to get around this, I just didn't know if the documentation is wrong or I am having some kind of bug or what.
  21. A post here about theora made me remember the previous LE2.31 implementation done by community member Niosop, who graciously provided a route for us to put *.ogg videos into LE via entity scripts. After updating his scripts to LE3.2 Indie scripts, I was able to get it working. I had planned on posting it via the workshop but I had a number of issues with it. One of the issues was that I couldn't get it to expose the script variables in the properties dialog when you attached the needed workshop script - so no easy way to select the video you wanted to play. In any case until that is sorted, here are the updated LETheora scripts with the example tv model that was created by our dear late community member . LETheora.zip The script is set up to allow you to pick an *.ogg video via the properties dialog after you attach the 'video_entity.lua' script to the mesh you want to view it on. In the case of the 'Old-TV' model, you would attach the script to the child mesh named 'Screen', then pick the *.ogg file you want to play.
  22. As the title says, If you make a csg prefab and re-texture it using the drag and drop method it will appear correct in the editor. (NOTE: The warning about changing from and insanced prefab DOES NOT appear). If you change the texture through the appearance tab it will change the texture ingame and show the insance warning dialog
  23. I'm trying to make a Level of detail system, and i found that I can not hide children from a parent. I would like to suggest the ability to hide a child Ie: child:Hide() This would hide the child and leave the childs' children with the same properties (i hide a child and it's children is still visible.). Also the ability to hide all of a childs children ie: child:Hide(True). This would hide a child and all it's children, but leave its' parents alone. My experiments with children Attach this to the parent: function Script:Start() self.entity:Hide() rotation = Vec3(0,0,45) print(self.entity:CountChildren()) local child = self.entity:GetChild(0) print(child:CountChildren()) print(child:GetPosition():ToString()) local child1 = child:GetChild(0) print(child1:CountChildren()) print(child1:GetPosition():ToString()) child1:SetRotation(rotation) -- to check if we are actually manipulating the child of a child child1:Hide() -- the rotated csg should diassapear end Results:
  24. Entity:GetCulled() appears to always return false. Lua example code: http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/entity/entitygetculled-r768 On a related note, SetOcclusionCullingMode() in the documents is listed as SetOcclusionMode. Also, in the script editor, SetOcclusionMode is highlighted but causes an error, whereas SetOcclusionCullingMode() is not highlighted and appears to work.
  25. I have been reading a lot about Lua and specifically the garbage collector recently and learned a few things. Such as - source- http://www.lua.org/manual/5.1/manual.html I have been testing my game for memory issues for weeks now and I am starting to think that the garbage collector just isn't fast enough to keep up with the amount of things I have going on. I noticed that since my memory usage rises to quick that the collector waits for my total memory to double before starting the next cycle and things start to get out of hand from there. I know that in most cases the garbage collector should be able to handle by itself but in my case it is not. I do not have any memory leaks in my code. I know this because if I run the garbage collector every frame my memory usage stays consistent. So could it be a better option to control the Lua Garbage Collector manually in my case? Edit ---- I have tested using collectgarbage('setpause',100) in my App Start() function. My game lasted about 2 hours longer than usual!! I normally test my games memory usage by going into release mode and standing completely still until my game crashes(It used to crash after about an hour); this time, well after I reached my normal 'crash point' I started running around doing crazy things to see if I would run out of memory but my game crashed due to an unknown error (I wasn't in debug mode) which I believe to be an issue in my script(not memory related)!!! I found multiple bugs I haven't noticed in my game before as well which I will fix and then I will test this more thoroughly. Also when tested in debug mode I noticed that my memory usage stayed consistent when before it used to constantly increase!
×
×
  • Create New...