Post your modding questions here

Nyarg
Member
 
Posts: 271
Joined: Sun May 15, 2016 04:32

Re: Post your modding questions here

by Nyarg » Sat Jun 10, 2017 11:27

Wow I found instruction and read it ) http://dev.minetest.net/setting_get_pos
try * `minetest.setting_get_pos(name)`: returns position or nil
with
spawn_lobby = 0 80 0
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 )
 

User avatar
Lejo
Member
 
Posts: 227
Joined: Mon Oct 19, 2015 16:32
GitHub: Lejo1
In-game: Lejo
 

Sires
Member
 
Posts: 79
Joined: Mon Jan 02, 2017 21:00
Location: Hue knows...
IRC: Sires
In-game: Sires

Well, halp to delete metadata

by Sires » Sat Jun 10, 2017 15:28

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 ?
Working in a new mod

Also, Sires is not pronouncied like Siri, it's from Sir, use he not she(also not it, I'm not a thing :P).

**SORY MAY BADDY ANGLISH**
 

Gerald
Member
 
Posts: 84
Joined: Sun Dec 28, 2014 10:35
Location: Germany
In-game: gerald7

Re: Well, halp to delete metadata

by Gerald » Sat Jun 10, 2017 17:04

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 think meta:set_string("d", nil) works.
 

Sires
Member
 
Posts: 79
Joined: Mon Jan 02, 2017 21:00
Location: Hue knows...
IRC: Sires
In-game: Sires

Re: Well, halp to delete metadata

by Sires » Sat Jun 10, 2017 20:12

Gerald wrote:
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 think meta:set_string("d", nil) works.

Nope, I tested it, it just sets the data to nil, but the data key still exists in the metadata
Working in a new mod

Also, Sires is not pronouncied like Siri, it's from Sir, use he not she(also not it, I'm not a thing :P).

**SORY MAY BADDY ANGLISH**
 

Gerald
Member
 
Posts: 84
Joined: Sun Dec 28, 2014 10:35
Location: Germany
In-game: gerald7

Re: Well, halp to delete metadata

by Gerald » Sat Jun 10, 2017 21:41

Sires wrote:
Gerald wrote:I think meta:set_string("d", nil) works.

Nope, I tested it, it just sets the data to nil, but the data key still exists in the metadata


If I read the result of minetest.serialize(meta:to_table()) the key is gone.
What is the problem of a dummy value anyway?
 

Nyarg
Member
 
Posts: 271
Joined: Sun May 15, 2016 04:32

Re: Well, halp to delete metadata

by Nyarg » Sat Jun 10, 2017 22:45

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 think a meta isn't properly table or isn't accessible by native Lua garbage collector.
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 )
 

Sires
Member
 
Posts: 79
Joined: Mon Jan 02, 2017 21:00
Location: Hue knows...
IRC: Sires
In-game: Sires

Re: Well, halp to delete metadata

by Sires » Sun Jun 11, 2017 01:20

Nyarg wrote:
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 think a meta isn't properly table or isn't accessible by native Lua garbage collector.


Well btw this gave-me an idea, create an function using from_table that deletes every nil value there, I think this may work
Working in a new mod

Also, Sires is not pronouncied like Siri, it's from Sir, use he not she(also not it, I'm not a thing :P).

**SORY MAY BADDY ANGLISH**
 

User avatar
orwell
Member
 
Posts: 560
Joined: Wed Jun 24, 2015 18:45
Location: Raxacoricofallapatorius
GitHub: orwell96
In-game: orwell

Re: Post your modding questions here

by orwell » Wed Jun 14, 2017 08:11

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)
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...
 

User avatar
texmex
Member
 
Posts: 590
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: texmex

Re: Post your modding questions here

by texmex » Wed Jun 14, 2017 08:29

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?
Taking a break from Minetest.
Mods Commons, Sling, hbSprint, Floodables, item_drop⑂, Telemosaic⑂, Herbs⑂.
Texturepacks Good Morning Craft
 

User avatar
orwell
Member
 
Posts: 560
Joined: Wed Jun 24, 2015 18:45
Location: Raxacoricofallapatorius
GitHub: orwell96
In-game: orwell

Re: Post your modding questions here

by orwell » Wed Jun 14, 2017 16:00

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
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...
 

User avatar
texmex
Member
 
Posts: 590
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: texmex

Re: Post your modding questions here

by texmex » Wed Jun 14, 2017 21:05

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

Oh okay, that's helpful and sound much easier than binary headache as well. Thank you orwell!
Taking a break from Minetest.
Mods Commons, Sling, hbSprint, Floodables, item_drop⑂, Telemosaic⑂, Herbs⑂.
Texturepacks Good Morning Craft
 

User avatar
azekill_DIABLO
Member
 
Posts: 6722
Joined: Wed Oct 29, 2014 20:05
Location: Inside the Box
GitHub: azekillDIABLO
In-game: azekill_DIABLO
 

User avatar
Lone_Wolf
Member
 
Posts: 1630
Joined: Sun Apr 09, 2017 05:50
Location: You wouldn't believe me
GitHub: LoneWolfHT
IRC: Lone_Wolf
In-game: Lone_Wolf or Somebody

Re: Post your modding questions here

by Lone_Wolf » Sun Jun 18, 2017 17:45

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.
 

User avatar
TumeniNodes
Member
 
Posts: 2132
Joined: Fri Feb 26, 2016 19:49
Location: in the dark recesses of the mind
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes

Re: Post your modding questions here

by TumeniNodes » Sun Jun 18, 2017 18:23

Reckless disregard for the truth -- will not be protected by a qualified privilege.
 

Nyarg
Member
 
Posts: 271
Joined: Sun May 15, 2016 04:32

Re: Post your modding questions here

by Nyarg » Sun Jun 18, 2017 18:36

Lone_Wolf wrote:If I want to learn lua where should I go?

viewtopic.php?f=3&t=17851#p276215
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 )
 

Robsoie
Member
 
Posts: 86
Joined: Fri Apr 29, 2016 16:22

Re: Post your modding questions here

by Robsoie » Mon Jun 19, 2017 11:59

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
Code: Select all
minetest.register_on_newplayer(function(player)
    player:setpos({x=2298.2, y=105, z=2185.4})
    return true
end)


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 :
Image
(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})


into
Code: Select all
    player:setpos({x=229.82, y=10.5, z=218.54})


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.
 

User avatar
BrunoMine
Member
 
Posts: 964
Joined: Thu Apr 25, 2013 17:29
Location: SP-Brasil
GitHub: BrunoMine

Re: Post your modding questions here

by BrunoMine » Mon Jun 19, 2017 16:18

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
 

User avatar
Lone_Wolf
Member
 
Posts: 1630
Joined: Sun Apr 09, 2017 05:50
Location: You wouldn't believe me
GitHub: LoneWolfHT
IRC: Lone_Wolf
In-game: Lone_Wolf or Somebody

Re: Post your modding questions here

by Lone_Wolf » Mon Jun 19, 2017 19:20

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.
 

User avatar
BrunoMine
Member
 
Posts: 964
Joined: Thu Apr 25, 2013 17:29
Location: SP-Brasil
GitHub: BrunoMine

Re: Post your modding questions here

by BrunoMine » Mon Jun 19, 2017 21:07

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).
 

User avatar
TumeniNodes
Member
 
Posts: 2132
Joined: Fri Feb 26, 2016 19:49
Location: in the dark recesses of the mind
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes

Re: Post your modding questions here

by TumeniNodes » Mon Jun 19, 2017 21:16

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.


you need to create a folder and name it adminarmor or admin_armor (which ever you prefer)
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 so on
and remember to add credit and thanks to stu
Reckless disregard for the truth -- will not be protected by a qualified privilege.
 

User avatar
Lone_Wolf
Member
 
Posts: 1630
Joined: Sun Apr 09, 2017 05:50
Location: You wouldn't believe me
GitHub: LoneWolfHT
IRC: Lone_Wolf
In-game: Lone_Wolf or Somebody

Re: Post your modding questions here

by Lone_Wolf » Mon Jun 19, 2017 23:19

Ok thanks. What license would you suggest?
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.
 

User avatar
TumeniNodes
Member
 
Posts: 2132
Joined: Fri Feb 26, 2016 19:49
Location: in the dark recesses of the mind
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes

Re: Post your modding questions here

by TumeniNodes » Mon Jun 19, 2017 23:31

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.
Reckless disregard for the truth -- will not be protected by a qualified privilege.
 

User avatar
Lone_Wolf
Member
 
Posts: 1630
Joined: Sun Apr 09, 2017 05:50
Location: You wouldn't believe me
GitHub: LoneWolfHT
IRC: Lone_Wolf
In-game: Lone_Wolf or Somebody
 

User avatar
Lone_Wolf
Member
 
Posts: 1630
Joined: Sun Apr 09, 2017 05:50
Location: You wouldn't believe me
GitHub: LoneWolfHT
IRC: Lone_Wolf
In-game: Lone_Wolf or Somebody
 

PreviousNext

Return to Modding Discussion



Who is online

Users browsing this forum: No registered users and 2 guests

cron