Is there a .jar version of LuaCraft to run on OS X or Ubuntu? I have no problem running it on Windoes, but curious.
Can anyone help me please, I'm still having the problem where no items come out of a broken block, sand/gravel don't fall and I can't shoot arrows.
Are there any hooks that could prevent this?
[QUOTE=jrj996;36742601]Can anyone help me please, I'm still having the problem where no items come out of a broken block, sand/gravel don't fall and I can't shoot arrows.
Are there any hooks that could prevent this?[/QUOTE]
entity.spawn
[lua]
chatcommand.Add("file",function(pl)
local ftgt = file.Find("/Protected Zones/*.property")
print(#ftgt)
end)
[/lua]
This doesn't appear to be working, I'm sure I'm making a dumb mistake...
[lua]
chatcommand.Add("file",function(pl)
local ftgt = json.Decode(file.Read("data/Protected Zones/*.property"))
print(#ftgt)
end)[/lua]
That's assuming you're trying to read the files contents which are a Json and then print the size of the returned table data. I changed the root to data/ too so be aware of that.
[code]
[WARNING] Lua Server\Protected Zones\*.property (The filename, directory name, or volume label syntax is incorrect)
lua/autorun/ZSMP_Cmd.lua:129: vm error: java.lang.StringIndexOutOfBoundsException: String index out of range: 0
[/code]
I have no idea what that means... :v
[QUOTE=jrj996;36764011][code]
[WARNING] Lua Server\Protected Zones\*.property (The filename, directory name, or volume label syntax is incorrect)
lua/autorun/ZSMP_Cmd.lua:129: vm error: java.lang.StringIndexOutOfBoundsException: String index out of range: 0
[/code]
I have no idea what that means... :v[/QUOTE]
Now that I'm on a real computer I'll try to help more. First off, what are you trying to do exactly? Why do you have a * as the filename, and .property as the extension? I'd change .property to .txt and see if that works for you first.
Here is a better debug version of the function too:
[lua]
chatcommand.Add("file",function(pl)
local filename = "data/Protected Zones/file.txt"
if !file.Exists(filename) then print("DEBUG: No file by that name exists in that directory") return end
local data = json.Decode(file.Read(filename))
table.Print(data)
end)
[/lua]
I'm trying to look through every file that's a property inside of the protected zone folder to have it return coordinates that are supposed to be protected and as you know to do that I need to retrieve the files
[QUOTE=jrj996;36765984]I'm trying to look through every file that's a property inside of the protected zone folder to have it return coordinates that are supposed to be protected and as you know to do that I need to retrieve the files[/QUOTE]
Alright. I do pretty much the same thing in my gamemode... here is how you can loop through files and decode them from JSON:
For this example, going to assume that you have a directoy of data/protectedzones, and they are txt files
[lua]
local files = file.Find("data/protectedzones/") -- Generates a table with the value being each file's full filename
local data
for _, filename in ipairs(files) do -- loop through the list of files
data = json.Decode(file.Read(filename)) -- Just turning the information from reading the file back into a LUA table
table.Print(data) -- This will just spit out what the newly re-assembled table looks like
end
[/lua]
Currently you can't use filename masks. So you can't do "blah/*.lua", just use say "blah/"
[QUOTE=TheBigS;36766600]Alright. I do pretty much the same thing in my gamemode... here is how you can loop through files and decode them from JSON:
For this example, going to assume that you have a directoy of data/protectedzones, and they are txt files
[lua]
local files = file.Find("data/protectedzones/") -- Generates a table with the value being each file's full filename
local data
for _, filename in ipairs(files) do -- loop through the list of files
data = json.Decode(file.Read(filename)) -- Just turning the information from reading the file back into a LUA table
table.Print(data) -- This will just spit out what the newly re-assembled table looks like
end
[/lua][/QUOTE]
Still getting the same errors unfortunately :/
[QUOTE=jrj996;36798723]Still getting the same errors unfortunately :/[/QUOTE]
Hmm, alright then.
For the purposes of just testing, did you create a folder in your base LuaServer folder called "data", and then create a folder inside that called "protectedzones", and then inside of that place your file(s)? Only reason I say that is because I noticed in your last few code examples you had your "Protected Zones" directory straight off of the base LuaCraft directory and I just want to rule that out as an issue for troubleshooting purposes.
Also, maybe we should take a look at your file [i]saving[/i] code as maybe that could be the culprit?
[QUOTE=TheBigS;36799724]Hmm, alright then.
For the purposes of just testing, did you create a folder in your base LuaServer folder called "data", and then create a folder inside that called "protectedzones", and then inside of that place your file(s)? Only reason I say that is because I noticed in your last few code examples you had your "Protected Zones" directory straight off of the base LuaCraft directory and I just want to rule that out as an issue for troubleshooting purposes.
Also, maybe we should take a look at your file [i]saving[/i] code as maybe that could be the culprit?[/QUOTE]
Everything I've coded so far is just for testing purposes so I can get the feel for retrieving files this way but here:
[lua]
chatcommand.Add("safe",function(pl,cmd,args)
if args[1] then
if args[3] then
local sf = PropertyManager("data/Protected Zones/"..table.concat(args," ",1,2)..".property")
sf:SetValue("Name",table.concat(args," ",1,2))
sf:SetValue("X",pl:GetPos().x)
sf:SetValue("Y",pl:GetPos().y)
sf:SetValue("Z",pl:GetPos().z)
sf:SetValue("Radius",args[3])
else
pl:Msg(color.Red,"A radius needs to be defined.")
end
else
pl:Msg(color.Red,"The safe zone needs a name.")
end
end)
[/lua]
I changed the directory before to troubleshoot but unfortunately it didn't change the outcome
Don't prepend it with data/
[QUOTE=Map in a box;36804954]Don't prepend it with data/[/QUOTE]
I'm still extremely confused... :v:
Is it possible to code a server to use surface.draw to draw things to a client?
You know, this stuff?
[quote][img]http://img.luastoned.com/dev_3D_moar.png[/img][/quote]
I'd figure that would be impossible because anybody running regular Minecraft probably wouldn't have the functionality.
There's no glon functions? D: How am I supposed to encode tables into an SQL's table?
Wait, I see the json.encode. I'm just having problems with my SQL though. It doesn't seem to like to return or set things, any help?
[lua]
if iSQL then
print("Exists")
iSQL:Update("CREATE TABLE IF NOT EXISTS mc_db_player (name varchar(20), data text, skills text)")
else
print("lolnope")
end
local que = iSQL:Query("SELECT * FROM mc_db_player")
hook.Add("player.connect","runsql",function(pl)
for k,v in pairs(que) do
if v.username then
pl.Data = {}
pl.Skills = {}
local new = iSQL:CreateQuery("UPDATE mc_db_player SET (?,?,?)")
new:SetString(1,pl:Name())
new:SetString(2,json.Encode(pl.Data))
new:SetString(3,json.Encode(pl.Skills))
new:Update()
else
print("nerp")
end
end
PrintTable(que)
end)
chatcommand.Add("test",function(pl,c,args)
iSQL:Update("DROP TABLE mc_db_player")
end)
[/lua]
[QUOTE=jrj996;36971855]There's no glon functions? D: How am I supposed to encode tables into an SQL's table?
Wait, I see the json.encode. I'm just having problems with my SQL though. It doesn't seem to like to return or set things, any help?
[lua]
if iSQL then
print("Exists")
iSQL:Update("CREATE TABLE IF NOT EXISTS mc_db_player (name varchar(20), data text, skills text)")
else
print("lolnope")
end
local que = iSQL:Query("SELECT * FROM mc_db_player")
hook.Add("player.connect","runsql",function(pl)
for k,v in pairs(que) do
if v.username then
pl.Data = {}
pl.Skills = {}
local new = iSQL:CreateQuery("UPDATE mc_db_player SET (?,?,?)")
new:SetString(1,pl:Name())
new:SetString(2,json.Encode(pl.Data))
new:SetString(3,json.Encode(pl.Skills))
new:Update()
else
print("nerp")
end
end
PrintTable(que)
end)
chatcommand.Add("test",function(pl,c,args)
iSQL:Update("DROP TABLE mc_db_player")
end)
[/lua][/QUOTE]
SQL Queries are now threaded.
[QUOTE] iSQL:Query( "SELECT * FROM mc_db_playe", function( results )
table.Print( results )
end )[/QUOTE]
[QUOTE=iZeD_IV;37027218]SQL Queries are now threaded.[/QUOTE]
Awesome, just what we needed!
I'm glad this didn't die out.
I never die out....
I'm currently working on a Minigames Server in LuaCraft.
[url]http://www.kingsofminecraft.com/board/threads/server-preview-destinycraft-casino-fever.12858/[/url]
The currently WIP Sever runs on:
198.100.146.146:25576
I'm using my own Plugin Framework for this:
[url]http://forum.luacraft.com/index.php/topic,513.msg733.html#new[/url]
Because this helps me very much developing the server.
I've made almost all Basic Functions yet, currently working on an automatic Spleef System.
Some private plugins I'm using for this:
BanZ, CreeperBunDem(Creepers ignite entities around them instead of destroying blocks), EssentialZ (Most basic commands), FrettaZ (The plugin that's containing all the minigame functions), RodZ (Something like WorldEdit, but with some other features), RedZ (Additional Redstone Function (Wireless, etc.)/Bugged cause of a Block():Power() bug from LuaCraft)
I can't connect to yours or my server, is it because of the new update?
Think so, but if you use the newest LuaCraft Client you should definetely be able to join.
also am I doing this right? I'm not getting any messages or anything.
[lua]
hook.Add("player.connect","runsql",function(pl)
pl.Data = {}
pl.Skills = {}
iSQL:Query("SELECT * FROM player WHERE id='"..pl:Name().."'",function(results)
if results[1][2] && results[1][3] then
pl.Data = results[1][2]
pl.Skills = results[1][3]
print("Player has connected before.")
else
iSQL:Query("INSERT INTO player (id, data, skills) VALUES ('"..pl:Name().."','"..von.serialize(pl.Data).."','"..von.serialize(pl.Skills).."')")
print("Player has never connected, creating new file...")
end
end)
return true
end)
[/lua]
MySQL Workbench isn't showing any updates either...
[QUOTE=jrj996;37065686]also am I doing this right? I'm not getting any messages or anything.
[lua]
hook.Add("player.connect","runsql",function(pl)
pl.Data = {}
pl.Skills = {}
iSQL:Query("SELECT * FROM player WHERE id='"..pl:Name().."'",function(results)
if results[1][2] && results[1][3] then
pl.Data = results[1][2]
pl.Skills = results[1][3]
print("Player has connected before.")
else
iSQL:Query("INSERT INTO player (id, data, skills) VALUES ('"..pl:Name().."','"..von.serialize(pl.Data).."','"..von.serialize(pl.Skills).."')")
print("Player has never connected, creating new file...")
end
end)
return true
end)
[/lua]
MySQL Workbench isn't showing any updates either...[/QUOTE]
Not sure, but try CreateQuery instead of Query when you want to INSERT, DELETE or UPDATE a table.
EDIT:
timer.Add("Jump", 1, 13337, function() for k,v in pairs(ent.GetAll()) do v:AddVelocity(Vector(0,0,0.75)) end)
results in: [url]http://www.youtube.com/watch?v=a38MajYpeG8&list=UUQyOL_6Jweza4iZ_b-ytm7g&index=1&feature=plcp[/url]
:D
Is there any news about Luacraft 1.3.2?
They finally decided to look for more developers
[url]www.luacraft.com[/url]
Can someone update this? It had so much potential.
[url]http://www.minecraftforum.net/topic/1557041-145-forge-luaforge-write-forge-mods-in-lua/[/url]
Here's and alternative.
The project is on hiatus until we aren't as tired of minecraft. Might come back soon.
Awesome! this looks sick gonan try it out
Sorry, you need to Log In to post a reply to this thread.