Post your modding questions here
Re: Post your modding questions here
Thanks a lot so it works!
-
- Member
- Posts: 190
- Joined: Mon Jan 02, 2017 21:00
- GitHub: Sires0
- IRC: Sires
- In-game: Sires Sores Siri Seris or anything ppl call me
- Location: :noitacoL
Well, halp to delete metadata
Well I searched a bit in the minetest forum, used some advanced search thingy and Ctrl+F ed some pages of modding questions, and I really don't want to check 159 pages, so my question is: How to delete an specific metadata. Something like, the metadata is:
a = false
b = true
c = "sth"
d = 1
So, lets supposed I want to delete the 'd', is there other way to delete it without doing some stuff using to_table and from_table methods ?
a = false
b = true
c = "sth"
d = 1
So, lets supposed I want to delete the 'd', is there other way to delete it without doing some stuff using to_table and from_table methods ?
I don't have anything important to say.
Re: Well, halp to delete metadata
I think meta:set_string("d", nil) works.Sires wrote:Well I searched a bit in the minetest forum, used some advanced search thingy and Ctrl+F ed some pages of modding questions, and I really don't want to check 159 pages, so my question is: How to delete an specific metadata. Something like, the metadata is:
a = false
b = true
c = "sth"
d = 1
So, lets supposed I want to delete the 'd', is there other way to delete it without doing some stuff using to_table and from_table methods ?
-
- Member
- Posts: 190
- Joined: Mon Jan 02, 2017 21:00
- GitHub: Sires0
- IRC: Sires
- In-game: Sires Sores Siri Seris or anything ppl call me
- Location: :noitacoL
Re: Well, halp to delete metadata
Nope, I tested it, it just sets the data to nil, but the data key still exists in the metadataGerald wrote:I think meta:set_string("d", nil) works.Sires wrote:Well I searched a bit in the minetest forum, used some advanced search thingy and Ctrl+F ed some pages of modding questions, and I really don't want to check 159 pages, so my question is: How to delete an specific metadata. Something like, the metadata is:
a = false
b = true
c = "sth"
d = 1
So, lets supposed I want to delete the 'd', is there other way to delete it without doing some stuff using to_table and from_table methods ?
I don't have anything important to say.
Re: Well, halp to delete metadata
If I read the result of minetest.serialize(meta:to_table()) the key is gone.Sires wrote:Nope, I tested it, it just sets the data to nil, but the data key still exists in the metadataGerald wrote: I think meta:set_string("d", nil) works.
What is the problem of a dummy value anyway?
Re: Well, halp to delete metadata
I think a meta isn't properly table or isn't accessible by native Lua garbage collector.Gerald wrote:If I read the result of minetest.serialize(meta:to_table()) the key is gone.
What is the problem of a dummy value anyway?
I am a noob. still yet. Not so noob ) [vml] WIP and a little proof for fun PlantedTorch )))
MT Strike 78a36b468554d101e0be3b0d1f587a555f396452 Great! Somebody have found it )
"My english isn't well" I know. I'm sorry )
MT Strike 78a36b468554d101e0be3b0d1f587a555f396452 Great! Somebody have found it )
"My english isn't well" I know. I'm sorry )
-
- Member
- Posts: 190
- Joined: Mon Jan 02, 2017 21:00
- GitHub: Sires0
- IRC: Sires
- In-game: Sires Sores Siri Seris or anything ppl call me
- Location: :noitacoL
Re: Well, halp to delete metadata
Well btw this gave-me an idea, create an function using from_table that deletes every nil value there, I think this may workNyarg wrote:I think a meta isn't properly table or isn't accessible by native Lua garbage collector.Gerald wrote:If I read the result of minetest.serialize(meta:to_table()) the key is gone.
What is the problem of a dummy value anyway?
I don't have anything important to say.
- orwell
- Member
- Posts: 958
- Joined: Wed Jun 24, 2015 18:45
- GitHub: orwell96
- IRC: orwell96_mt
- In-game: orwell
- Location: Raxacoricofallapatorius
Re: Post your modding questions here
There's one thing you need to know about LUA: There is no difference between a variable being undefined and a variable being nil, it's simply the same. So there can't be any keys inside a table whose value is 'nil'.
AFAIK, the minetest meta treats the empty string ("") as symbol for "not defined", so accessing undefined meta keys will always give you "" and set_string(key, "") is equivalent to set_string(key, nil)
AFAIK, the minetest meta treats the empty string ("") as symbol for "not defined", so accessing undefined meta keys will always give you "" and set_string(key, "") is equivalent to set_string(key, nil)
- texmex
- Member
- Posts: 1753
- Joined: Mon Jul 11, 2016 21:08
- GitHub: tacotexmex
- In-game: tacotexmex
Re: Post your modding questions here
Hello fellow mese chasers. I want to integrate lua-matrix (the chat protocol) in a mod with the ultimate goal of Matrix.org bidirectional message sync, much like the IRC mod. This requires cjson however, which is binary. Is there some way around having to deal with binaries? Can they even be included in a mod?
- orwell
- Member
- Posts: 958
- Joined: Wed Jun 24, 2015 18:45
- GitHub: orwell96
- IRC: orwell96_mt
- In-game: orwell
- Location: Raxacoricofallapatorius
Re: Post your modding questions here
you don't need cjson, minetest already has a JSON interface built in.
minetest.json_encode() / minetest.json_decode()
You just need to change all occurences of cjson calls to the minetest ones.
The same applies for HTTP
minetest.json_encode() / minetest.json_decode()
You just need to change all occurences of cjson calls to the minetest ones.
The same applies for HTTP
- texmex
- Member
- Posts: 1753
- Joined: Mon Jul 11, 2016 21:08
- GitHub: tacotexmex
- In-game: tacotexmex
Re: Post your modding questions here
Oh okay, that's helpful and sound much easier than binary headache as well. Thank you orwell!orwell wrote:you don't need cjson, minetest already has a JSON interface built in.
minetest.json_encode() / minetest.json_decode()
You just need to change all occurences of cjson calls to the minetest ones.
The same applies for HTTP
- azekill_DIABLO
- Member
- Posts: 7507
- Joined: Wed Oct 29, 2014 20:05
- GitHub: azekillDIABLO
- In-game: azekill_DIABLO
- Location: OMICRON
- Contact:
Re: Post your modding questions here
json in mt? wow.
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!
DMs are always open if you want to get in touch!
- Lone_Wolf
- Member
- Posts: 2578
- Joined: Sun Apr 09, 2017 05:50
- GitHub: LoneWolfHT
- IRC: LandarVargan
- In-game: LandarVargan
Re: Post your modding questions here
If I want to learn lua where should I go? I'm hoping for an easy internet program. I will have learnt C before then.
- TumeniNodes
- Member
- Posts: 2943
- Joined: Fri Feb 26, 2016 19:49
- GitHub: TumeniNodes
- IRC: tumeninodes
- In-game: TumeniNodes
- Location: in the dark recesses of the mind
- Contact:
Re: Post your modding questions here
viewtopic.php?f=3&t=17851#p276215Lone_Wolf wrote:If I want to learn lua where should I go?
I am a noob. still yet. Not so noob ) [vml] WIP and a little proof for fun PlantedTorch )))
MT Strike 78a36b468554d101e0be3b0d1f587a555f396452 Great! Somebody have found it )
"My english isn't well" I know. I'm sorry )
MT Strike 78a36b468554d101e0be3b0d1f587a555f396452 Great! Somebody have found it )
"My english isn't well" I know. I'm sorry )
Re: Post your modding questions here
Hello,
On a specific world using Minetest 0.4.16 on win32, i have buildings made rather far from the new player starting position.
So after looking if it was possible to set on a specific world a new player new start position instead of using a conf entry that would then impact all worlds, i found this :
viewtopic.php?p=70904#p70904
That after testing unfortunately didn't worked for new player, only for respawning one.
After looking around , i found that there was a command for new player instead of respawn one.
So here was the content for this worldname\worldmods\spawn\init.lua
the coordinates i obtained them by placing myself exactly where i wanted the new player spawn point to be, exited the world and looked into the worldname\players\ file
Now i delete the singleplayer file from worldname\players\ to test this.
Apparently it works as i'm not spawning at all where i was spawning before as a new player.
But there's a problem, and a very big one if you compare the coordinate from the script to the actual coordinate the new singleplayer is sent to :
(above is an extract of the content of worldname\players\singleplayer file created after spawning and below is the script)
why is the X and Z multiplied by 10 ? (the Y probably too, as i spawned above clouds and when i exited the world i had left the character falling until underwater
The only way i found to fix that was to change
into
And only then the new player will then spawn at the desired X/Y/Z (x=2298.2, y=105, z=2185.4), but why do i have to input coordinates divided by 10 in comparison to the real ones ?
EDIT :
i found a reason, in fact the coordinate that are wrong are the ones from worldname\players\ , because if ingame i press F5 i can see the coordinate being 229.82, y=10.5, z=218.54 while in the worldname\players\ they're multiplied by 10 for some reason.
Very odd as i don't use a mod messing with the coordinate system in that world.
On a specific world using Minetest 0.4.16 on win32, i have buildings made rather far from the new player starting position.
So after looking if it was possible to set on a specific world a new player new start position instead of using a conf entry that would then impact all worlds, i found this :
viewtopic.php?p=70904#p70904
That after testing unfortunately didn't worked for new player, only for respawning one.
After looking around , i found that there was a command for new player instead of respawn one.
So here was the content for this worldname\worldmods\spawn\init.lua
Code: Select all
minetest.register_on_newplayer(function(player)
player:setpos({x=2298.2, y=105, z=2185.4})
return true
end)
Now i delete the singleplayer file from worldname\players\ to test this.
Apparently it works as i'm not spawning at all where i was spawning before as a new player.
But there's a problem, and a very big one if you compare the coordinate from the script to the actual coordinate the new singleplayer is sent to :
(above is an extract of the content of worldname\players\singleplayer file created after spawning and below is the script)
why is the X and Z multiplied by 10 ? (the Y probably too, as i spawned above clouds and when i exited the world i had left the character falling until underwater
The only way i found to fix that was to change
Code: Select all
player:setpos({x=2298.2, y=105, z=2185.4})
Code: Select all
player:setpos({x=229.82, y=10.5, z=218.54})
EDIT :
i found a reason, in fact the coordinate that are wrong are the ones from worldname\players\ , because if ingame i press F5 i can see the coordinate being 229.82, y=10.5, z=218.54 while in the worldname\players\ they're multiplied by 10 for some reason.
Very odd as i don't use a mod messing with the coordinate system in that world.
- BrunoMine
- Member
- Posts: 1082
- Joined: Thu Apr 25, 2013 17:29
- GitHub: BrunoMine
- Location: SP-Brasil
- Contact:
Re: Post your modding questions here
I noticed that some data is disappearing from my tables (after any time).
Does the Lua automatically delete data? How can I know if this is my case?
http://www.lua.org/manual/5.1/manual.html#2.10
Does the Lua automatically delete data? How can I know if this is my case?
http://www.lua.org/manual/5.1/manual.html#2.10
- Lone_Wolf
- Member
- Posts: 2578
- Joined: Sun Apr 09, 2017 05:50
- GitHub: LoneWolfHT
- IRC: LandarVargan
- In-game: LandarVargan
Re: Post your modding questions here
I'm making a mod that has admin armor from stu's mod. The only change is the textures which are black.
I know 0.05% lua. This is my first problem: [Censored]/Desktop\MT\minetest\bin\..\mods\adminarmor\init.lua: No such file or directory
2017-06-19 11:59:01: ERROR[Main]: Check debug.txt for details.
I know 0.05% lua. This is my first problem: [Censored]/Desktop\MT\minetest\bin\..\mods\adminarmor\init.lua: No such file or directory
2017-06-19 11:59:01: ERROR[Main]: Check debug.txt for details.
- BrunoMine
- Member
- Posts: 1082
- Joined: Thu Apr 25, 2013 17:29
- GitHub: BrunoMine
- Location: SP-Brasil
- Contact:
Re: Post your modding questions here
All mods need to have an init.lua file (even if it is useless)
Does the mod have this file?
Maybe you can give more details of the problem (debug.txt).
Does the mod have this file?
Maybe you can give more details of the problem (debug.txt).
- TumeniNodes
- Member
- Posts: 2943
- Joined: Fri Feb 26, 2016 19:49
- GitHub: TumeniNodes
- IRC: tumeninodes
- In-game: TumeniNodes
- Location: in the dark recesses of the mind
- Contact:
Re: Post your modding questions here
you need to create a folder and name it adminarmor or admin_armor (which ever you prefer)Lone_Wolf wrote:I'm making a mod that has admin armor from stu's mod. The only change is the textures which are black.
I know 0.05% lua. This is my first problem: [Censored]/Desktop\MT\minetest\bin\..\mods\adminarmor\init.lua: No such file or directory
2017-06-19 11:59:01: ERROR[Main]: Check debug.txt for details.
in this folder you will create another folder and name it textures. (place you textures here), where ever you list these textures, the names have to match the names in this folder.
Next you will then create some new .txt files
1. init.lua
2. dependencies.txt (in here you simply type the word default, or the name of stu's armor mod)
3. description.txt (here, type a brief description of the mod) one or two sentences.
4. license.txt (you need to list the license information here)
5. mod.conf (in here type name = adminarmor) (you have to keep the name the same everywhere)
for the init.lua, you can copy and paste the code related to the first set of armor from stu's mod..., and replace all instances of his mod's name, with your mod's name.
such as:
Code: Select all
minetest.register_node("adminarmor:blackhelmet", {
description = "Black Admin Helmet",
tiles = {"adminarmor_black_helmet"},
and remember to add credit and thanks to stu
A Wonderful World
- Lone_Wolf
- Member
- Posts: 2578
- Joined: Sun Apr 09, 2017 05:50
- GitHub: LoneWolfHT
- IRC: LandarVargan
- In-game: LandarVargan
Re: Post your modding questions here
Ok thanks. What license would you suggest?
Question(s):
Is this needed at the beginning of the init.lua?
Question(s):
Is this needed at the beginning of the init.lua?
Code: Select all
local S = function(s) return s end
if minetest.global_exists("intllib") then
S = intllib.Getter()
end
Last edited by Lone_Wolf on Mon Jun 19, 2017 23:33, edited 1 time in total.
- TumeniNodes
- Member
- Posts: 2943
- Joined: Fri Feb 26, 2016 19:49
- GitHub: TumeniNodes
- IRC: tumeninodes
- In-game: TumeniNodes
- Location: in the dark recesses of the mind
- Contact:
Re: Post your modding questions here
My code was just an example showing how you would replace those names with your own, copy the code from the armor mod.
use the license the mod you are copying the code from.
the textures you can choose a license if you hand made them, if they are simply a copy of the original textures, and you simply recolored them, use the license for the original textures.
use the license the mod you are copying the code from.
the textures you can choose a license if you hand made them, if they are simply a copy of the original textures, and you simply recolored them, use the license for the original textures.
A Wonderful World
- Lone_Wolf
- Member
- Posts: 2578
- Joined: Sun Apr 09, 2017 05:50
- GitHub: LoneWolfHT
- IRC: LandarVargan
- In-game: LandarVargan
Re: Post your modding questions here
I think I got the code copied correctly. Link to github here: adminarmor
- Lone_Wolf
- Member
- Posts: 2578
- Joined: Sun Apr 09, 2017 05:50
- GitHub: LoneWolfHT
- IRC: LandarVargan
- In-game: LandarVargan
- TumeniNodes
- Member
- Posts: 2943
- Joined: Fri Feb 26, 2016 19:49
- GitHub: TumeniNodes
- IRC: tumeninodes
- In-game: TumeniNodes
- Location: in the dark recesses of the mind
- Contact:
Who is online
Users browsing this forum: No registered users and 7 guests