- Joined
- Dec 28, 2014
- Messages
- 90
Hello!
I had this idea since Blizzard implemented Lua and the custom user-interface in Warcraft III. When I was testing my other projects (Perlin Noise, File IO, Network), I'm using player chat event and Lua's load function as an input, DisplayPlayerTextMessage/print for output, to debug my scripts during runtime. This method feels rigorous as you have to keep pressing the Enter key for the input and to open the Log to show the long outputs that is not visible in the in-game's display text.
As I studied Tasyen's Frame UI tutorials and used Lua's load function (along with pcall/xpcall for error handling), I manage to create a Lua console while Warcraft III is running:
The code for this is currently messy. The console window is still cannot be closed. I created a sandbox environment without the common.j and blizzard.j functions for this setup. You can set the environment to access stuff like CreateUnit, BlzFrameAbsPoint, etc. on runtime. The purpose of the sandbox test is to show you can create two or more different environments in the map. Like you can open Environment A by clicking a Footman and Environment B by clicking a Rifleman. The function "print" is written differently for this particular environment, it uses the "BlzFrameAddText" function to print the output to the text area. The native Lua "print" function in the global environment is not overwritten.
I'm think this kind of feature can be used for Sci-fi themed maps or make something really ridicilous like running an Operating System in Warcraft III similar to the Minecraft mods: Computercraft and Opencomputers.
What are your thoughts about this?
I had this idea since Blizzard implemented Lua and the custom user-interface in Warcraft III. When I was testing my other projects (Perlin Noise, File IO, Network), I'm using player chat event and Lua's load function as an input, DisplayPlayerTextMessage/print for output, to debug my scripts during runtime. This method feels rigorous as you have to keep pressing the Enter key for the input and to open the Log to show the long outputs that is not visible in the in-game's display text.
As I studied Tasyen's Frame UI tutorials and used Lua's load function (along with pcall/xpcall for error handling), I manage to create a Lua console while Warcraft III is running:
The code for this is currently messy. The console window is still cannot be closed. I created a sandbox environment without the common.j and blizzard.j functions for this setup. You can set the environment to access stuff like CreateUnit, BlzFrameAbsPoint, etc. on runtime. The purpose of the sandbox test is to show you can create two or more different environments in the map. Like you can open Environment A by clicking a Footman and Environment B by clicking a Rifleman. The function "print" is written differently for this particular environment, it uses the "BlzFrameAddText" function to print the output to the text area. The native Lua "print" function in the global environment is not overwritten.
I'm think this kind of feature can be used for Sci-fi themed maps or make something really ridicilous like running an Operating System in Warcraft III similar to the Minecraft mods: Computercraft and Opencomputers.
What are your thoughts about this?
Last edited: