• LuaServer
    467 replies, posted
Why not just easily create a LUA interpreter/plugin loader for Bukkit? Saves you most of the compatibility/bug patching and you'll only have to worry about your LUA interpreter, not the rest of the server. I could see many people including myself using this if it was integrated into Bukkit. Check out [url=http://forums.bukkit.org/threads/python-plugin-loader.21247/]this python plugin loader[/url] as example.
[QUOTE=Marlamin;31020318]Why not just easily create a LUA interpreter/plugin loader for Bukkit? Saves you most of the compatibility/bug patching and you'll only have to worry about your LUA interpreter, not the rest of the server. I could see many people including myself using this if it was integrated into Bukkit. Check out [URL="http://forums.bukkit.org/threads/python-plugin-loader.21247/"]this python plugin loader[/URL] as example.[/QUOTE] Well you see when I started this I wasnt looking for something easy. I wanted something that would prove to be a challenge and that would keep me interested in working on it. A plugin to an already existing program just didnt cut it. :)
[QUOTE=Marlamin;31020318]Why not just easily create a LUA interpreter/plugin loader for Bukkit? Saves you most of the compatibility/bug patching and you'll only have to worry about your LUA interpreter, not the rest of the server. I could see many people including myself using this if it was integrated into Bukkit. Check out [url=http://forums.bukkit.org/threads/python-plugin-loader.21247/]this python plugin loader[/url] as example.[/QUOTE] And bukkit sucks, why use bukkit when you can make your own bukkit? :l
Can you put up a tutorial on how to get scripts to work on 1.3.4? I keep getting "[WARNING] Failed to load script: init." in the console and I can't get any script to load.
[QUOTE=Saccn;31023295]Can you put up a tutorial on how to get scripts to work on 1.3.4? I keep getting "[WARNING] Failed to load script: init." in the console and I can't get any script to load.[/QUOTE] There is now a quick tutorial here: [URL]http://olympusgaming.org/wiki/index.php/QuickTutorial[/URL]
You look forward to adding any chest commands, like you did with signs and stuff?
What the hell, why are you reloading whole script on every call?
[QUOTE=Pecius;31024257]What the hell, why are you reloading whole script on every call?[/QUOTE] Mainly cause i havent changed that yet. When i did that the server only had support for one script at a time so it wasnt that big of a deal. Now that its got more than one script at a time ill be fixing that.
I love you, so much.
[QUOTE=Genesis999;31024293]Mainly cause i havent changed that yet. When i did that the server only had support for one script at a time so it wasnt that big of a deal. Now that its got more than one script at a time ill be fixing that.[/QUOTE] But what was the reason of that? Because this is just a waste of memory and processor usage.
[QUOTE=Pecius;31024589]But what was the reason of that? Because this is just a waste of memory and processor usage.[/QUOTE] Did you even read what he said?..
[QUOTE=jrj996;31025125]Did you even read what he said?..[/QUOTE] He didn't answer why he had to reload script file every time while calling the hook functions. It shouldn't be like this, because it forces interpreter and garbage collector to work at the same functions every time. Maybe he has a problem with Lua API, which we could help. So I asked once again to get a reason of that unusual method.
[QUOTE=jrj996;31023155]And bukkit sucks, why use bukkit when you can make your own bukkit? :l[/QUOTE] -snip, taken to PM-
New version is out 1.3.5 Scripts no longer automatically reload. Made a global variable named Server. OnScriptStart parameter is now not used so passes through a 0. Hooks, commands and other stuff now accessed through global ServerClass object named Server. Added Server:ReloadScript() Moved global function GetPlayerEntity to Server:GetPlayer() Moved global function GetMobEntity to Server:GetMob() Moved global function GetWorld to Server:GetWorld() Moved global function CreateTimer to Server:CreateTimer()
Can't wait to get home and test this out :D €dit: Your wiki has a problem :(
[QUOTE=The-Stone;31084872]Can't wait to get home and test this out :D €dit: Your wiki has a problem :([/QUOTE] Fixed it.
[QUOTE=Divran;30963541]... EDIT: Apparently there's no way to find files in a directory (like Gmod's file.FindInLua or file.Find), so short of forcing server owners to enter the file path of every mod they install into a text file, I can't finish this project. :( You'll probably finish support for multiple scripts before I can finish this anyway, so oh well. Project failed.[/QUOTE] [lua] function file.Find() fh = io.popen("dir") local dir = fh:read("*a") local tbl = string.Explode(dir, "\n") local files = {} for k, line in pairs(tbl) do if line:match("[%d%p]%s([%w%p]+)") then table.insert(files, line:match("[%d%p]%s([%w%p]+)")) end end table.remove(files, #files) table.remove(files, #files) return files end [/lua] [code] > table.Print(file.Find()) 1 = file.lua 2 = lua.exe 3 = lua5.1.dll 4 = math.lua 5 = string.lua 6 = table.lua [/code] Played a little with standard Lua today.. :P
SetMobSpawning(false) seems to be broken now. Instead of just disabling the monsters, it disables the friendly animals too.
[QUOTE=bootv2;31088454]friendly mobs are also mobs, so it's rather fixed than broken. but I agree that there should be a way of seperately enabling and disabling both friendly and hostile mobs. even better would be a way to set for every mob individually if they spawn and to be able to set their spawnrates.[/QUOTE] The code I wrote was supposed to be seperate for friendly and hostile mobs. Its the reason I have a SetMobSpawning and a SetAnimalSpawning. :P So I guess it was broken. :P
How am I supposed to get the position of the block I placed? I can only get the position of the block I was targeting at. My testing code: [lua]function OnPlayerPlaceBlock( Block ) local World = Server:GetWorld( 0 ) local blockx = Block:GetBlockX() local blocky = Block:GetBlockY() local blockz = Block:GetBlockZ() World:SetBlock( blockx, blocky, blockz, 35 ) end[/lua] Also, SetBlockId() seems to be broken. It sets the id of the block, but the block doesn't actually change.
Tell me please, why are you now creating Lua states for every script? [img]http://dl.dropbox.com/u/4848096/fp/eng99.gif[/img]
[quote]java.lang.UnsatisfiedLinkError: C:\Users\Azzy\Desktop\MC Server\luajava-1.1.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform[/quote] Its not working properly with 64-bit OS/Java [editline]14th July 2011[/editline] [QUOTE=AzzyMaster;31109535]Its not working properly with 64-bit OS/Java[/QUOTE] Also, will you add functions of changing redstone states and that? so we can make mods such as wireless redstone?
if by "variables" on the wiki you mean player stored variables then... YYYYYYYYYYYYYYYEEEEEEEEEEEEEEAAAAAAAAAAAHHHHHHHHHHHHHHHHHHHHHH.
Hey people! Theres a new version out 1.3.5.2 Quick changelist: Server changed to a table of functions rather than a javaobject allowing for some better lua stuff. Added Server:GetPlayers(names) returns a table of PlayerEntitys of the specified players. If the first name is "#all" returns all players. Otherwise it works like this Server:GetPlayers("Name1", Name2", ToInfinityAndBeyond) can take an infinite supply of string arguments. Commands now parse an infinite amount of arguments seperated by spaces. Only one state object rather than one per script. EDIT: Its back. *crosses fingers*
You should make "attempt to call a nil value" show the line too. It's really hard to find the problem when you have 300 lines of code. [editline]18th July 2011[/editline] How do I get this to work? This worked fine on the previous version. [lua] function OnPlayerConnect( Player ) PrintToChat( Player:GetUsername() .." has joined the game.", "#all", 14 ) end [/lua]
[QUOTE=Saccn;31188833]You should make "attempt to call a nil value" show the line too. It's really hard to find the problem when you have 300 lines of code. [editline]18th July 2011[/editline] How do I get this to work? This worked fine on the previous version. [lua] function OnPlayerConnect( Player ) PrintToChat( Player:GetUsername() .." has joined the game.", "#all", 14 ) end [/lua][/QUOTE] What is/isnt it doing?
The whole script breaks and the console shows "java.lang.NullPointerException".
[QUOTE=Genesis999;31188118]Hey people! Theres a new version out 1.3.5.2 Quick changelist: Server changed to a table of functions rather than a javaobject allowing for some better lua stuff. Added Server:GetPlayers(names) returns a table of PlayerEntitys of the specified players. If the first name is "#all" returns all players. Otherwise it works like this Server:GetPlayers("Name1", Name2", ToInfinityAndBeyond) can take an infinite supply of string arguments. Commands now parse an infinite amount of arguments seperated by spaces. Only one state object rather than one per script. EDIT: Its back. *crosses fingers*[/QUOTE] You forgot to put error handlers on script loading! Put them both for Java equivalents of lua_pcall and luaL_loadfile/lua_load.
[QUOTE=Saccn;31189044]The whole script breaks and the console shows "java.lang.NullPointerException".[/QUOTE] Can you show me the line that adds the player connect hook?
[lua] function OnScriptStart() Server.AddHook( "player.connect", "OnPlayerConnect" ) end[/lua]
Sorry, you need to Log In to post a reply to this thread.