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
  • Road & Traffic infrastructure [Vehicle based path following]
  • Usefull Scripts & Components
  • Thirsty Panther

Forums

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

Categories

  • 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. Hello every one ! Today i wanted to add c++ code to object but looks to accept only lua script ?‍♂️ It is possible to add c++ into this box Or we just use c++ into app.cpp (add class but every thing is connected to the app file) ?
  2. The Leadwerks 5 API uses C++11 smart pointers for all complex objects the user interacts with. This design replaces the manual reference counting in Leadwerks 4 so that there is no Release() or AddRef() method anymore. To delete an object you just set all variables that reference that object to nullptr: auto model = CreateBox(); model = nullptr; //poof! In Lua this works the same way, with some caveats: local window = CreateWindow() local context = CreateContext(window) local world = CreateWorld() local camera = CreateCamera(world) camera:SetPosition(0,0,-5) local model = CreateBox() while true do if window:KeyHit(KEY_SPACE) then model = nil end world:Render() end In the above example you would expect the box to disappear immediately, right? But it doesn't actually work that way. Lua uses garbage collection, and unless you are constantly calling the garbage collector each frame the model will not be immediately collected. One way to fix this is to manually call the garbage collector immediately after setting a variable to nil: if window:KeyHit(KEY_SPACE) then model = nil collectgarbage() end However, this is not something I recommend doing. Instead, a change in the way we think about these things is needed. If we hide an entity and then set our variable to nil we can just defer the garbage collection until enough memory is accrued to trigger it: if window:KeyHit(KEY_SPACE) then model:Hide()-- out of sight, out of mind model = nil end I am presently investigating the sol2 library for exposing the C++ API to Lua. Exposing a new class to Lua is pretty straightforward: lua.new_usertype<World>("World", "Render", &World::Render, "Update", &World::Update); lua.set_function("CreateWorld",CreateWorld); However, there are some issues like downcasting shared pointers. Currently, this code will not work with sol2: local a = CreateBox() local b = CreateBox() a:SetParent(b)-- Entity:SetParent() expects an Entity, not a Model, even though the Model class is derived from Entity There is also no support for default argument values like the last argument has in this function: Entity::SetPosition(const float x,const float y,const float z,const bool global=false) This can be accomplished with overloads, but it would require A LOT of extra function definitions to mimic all the default arguments we use in Leadwerks. I am talking to the developer now about these issues and we'll see what happens.
  3. When considering the script system in Leadwerks 5, I looked at alternatives including Squirrel, which is used by Valve in many games, but these gave me a deeper appreciation for the simplicity of Lua. There are only a handful of rules you need to learn to use the language, it’s fun to use, yet somehow it does everything you could ever need. These were three big issues I had to solve. First, the Leadwerks 5 API makes extensive use of smart pointers, which our binding library tolua++ does not support. Second, I wanted better auto completion and a better user experience in the IDE in general. Third, if an external IDE is going to be used it needs to be able to interface with the Leadwerks debugging system. To support smart pointers, I found a new library called sol2 that does everything we need. @Rick and I discussed the idea at great length and I am happy to say we’ve come up with a design that is simple to use and quite a bit easier than Leadwerks 4.x even. The binding code is nowhere near done but at this point I can see that everything will work. @AggrorJorn suggested using Visual Studio Code as our official script IDE in Leadwerks 5, and after investigating I think it’s a great idea. The auto completion is quite good and the IDE feels more natural then anything I could come up with using a custom text editor made with Scintilla. In fact eliminating the built-in script editor in Leadwerks 5 relieves me of a lot of uncertainty and potential issues when this is written. Finally, VS Code has support for custom debuggers. I wrote an example command line debugger for Leadwerks and I will use this to show another programmer how to interface with Leadwerks. (I don’t plan on writing the debugger myself.) With your feedback and ideas are shaping up to make Leadwerks 5 a huge leap forward over our previous designs. The improved simplicity of the new script system is a big cognitive relief. Having fewer things to worry about makes life better in a subtle but definite way. There’s something else that consumes a lot of mental attention. Social media and the internet have grown and changed over the years and become more efficient at consuming our attention. (Many features of this site are designed the same way.) The scary thing is that normal non-technical people seem to be more vulnerable than nerds. We’ll fire up the Witcher and play for an hour, but regular people are checking their phones 24/7 for feedback and validation. It’s much much worse than any accusation we got as kids of being “Nintendo zombies” because we spent an afternoon playing games instead of staring passively at broadcast TV. People who play games generally don’t care about posting photographs of their food or collecting followers. Somewhere along the line the internet went from being a weird thing on your computer to the collective consciousness of humanity. Reality is online and the physical world around us is just a mirage, one possible instance of a million possible individual experiences. Maybe it was around the time they started using AI to optimize clickbait that things got out of hand. Although my career and the way I live my life are only possible through the internet, I am old enough to remember life before the web, and in many ways it was better. Things were more focused. Even the early web before clickbait ads and online echo chambers was pretty nice. You could go to a record store and hang out talking to people about new music. Printed paper magazines were a thing. I already removed the link to our Google+ page in the website footer and no one noticed. I think about deleting our Facebook and twitter accounts, or at least not linking to them on our site. Why must every website pay homage to these monopolies? What are they doing for me, besides a limited flow of hits that pale in comparison to what my own email list brings in? I have written about this before but now that it is fashionable to criticize social media I might act on it. I don’t know, we’ll see. Please like, share, and retweet.
  4. Hi Leadwerkers :), I am wondering for quiet a while now, if and how the two things, I will explain in a second, are possible. First can I grab the "self" value of an function caller WITHOUT using arguments? I would expect this to work with the lua debug.getinfo() functionality? Maybe I better explain it with pseudo code: --Script 1: function Script:Test() Script2:CallingThis() end --Script 2: function Script:CallingThis() --get self of caller end Btw I have no idea how you offically call a "caller" maybe its calle? I dont know Second how to grab an arguments root variable. What I am already aware of is accessing variables like this self["myVariable"] so I could send self as argument 1 and "myVariable" as string in argument 2, but I am looking for a way to prevent this to optimize the code and lower the error rate. Again some pseudo code: --Script 1: Script.myVariable = 10 function Script:Test() Script2:CallingWithArgument(self.myVariable) end --Script 2: function Script:CallingThis(argument) --if I do anything with the variable argument here it only changes the local "argument" variable of course --this is stupid but I guess it will explain what I mean: local rootVariable = argument:GetRoot() rootVariable = 20 --> myVariable is changed to 20 within the Script 1 end You would do me a great favor if you would give me some input on this. I would be able to improve my code even more Thanks in advance for answering and have a nice day
  5. I have been working on a menubar widget and it came out pretty nicely. I thought i would release it either for people to have an example of what would be possible with the widget's flexibility or just for people to use it. For now it only works in C++ since it makes use of CallFunction(). MenubarElement.lua !! Make sure when you create the widget you create it last so it will render on top !! It allows horizontal rules and submenus. How to use: (C++) Create the widget and fill the menu float scale = gui->GetScale(); mnuBarItem = Widget::Create("Name", 2 * scale, 2 * scale, 60 * scale, 26 * scale, gui->GetBase(), "Scripts/GUI/MenubarElement.lua"); mnuBarItem->SetObject("backgroundcolor", new Vec4(0.7, 0.7, 0.7, 1.0)); mnuBarItem->AddItem("Temp0"); mnuBarItem->AddItem("Temp1"); mnuBarItem->AddItem("@-");//create a horizontal rule(menu seperator) mnuBarItem->AddItem("&Submenu");//this will hold the submenu created next //create a submenu from the last added item in the list mnuBarItem->CallFunction("C_CreateSubMenuFromLastItem"); mnuBarItem->CallFunction("C_AddItemToLastSubMenu", "Sub0_A"); mnuBarItem->CallFunction("C_AddItemToLastSubMenu", "Sub0_B"); mnuBarItem->CallFunction("C_AddItemToLastSubMenu", "Sub0_C"); // mnuAccount->AddItem("Temp2"); Catching widget events ProcessEvent(Event event) { if (event.id == Event::WidgetAction) { if (event.source == mnuBarItem) { if (event.data == 0) { // } else if (event.data == 1) { // } //(event.data == 2) horizontal rule // else if (event.data == 3)//submenu { int item = event.position.x;//submenu itemidx if (item == 0) { // } else if (item == 1) { // } else if (item == 2) { // } } else if (event.data == 4) { // } } } } Also it needs a call to update somewhere in your loop. Which is just used to update some delay timing. mnuBarItem->CallFunction("C_Update");
  6. Hi I am heavily working on my own user interface system at them moment and I wonder if there is a easy way to resize a loaded font. Example pseudo code for the functionality I am searching for: --Pseudo Code self.font = Font:Load("Arial", 6, Font.Smooth) --Load Font self.font:SetSize(10) --Change size during runtime I have a solution for this by preloading the font in all sizes and then change the rendered font. But this isn't memory efficient, or are Fonts so small that it makes no diffrence, either way it does create a lot of code Thanks for ideas in advance Markus from Phodex
  7. Hi Leadwerks fellows I think some of you may run into the same problem once in a while. The problem is the following. My AI wants to grab an item, but if, for whatever reason, this item gets released, while the AI is moving towards the item, the game just crashes, with no error. The same happens if I grab an item as a player and release the entity in my function, I fixed this by releasing the entity some time later in the loop. And yes I am testing my variables if they are nil, so I guess this could not be the problem... I think this has to do with the order how the loops are iterated through and I kind of understand the problem, but how to overcome this. Any safe solutions on how to release an entity, which is used somewhere else in the code? Thanks for reading so far and thanks for your help in advance! Markus from Phodex Games
  8. Hi , Currently I'm planning the next level for Behind Enemy Lines. Since the player has to do part of the level with a sniper rifle, a little preliminary work had to be done. So, Here's my way to tackle this topic with the Addon "FPS Weapon Pack": The tutorial from tipforeveryone was very helpful to me. You can find it here https://www.leadwerks.com/community/blogs/entry/1775-realistic-sniper-rifle-scope-in-lua/ i downloaded a Scope frome here :http://www.cadnav.com/3d-models/model-36647.html and put it as a child to the "vwep m4" and saved it as a prefab "vwep m4_sniper" it should be look like this Now you have to ajust the scope But for the scope script to work, an empty script must be inserted in the following places. Thanks to Macklebee for this hint! Now you have to change 2 scripts 1. fpsgun.lua 2. fpsplayer.lua 1. fpsgun.lua this script i saved under "FPSGun_Sniper.lua" then this video helps a lot :https://www.youtube.com/watch?time_continue=628&v=3OqwQSP-2FU thanks to BluHornet place this in your fpsgun_sniper.lua Script.offsetNor=Vec3(0,0,0) Script.offsetADS=Vec3(0,0,0)--Vec3 "Offset ADS" the next line put after the function Script:Start() self.offsetNor = self.offset self.hasZoom=true self.hasZoom=true (or false) has been inserted because the ironsight will be active in every weapon, but at Grenade or something else i did not want this. Since I have difficulty with the sway of the weapon and I have no solution for it currently, I commented under function Script: Draw () the following lines out: --self.swayspeed = Math:Curve(speed,self.swayspeed,20) --self.swayspeed = math.max(0.5,self.swayspeed) --self.amplitude = math.max(2,Math:Curve(speed,self.amplitude,20)) now its time to change the fpsplayer.lua 2. fpsplayer.lua this line put in at the beginning Script.ADSmode=false next place the following lines under the function Script:UpdateWorld() if self.weapons[self.currentweaponindex]~=nil and self.weapons[self.currentweaponindex].hasZoom then if self.ADSmode == false then self.camera:SetFOV(70) self.weapons[self.currentweaponindex ].offset = self.weapons[self.currentweaponindex ].offsetNor end if self.ADSmode == true then self.camera:SetFOV(20) self.weapons[self.currentweaponindex ].offset = self.weapons[self.currentweaponindex ].offsetADS end end and this also in this function (i put this after a lince called "--fire weapon" if window:MouseHit(2) then if self.weapons[self.currentweaponindex]~= nil then if self.ADSmode == false then self.ADSmode=true else self.ADSmode=false end if self.sound.pickupweapon~=nil then self.sound.pickupweapon:Play() end end end if you do not want the ironsight by jump, reload, or carry an item, then paste those lines at the right places self.ADSmode=false Since the original crosshair disturbs me in the ironsight, I have inserted "and self.ADSmode==false then" in the function Script:PostRender(context) it should looks like this if self.health>0 then if self.canUse==true and self.carryingEntity == nil then local pickUpX = math.floor((context:GetWidth() - self.image.hand:GetWidth()))/2 local pickUpY = math.floor((context:GetHeight() - self.image.hand:GetHeight()))/2 context:SetBlendMode(Blend.Alpha) context:DrawImage(self.image.hand, pickUpX, pickUpY) else if self.carryingEntity==nil then if self.weapons[self.currentweaponindex]~=nil then if self.image.crosshair and self.ADSmode==false then local crossHairX = math.floor((context:GetWidth() - self.image.crosshair:GetWidth()))/2 local crossHairY = math.floor((context:GetHeight() - self.image.crosshair:GetHeight()))/2 context:SetBlendMode(Blend.Alpha) context:DrawImage(self.image.crosshair, crossHairX, crossHairY) end end end end What follows now are the individual settings for each weapon to get an Ironsight. M4 Sniper: in the script: the sniper M4 looks now like this the m4 without scope in the script: it should look like this the shotgun in the script the shotgun look like this the pistol in the script the pistol look now like this So, that was my solution. But if you have even better settings, feel free to write in this blog. I hope that this blog helped a bit. Especially to save time to find the settings for the Ironsight. Have fun. Greetings burgelkat
  9. Hi, I was lately thinking about converting all my code from Lua to C++. Without knowing the size of my project, do you estaminate this is something taking very long, like more then 2 months, or is this something you could do within a week (I maybe have about 60-80 scripts) if you are working hard on it? Furthermore do you see any advantages in doing this (or better said is it worth the time) and I am not talking about speed, I much more mean the libraries that C++ offers and the more precice debugging. Thanks for your ideas and Merry Christmas.
  10. Hey, I am currently working on my AI, and I wonder what would be a good way, to make my NPC hold a specific distance to the player. In my case I need it for my AI behavior when it is using range weapons. I think a nice idea is to let the AI find a random point, which keeps a few conditions like, 10 units away from player, not outside of the map, not inside another object. But how to realise that. I would be very thankful if you can give me ideas, examples, descriptions etc.
  11. Hey guys, Besides the YouTube videos from the Leadwerks Channel, anyone know of some good LUA tutorials for Leadwerks? Any help appreciated! Thanks
  12. Restarted my networking framework yet again. This time I gave it a new name 'Hexe'. The old name was 'Overwatch'. It was named long before the Overwatch game came out. It was based off the Half-Life Overwatch. It oversaw the players, ai spawning, contained a secondary path-finding system, but had no networking as it was not native to the LUA side of Leadwerks. 'Hexe' is German for 'witch'. I don't really know why I chose the name but I have the feeling I will be able to put it to good use. Maybe I'll even mix in some Anglish into it. This restart occurred because the framework became too cumbersome. I had the entity synchronization working correctly, but it did not differentiate between player and an object in the world. That wasn't really that bad, what made messed it up was that a lobby system and teams were needed and there was no space to squeeze any other components into the mix. This rewrite will focus on the player/client and foremost. The components that are currently being written or are complete are: The server browser. This was a side project created out of necessity. I did not want to have to hard code the ip every time. Anytime I wanted to test multiple clients I had to change the code depending on which computer was running the server. PITFALL: Since Leadwerks does not expose the servers local ip address via code, you will need to get it manually from you computer, or use some creative workarounds Network Manager Hexe is split up between a server class and a client class. Both classes use a network manager class that can automatically handle hosting or connecting to a server. The network manager currently handles the handshake and the beginnings of the lobby system. When a client joins it initiates and handles the handshake between the server and client. It also raises events so the server or client can react accordingly if need be. After the handshake is completed, the network manager starts the lobby system The connection handshake. This is was saved from the last version. It makes sure the server and client are using the same protocol version. It will then register the client on the server and give it an incremental number (similar to the source engine) that allows the client state to be manipulated The Lobbying system: This is completely new. After the handshake is complete, it will send a command launching the lobbying system. The network manager only makes sure that a client is in the servers lobby and nothing more. The client and server manually handle the team creation and player switching on their own. Teams are not part of the network manager because it would require large amounts of rewrites depending on the type of game being created. When the lobbying system is complete the client input will be added. So far things are going well and maybe soon I wont be staring at console output for feedback.
  13. Seems that scripts cannot be attached to objects, while using Linux Mint 18.2. In the following video an attempt to attach the Spectator.lua script to a camera results in failure. This was also applied to a CSG and the TriggerChangeMap.lua, ending with the same results. https://youtu.be/ucTMUP8cZSg Edit: This morning the Leadwerks contents were verified through Steam and everything checked out. Also, started a new Leadwerks configuration directory, and project, ending with the same results. Scripts are not attachable. @Josh
  14. I've spent the last few days creating a simple self contained server browser. It will list all the servers of a specific game, allow the user to select a server and send a callback with the selected info. Requirements: The script from this topic placed in a file here: Scripts/Functions/eventqueuemanager.lua The Script: A simple example: It will create a server and open a server browser window. + Starts the move mode, click to exit it. X closes the window. import("Scripts/Functions/eventqueuemanager.lua") import("Scripts/serverbrowser.lua") local window = Window:Create() local context = Context:Create(window) local server = Server:Create() System:Print("Server1 publish::" .. tostring(server:Publish("Example Temp Test Server", "Testing population of server list from masterserver "))) server:Release() function test(ip,port,close) -- callback function System:Print("Callback") System:Print(ip) System:Print(tostring((close == true) and "close" or "")) end local serverbrowser = serverBrowser("Example Temp Test Server",context,0,0) -- create the serverbrowser serverbrowser:SetCallback(test) -- set callback -- do stuff while true do if window:Closed() then return end if window:KeyHit(Key.Escape) then return end Time:Update() context:SetColor(0,0,0,0) -- need to clear alpha!! or the gui will stay on screen!! context:Clear() EventQueueManager:Update() context:Sync() end serverbrowser:ClearCallback() -- remove callback serverbrowser:Release() -- release everything The server browser will obey the limits of your window. If any part of it is not on screen, it will be pushed back onto it. Edits: -2017-8-24: -Added the ability to directly connect to a ip and port. -Moved the code to put the window into a function and check on server browser creation. -2017-8-25: -Added the abilitiy to automatically resize to fit inside the bounds of the current context
  15. [I had text here but in the edit it dissapeared ] I found that there can only be one instance of the EventQueue. This meant that all the widget events need to be handled in a single location leading to possible complications in code and lowering the possibility to dynamic things. This script allows the developer to subscribe to an eventqueue manager and get their event safely, without usurping all gui controls. The script will automatically create an EventQueueManager variable that all other scripts can expect. To use it from a script not attached to an entity use: EventQueueManager:AddListener(Update) -- a simple function On a script attached to an entity or a lua based class use: EventQueueManager:AddListener(serverbrowser.Update) -- convert : into . Place the script into a file at: Scripts/Functions/eventqueuemanager.lua
  16. I am trying to have a generic gui class and I realized that there can be only 1 EventQueue. This means that all widgets must be managed from a single area. This means that I can't create a gui class that handles its own events without using some creative methods that have some serious edge cases. I would like to specify my own function/callback/eventqueue to call for each widget item. It would allow people to create safe, shareable scripts. I would like to create a widget and pass it a local eventqueue such as this one and handle all the events locally.
  17. I discovered that there can only be one eventqueue in leadwerks. I wanted local eventqueue instances, so I created a lua based version of EventQueue called EventQueueEx It is initialized as such: MyQueue = EventQueueEx:Create() It is used EXACTLY the same as the Leadwerks version.
  18. Hi I have a small problem. I think the pictures should explain it pretty good With font size of 12 see the terrible cut on the top?: With font size 20 it is a little bit better but somehow not as sharp as it should be; This is how I would expect it to look like: I am rendering the text with the default arial.ttf font, I render the following color Vec4(0, 0, 0, 255) and with blendmode Blend.Alpha. So whats the problem? I remember the text rendered sharper another time, but I dont know what I am doing wrong atm? Any suggestions?
  19. Hi Simple question, I cannot find a GetAnimation and GetAnimationFrame function in the API. I realised those functions in my own AnimationManager script manually, but since there is the "new" entity:PlayAnimation function how to get access to this functions? Any ideas or suggestion? EDIT: Would also be good to know how to get animation index by name and the other way around. Something like: self.entity:GetAnimationName(0) or self.entity:GetAnimationIndex("Idle"))
  20. Is there a way to get the Terrain height in Lua? I don't see any Terrain specific stuff on the API Reference page.
  21. Hi This is probably a noob question regarding the IDE. I had been able to open Lua scripts in the editor in the past; however, a source code window is not available. What am I missing? TIA J
  22. Is it possible to load external modules such as MQTT? If so, is there any documentation on how this can be done? I have a good amount of programming background but haven't done much scripting with Lua until recently. I've read something regarding Lua Rocks; however, the tool is looking for a lua.exe binary. Thanks!
  23. I wrote a script that processed all top level entities. When rearranging the scene hierarchy and running the game again WITHOUT hitting the map save button it gives the wrong result. It fixes itself when you explicitly click the map save button. Video: http://einlander.duckdns.org:8000/f/32c4297246924043960b/
  24. Welcome to the Sixth Monthly Script Challenge Each Month I will set a challenge for gifted Leadwerkers to solve. Once you have perfected your script post your map to this thread. At the end of the month I will go through all the entries and judge the winner. I will then place the winning map on the Workshop so others can learn from them. Rules. Entries must be your own work. Entries must be submitted before the end of the month ( June ). Any assets you use must be your own or Royalty free. The map that you submit can be used by others for commercial use. Have fun. June Challenge After asking for suggestions from the Leadwerks community . I've decided to use Slastraf idea of Flying Enemies. The enemy could be like a dragon that circles and swoops on the player to attack them causing damage. Or perhaps it could be a drone like enemy that tracks the player and shoots them as it gets within range. How you implement your script is up to you. Remember the winning script should not only solve the problem but should also have comprehensive comments within the script so that new users can learn from your script. Prize Damien Defranco and his company Vixeemo are now the proud sponsors of the Leadwerks community monthly script challenge. Vixeemo (http://vixeemo.com) is an all-in-one business solutions brand for your start-up or project needs. The winner will receive a free web & graphic design package provided by Vixeemo that includes a 3-page professional website design (Home, About, Contact), logo design and integration, banner/slider design, a blog section, and an additional gallery page to showcase images/video or projects. Vixeemo will work with the winner to fully customize everything to bring the vision to fruition. This prize is perfect for any Leadwerks user who wants to get their project or brand onto the internet. The winner will need to provide the domain ( TomsHardware Guide ), and Vixeemo will do the rest. This design package is valued at over $400 USD. This is a great reward for your hard work and a great way to give your game project that professional look to make it stand out from the crowd. If you have any ideas or thoughts on the Challenge please feel free to comment. I'm looking forward to your submissions. PS Josh could you kindly pin this thread please.
  25. Hi, I pretty often encounter the followning problem: I need something to be called before, or after the Start function of an script. My actual problem is that I have an NPC and his "Load" function (I wrote by myself) is called before the script actually is initiated. The problem is, in the load function some values are set (like npc health) but then the script gets initiated and the script uses the default script value of 100% health and the loading does not work. A workaround I found is to use the first step of the update function but I find this not very smart. Here an example: function Script:UpdateWorld() if self.doOnce ~= true then --do something here self.doOnce = true end end Any ideas how to solve this more elegant? Would be really glad if we could gather some ideas Markus
×
×
  • Create New...