Post your modding questions here

User avatar
maikerumine
Member
 
Posts: 946
Joined: Mon Aug 04, 2014 14:27
GitHub: maikerumine
In-game: maikerumine

Re: Post your modding questions here

by maikerumine » Fri Mar 04, 2016 22:52

Can a broken mod stuck in a loop cause insane server lag?
 

Hybrid Dog
Member
 
Posts: 2460
Joined: Thu Nov 01, 2012 12:46

Re: Post your modding questions here

by Hybrid Dog » Sat Mar 05, 2016 08:38

maikerumine wrote:Can a broken mod stuck in a loop cause insane server lag?

Not only broken mods can cause infinite or very long loops. Often mod makers do mistakes they don't notice till they use their mod and find out that it doesn't work as it should (the reason why modders have to play enough minetest). I also have this problem sometimes, e.g. my scheduler (or sth like this) mod, which makes it possible to look at a exploding chunk consisting of 200x300x230 tnt and build a house at the same time without having lags, had the problem that the function couldn't be executed in the function passed by it (e.g. minetest.delay_function(4, minetest.delay_function, 2, some_func, some_param)), l found it out by testing and then fixed it: https://github.com/HybridDog/function_d ... 4748da8e37
if l didn't use the mod, l wouldn't have found the infinite loop bug l added without noticing it: https://github.com/HybridDog/function_d ... c6e5553260
 

Misadventure
New member
 
Posts: 5
Joined: Tue Mar 01, 2016 21:36
In-game: Misadventure

Re: Dual Crafting Output?

by Misadventure » Sat Mar 05, 2016 15:11

Byakuren wrote:the register_on_craft callbacks receive the old craft grid (from before crafting) and the inventory the craft is from. So you should be able to look at the hammer from the old craft grid and insert it back into the inventory with more wear.

You could do something similar to send the hammer to the player's inventory instead, since the callback will receive an ObjectRef to the player as another argument.


From what ive been able to search and find, I can't seem to locate very much information on the register_on_craft.
so I'm still not entirely sure how id go about using this, and what id write for it to function the way im intending. I know this sounds like im asking "hold my hand through the whole process" but i'm doing my best as a young learner to try and wrap my head around this, however the lack of information i'm able to find and piece together makes this troublesome and difficult to do without me asking silly question, such as these where they imply i need my hand held.
 

User avatar
stu
Member
 
Posts: 737
Joined: Sat Feb 02, 2013 02:51
GitHub: stujones11

Re: Dual Crafting Output?

by stu » Wed Mar 09, 2016 14:57

Misadventure wrote:
Byakuren wrote:the register_on_craft callbacks receive the old craft grid (from before crafting) and the inventory the craft is from. So you should be able to look at the hammer from the old craft grid and insert it back into the inventory with more wear.

You could do something similar to send the hammer to the player's inventory instead, since the callback will receive an ObjectRef to the player as another argument.


From what ive been able to search and find, I can't seem to locate very much information on the register_on_craft.
so I'm still not entirely sure how id go about using this, and what id write for it to function the way im intending. I know this sounds like im asking "hold my hand through the whole process" but i'm doing my best as a young learner to try and wrap my head around this, however the lack of information i'm able to find and piece together makes this troublesome and difficult to do without me asking silly question, such as these where they imply i need my hand held.


I think that Byakuren described that very well so if you do not understand any of that you should perhaps break it down and ask more specific questions like what is a callback or what is an ObjectRef, for example.

IMO, the best way to learn is to study other mods which interest you or have similar functionality to something you want to do. I would also recommend this as good resource for anyone wishing to learn about modding online book teaching how to mod There is of course the official doc's and developer wiki which you should have bookmarked already ;-)
 

KzoneDD
Member
 
Posts: 52
Joined: Wed Sep 17, 2014 09:29

Re: Post your modding questions here

by KzoneDD » Thu Mar 10, 2016 00:28

Hi all,

I've been trying to get water out of a stone... oh, ok, a node... ;-) All I need is for code that lets me do stuff if punched / clicked (I don't really care either way) with an empty bucket.

I found this in the well mod:

if minetest.get_modpath("bucket") then
local original_bucket_on_use = minetest.registered_items["bucket:bucket_empty"].on_use
minetest.override_item("bucket:bucket_empty", {
on_use = function(itemstack, user, pointed_thing)
local inv = user:get_inventory()

if pointed_thing.type == "node" and minetest.get_node(pointed_thing.under).name == "homedecor:well" then
if inv:room_for_item("main", "bucket:bucket_water 1") then
itemstack:take_item()
inv:add_item("main", "bucket:bucket_water 1")
else
minetest.chat_send_player(user:get_player_name(), "No room in your inventory to add a filled bucket!")
end
return itemstack
else if original_bucket_on_use then
return original_bucket_on_use(itemstack, user, pointed_thing)
else return end
end
end
})
end

But obviously it's not all I need as this creates a nill value error on bucket:bucket_empty on startup.

What am I missing? TIA!
 

KzoneDD
Member
 
Posts: 52
Joined: Wed Sep 17, 2014 09:29

Re: Post your modding questions here

by KzoneDD » Thu Mar 10, 2016 06:55

NVM... I had hoped to put off the time when forgetting my 'depends' became an issue, but it's here. ;-) Forgot to declare bucket. :-P
 

Hybrid Dog
Member
 
Posts: 2460
Joined: Thu Nov 01, 2012 12:46

Re: Post your modding questions here

by Hybrid Dog » Thu Mar 10, 2016 18:01

e^(-b) = 2*e^(-b*d)-1

e and d are known, b is not 0. How can l shift the equation to get b?
 

User avatar
iangp
Member
 
Posts: 114
Joined: Sat May 31, 2014 19:26
GitHub: 14NGiestas
IRC: iangp
In-game: iangp

Re: Post your modding questions here

by iangp » Fri Mar 11, 2016 02:19

Hybrid Dog wrote:e^(-b) = 2*e^(-b*d)-1

e and d are known, b is not 0. How can l shift the equation to get b?

From where do you get this relation?

e**-b == 2*e**(-b*d) - 1
God's not dead, He's surely alive!
エル プサイ コングルー

My mods (WIP):
 

Hybrid Dog
Member
 
Posts: 2460
Joined: Thu Nov 01, 2012 12:46

Re: Post your modding questions here

by Hybrid Dog » Fri Mar 11, 2016 20:48

http://freespace.virgin.net/hugo.elias/ ... posure.htm

v(x) = a*[1-e^(-b*x)]

x is in [0, 1], 0 means black, 0.5 means middle grey and 1 means white
d is the middle brightness of the picture (the expectation), so it's also inside [0, 1]
a and b are not 0

v(0) = 0; a*[1-e^(-b*0)] = 0; 1-1 = 0;
v(1) = 1; a*[1-e^(-b)] = 1
v(d) = 0.5; a*[1-e^(-b*d)] = 0.5

1/[1-e^(-b)] = 0.5/[1-e^(-b*d)]; 2*[1-e^(-b*d)] = 1-e^(-b); 1-2*e^(-b*d)] = -e^(-b);
e^(-b) = 2*e^(-b*d)-1
 

User avatar
iangp
Member
 
Posts: 114
Joined: Sat May 31, 2014 19:26
GitHub: 14NGiestas
IRC: iangp
In-game: iangp

Re: Post your modding questions here

by iangp » Sat Mar 12, 2016 00:29

e^-b = 2*e^(-b*d)-1
derive both sides
-e^-b = -2*d*e^(-b*d)
multiply by -1 both sides
e^-b = 2*d*e^(-b*d)
apply "ln" as a operation on both sides
ln e^-b = ln [2*d*e^(-b*d)]
logarithm properties log (a*b) = log a + log b
-b = ln 2 + ln d - b*d
b-b*d = ln 2 + ln d
b (1-d) = ln 2 + ln d
Finally
b = (ln 2 + ln d) / (1 - d)
Check out please I'm not sure
God's not dead, He's surely alive!
エル プサイ コングルー

My mods (WIP):
 

Hybrid Dog
Member
 
Posts: 2460
Joined: Thu Nov 01, 2012 12:46

Re: Post your modding questions here

by Hybrid Dog » Sat Mar 12, 2016 08:58

It doesn't work:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
local function getb(d)
   return math.log(2*d) / (1 - d)
end

local function geta(b)
   return 1/(1-math.exp(-b))
end

local function v(d)
   print("d = " .. d)
   local b = getb(d)
   print("b = " .. b)
   local a = geta(b)
   print("a = " .. a)
   -- col should be 0.5
   local col = a*(1-math.exp(-b*d))
   print("col = " .. col)
   return col
end

for i = 0,10 do
   v(i/10)
   print("\r")
end

+ "col should be 0.5 because v(d) should be 0.5"

deriving is a nice idea but
call the left side l(b) and the right side r(b)
l(b) = r(b)
the derivation gives the pitch of the function, but l and r are just equal at b, which is fixed, so l'(b) doesn't need to be r'(b)

Maybe you need to use the W function to shift it for b
 

Hybrid Dog
Member
 
Posts: 2460
Joined: Thu Nov 01, 2012 12:46

Re: Post your modding questions here

by Hybrid Dog » Sat Mar 12, 2016 09:29

l made it get b approximately:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
local function geta(b)
   return 1/(1-math.exp(-b))
end

local minb = -1002
local maxb = 30001

local function v(d)
   local b
   io.write("d = " .. d.."\n")
   for i = 0,100 do
      b = (minb+maxb)/2
      io.write("b = " .. b.."; ")
      local a = geta(b)
      --print("a = " .. a)
      local col = a*(1-math.exp(-b*d))
      io.write("col = " .. col.."\n")

      if math.log(col-0.5)/math.log(10) < -9
      or tostring(col) == "nan" then
         break
      elseif col < 0.5 then
         minb = b
      else
         maxb = b
      end
   end
end

v(0.8)

+ "the result"


This makes a list of bs:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
local function geta(b)
   return 1/(1-math.exp(-b))
end

local function v(d)
   local minb = -1002
   local maxb = 30001

   local b
   --io.write("d = " .. d.."\n")
   for i = 0,100 do
      b = (minb+maxb)/2
      --io.write("b = " .. b.."; ")
      local a = geta(b)
      --print("a = " .. a)
      local col = a*(1-math.exp(-b*d))
      --io.write("col = " .. col.."\n")

      if math.log(col-0.5)/math.log(10) < -9
      or tostring(col) == "nan" then
         break
      elseif col < 0.5 then
         minb = b
      else
         maxb = b
      end
   end
   return b
end

for i = 0,10 do
   local d = i/10
   io.write("d = " .. d..";"..(" "):rep(5-#tostring(d)).."b = "..v(d).."\n")
end

To use it for automatic brightness adjusting, the bs can be stored in a table and to get a b, interpolation can be used
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
d = 0;    b = 30001
d = 0.1;  b = 6.921614307927
d = 0.2;  b = 3.2812798977898
d = 0.3;  b = 1.8010717819961
d = 0.4;  b = 0.82216324127785
d = 0.5;  b = 9.4905772130005e-09
d = 0.6;  b = -0.82216322934596
d = 0.7;  b = -1.8010717700643
d = 0.8;  b = -3.2812798929072
d = 0.9;  b = -6.9216142889459
d = 1;    b = -759.7890625
 

Hybrid Dog
Member
 
Posts: 2460
Joined: Thu Nov 01, 2012 12:46

Re: Post your modding questions here

by Hybrid Dog » Sat Mar 12, 2016 09:44

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
-- code including much unused

local load_time_start = os.clock()
math.randomseed(os.time()+tonumber(io.popen("date +%N"):read("*all")))

--$ luajit parab.lua | pnmtopng > dsa.png && optipng -o7 -quiet dsa.png
local s = 2^10
local col = 255

local tab = {"P3", s, s, col}
local num = 5

local function info(msg)
   os.execute("notify-send '"..msg.."'")
end

local function round(n)
   return math.floor(n+0.5)
end

local function gcol(c)
   if c == math.huge
   or tostring(c) == "-nan" then
      c = 0
   end
   return round(c)%(col+1)
end

local function set(r,g,b)
   tab[num] = gcol(r)
   tab[num+1] = gcol(g)
   tab[num+2] = gcol(b)
   num = num+3
end

local sts = {}
local minc, maxc
local function tset(c)
   if not minc then
      minc = c
      maxc = c
   end
   minc = math.min(c, minc)
   maxc = math.max(c, maxc)
   table.insert(sts, c)
end


local function geta(b)
   return 1/(1-math.exp(-b))
end

local function v(d)
   local minb = -1002
   local maxb = 30001

   local b
   --io.write("d = " .. d.."\n")
   for i = 0,100 do
      b = (minb+maxb)/2
      --io.write("b = " .. b.."; ")
      local a = geta(b)
      --print("a = " .. a)
      local col = a*(1-math.exp(-b*d))
      --io.write("col = " .. col.."\n")

      if math.log(col-0.5)/math.log(10) < -9
      or tostring(col) == "nan" then
         break
      elseif col < 0.5 then
         minb = b
      else
         maxb = b
      end
   end
   return b
end

local function f(x)
   return v((x+s/2)/s)*s/100--math.sqrt(math.abs(10000-x*x))
end


local crds = {}
local a,b = -s/2+1, s/2
for x = a,b do
   if x == 0 then
      for y = a,b do
         crds[y] = crds[y] or {}
         crds[y][x] = 0.5
      end
   else
      local yf = f(x)
      if yf > b then
         for y = a,b do
            crds[y] = crds[y] or {}
            crds[y][x] = 0
         end
      elseif yf < a then
         for y = a,b do
            crds[y] = crds[y] or {}
            crds[y][x] = 1
         end
      else
         for y = a,math.floor(yf) do
            crds[y] = crds[y] or {}
            crds[y][x] = 0
         end
         for y = math.ceil(yf),b do
            crds[y] = crds[y] or {}
            crds[y][x] = 1
         end
         local y = math.ceil(yf)
         crds[y] = crds[y] or {}
         crds[y][x] = math.max(0, math.min(1, y-yf))
      end
   end
end

-- [[
for y = s/2,-s/2+1,-1 do
   for x = 1,s do
      x = x-s/2
      tset(crds[y][x])
   end
end--]]
--[[
for x = 1,s do
   x = x-1--s/2
   tset(do_ws_func(2, x))
end--]]


--[[
local crn = {x1=0,y1=0, x2=0,y2=0}
local hs = {}
local function seth(x,y)
   if not hs[y] then
      hs[y] = {}
   end
   if not hs[y][x] then
      hs[y][x] = 1
   else
      hs[y][x] = hs[y][x]+1
   end
   crn.x1 = math.min(x, crn.x1)
   crn.y1 = math.min(y, crn.y1)
   crn.x2 = math.max(x, crn.x2)
   crn.y2 = math.max(y, crn.y2)
end

local function geth(x,y)
   if not hs[y] then
      return 0
   end
   return hs[y][x] or 0
end

local cx = 0
local cy = 0
local dirs = {
   {1,0},
   {0,1},
   {-1,0},
   {0,-1},
}

local dif = maxc-minc
for i = 1,#sts do
   local v = sts[i]
   v = (v-minc)/dif
   sts[i] = v
   -- [ [
   v = v*255
   v = v*math.pi
   set(v,v,v)-- ] ]

   seth(cx,cy)
   --info(round(v*3)+1)
   --local dir = (v*300)%1
   local dir = (round(v*math.pi*100))%4+1
   local ndir = dirs[dir]
   cx = cx+ndir[1]
   cy = cy+ndir[2]
end

crn.x1 = crn.x1-5
crn.y1 = crn.y1-5
crn.x2 = crn.x2+5
crn.y2 = crn.y2+5

local s = {crn.x2-crn.x1, crn.y2-crn.y1}
tab[2] = s[1]+1
tab[3] = s[2]+1

maxc = 0
for y,xs in pairs(hs) do
   for _,h in pairs(xs) do
      maxc = math.max(maxc, h)
   end
end

for y = crn.y1,crn.y2 do
   for x = crn.x1,crn.x2 do
      local c = 0
      local v = hs[y]
      if v then
         c = hs[y][x] or 0
      end
      c = c*255/maxc
      --c = c%2*255
      set(c,c,c)
   end
end--]]

local dif = maxc-minc
for i = 1,#sts do
   local v = sts[i]
   v = (v-minc)/dif
   --sts[i] = v
   -- [[
   v = v*255
   --v = v*math.pi
   set(v,v,v)--]]

   --[[
   seth(cx,cy)
   --info(round(v*3)+1)
   --local dir = (v*300)%1
   local dir = (round(v*math.pi*100))%4+1
   local ndir = dirs[dir]
   cx = cx+ndir[1]
   cy = cy+ndir[2]--]]
end

info("fi")

print(table.concat(tab, " "))

local time = math.floor(tonumber(os.clock()-load_time_start)*100+0.5)/100
local msg = "fertig nach ca. "..time.."s"
if time > 0.05 then
   info(msg)
end

l think 1 y is 50 x on the picture
Image
Attachments
dsa.png
dsa.png (4.94 KiB) Viewed 2449 times
 

User avatar
iangp
Member
 
Posts: 114
Joined: Sat May 31, 2014 19:26
GitHub: 14NGiestas
IRC: iangp
In-game: iangp

Re: Post your modding questions here

by iangp » Sat Mar 12, 2016 19:10

Well, nice results for your approximation :D

I just had this idea cause the (-1) was pissing me off after a while trying shift the equation hehe and d/dx(constant) = 0, a perfect murder hehe, unfortunately doesn't work in this case.

I just learned Calculus I (limits, derivatives and integrals, with just one variable and at IR) and I need more practice, but I'll try understand W function in somewhere else.
God's not dead, He's surely alive!
エル プサイ コングルー

My mods (WIP):
 

Hybrid Dog
Member
 
Posts: 2460
Joined: Thu Nov 01, 2012 12:46

Re: Post your modding questions here

by Hybrid Dog » Sun Mar 13, 2016 08:46

l didn't know derivations with more than one variable are possible.
 

User avatar
iangp
Member
 
Posts: 114
Joined: Sat May 31, 2014 19:26
GitHub: 14NGiestas
IRC: iangp
In-game: iangp

Re: Post your modding questions here

by iangp » Sun Mar 13, 2016 13:08

partial derivatives of functions that have more than one variable.
https://en.wikipedia.org/wiki/Partial_derivative
And derivatives of vectors, I see that like "more than one variable" (in this case axis), gradient and others operations
https://en.wikipedia.org/wiki/Gradient

the point is I'm just getting started at this new stage of mathematics :P
This is probably getting off-topic it's better we finish it here.
God's not dead, He's surely alive!
エル プサイ コングルー

My mods (WIP):
 

User avatar
Foghrye4
Member
 
Posts: 24
Joined: Sun Mar 13, 2016 13:38
IRC: Foghrye4
In-game: Foghrye4

Re: Post your modding questions here

by Foghrye4 » Sun Mar 13, 2016 18:52

I have a question!
I want to override ore generation of other mods. Thus i can use "minetest.clear_registered_ores()". But how i can control mod load order? Does it depends from mod name?
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

Re: Post your modding questions here

by paramat » Mon Mar 14, 2016 09:06

the 'depends.txt' file controls mod order.
 

User avatar
Foghrye4
Member
 
Posts: 24
Joined: Sun Mar 13, 2016 13:38
IRC: Foghrye4
In-game: Foghrye4

Re: Post your modding questions here

by Foghrye4 » Mon Mar 14, 2016 15:01

Thank, paramat.
 

Hybrid Dog
Member
 
Posts: 2460
Joined: Thu Nov 01, 2012 12:46

Re: Post your modding questions here

by Hybrid Dog » Mon Mar 14, 2016 16:36

Do mesh objects have a cuboid collision box or a complex one?
 

User avatar
Don
Member
 
Posts: 1641
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: Post your modding questions here

by Don » Mon Mar 14, 2016 17:02

You set the collision box like a nodebox.
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here
 

User avatar
xeranas
Member
 
Posts: 99
Joined: Fri Feb 05, 2016 11:06
GitHub: xeranas

Re: Post your modding questions here

by xeranas » Tue Mar 15, 2016 06:43

Hi,
I'm trying to create block similar to furnace but more like "item converter". Due this reason I cannot use regular "fuel" recipes (I want that items as "fuel" would work only on my block).

So far I decided go ABM route which would check item in "fuel" slot and add it as fuel time manually according some predefined rules. To do so I need "extract" fuel name from fuel slot (it will be multiple custom "fuels").

I take furnace as example
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
minetest.register_abm({
  action = function(pos, node, active_object_count, active_object_count_wider)
    local meta = minetest.get_meta(pos)
    local inv = meta:get_inventory()
    local fuellist = inv:get_list("fuel")

Seems I getting list of userdata objects. I do not know how to extract properties from them rather than guessing. Unfortunately minetest dev wiki and lua api documentation does not provide explanation about userdata (or I missed?).
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
{ <userdata 1> }

Maybe I did completely wrong and I need go another direction?
 

User avatar
xeranas
Member
 
Posts: 99
Joined: Fri Feb 05, 2016 11:06
GitHub: xeranas

Re: Post your modding questions here

by xeranas » Tue Mar 15, 2016 06:51

guessing over
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
userdata:get_name()

Still where I could find which properties I can get from userdata? Maybe we can add some notes in dev wiki or lua api to help newbies like me?
 

Byakuren
Member
 
Posts: 441
Joined: Tue Apr 14, 2015 01:59
GitHub: raymoo
IRC: Hijiri

Re: Post your modding questions here

by Byakuren » Tue Mar 15, 2016 16:47

They are a list of ItemStack. You can find the methods available in the mod API doc.
Every time a mod API is left undocumented, a koala dies.
 

User avatar
xeranas
Member
 
Posts: 99
Joined: Fri Feb 05, 2016 11:06
GitHub: xeranas

Re: Post your modding questions here

by xeranas » Wed Mar 16, 2016 05:40

Byakuren wrote:They are a list of ItemStack. You can find the methods available in the mod API doc.

Thanks!, I was bit confused because lua.api documentation does not explicity says which type of objects from list I should expect. InvRef get_list
get_list(listname): return full list
 

User avatar
garywhite
Member
 
Posts: 95
Joined: Fri Feb 12, 2016 16:19
GitHub: garywhite207
IRC: same as MT name
In-game: garywhite garywhite1

Re: Post your modding questions here

by garywhite » Thu Mar 17, 2016 17:49

I am trying to set up a server, but I cannot get unified_inventory to work. Attached is the in-game load error.

Here is what debug says:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
2016-03-17 10:44:46: ERROR[main]: Failed to load and run script from
2016-03-17 10:44:46: ERROR[main]: D:\FlipShare Data\mt\minetest-0.4.13\bin\..\mods\unifiedinventory\init.lua:
2016-03-17 10:44:46: ERROR[main]: ...Data\mt\minetest-0.4.13\bin\..\builtin\game\register.lua:60: Name unified_inventory:bag_small does not follow naming conventions: "modname:" or ":" prefix required
2016-03-17 10:44:46: ERROR[main]: stack traceback:
2016-03-17 10:44:46: ERROR[main]:    [C]: in function 'error'


Does anyone know? I tried installing bags mod, to no avail. Please reply.

garywhite
mt error.png
mt error.png (59.14 KiB) Viewed 2449 times

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
2016-03-17 10:44:46: ERROR[main]:    ...Data\mt\minetest-0.4.13\bin\..\builtin\game\register.lua:60: in function 'check_modname_prefix'
2016-03-17 10:44:46: ERROR[main]:    ...Data\mt\minetest-0.4.13\bin\..\builtin\game\register.lua:98: in function 'register_item'
2016-03-17 10:44:46: ERROR[main]:    ...Data\mt\minetest-0.4.13\bin\..\builtin\game\register.lua:216: in function 'really_register_tool'
2016-03-17 10:44:46: ERROR[main]:    ...t-0.4.13\bin\..\mods\Technic\technic_worldgen/crafts.lua:162: in function 'register_tool'
2016-03-17 10:44:46: ERROR[main]:    ...mt\minetest-0.4.13\bin\..\mods\unifiedinventory/bags.lua:173: in main chunk
2016-03-17 10:44:46: ERROR[main]:    [C]: in function 'dofile'
2016-03-17 10:44:46: ERROR[main]:    ...mt\minetest-0.4.13\bin\..\mods\unifiedinventory\init.lua:63: in main chunk
2016-03-17 10:44:46: ERROR[main]: ======= END OF ERROR FROM LUA ========
2016-03-17 10:44:46: ERROR[main]: Server: Failed to load and run D:\FlipShare Data\mt\minetest-0.4.13\bin\..\mods\unifiedinventory\init.lua
2016-03-17 10:44:46: ERROR[main]: ModError: ModError: Failed to load and run D:\FlipShare Data\mt\minetest-0.4.13\bin\..\mods\unifiedinventory\init.lua
2016-03-17 10:44:46: ERROR[main]: Error from Lua:
2016-03-17 10:44:46: ERROR[main]: ...Data\mt\minetest-0.4.13\bin\..\builtin\game\register.lua:60: Name unified_inventory:bag_small does not follow naming conventions: "modname:" or ":" prefix required
2016-03-17 10:44:46: ERROR[main]: stack traceback:
2016-03-17 10:44:46: ERROR[main]:    [C]: in function 'error'
2016-03-17 10:44:46: ERROR[main]:    ...Data\mt\minetest-0.4.13\bin\..\builtin\game\register.lua:60: in function 'check_modname_prefix'
2016-03-17 10:44:46: ERROR[main]:    ...Data\mt\minetest-0.4.13\bin\..\builtin\game\register.lua:98: in function 'register_item'
2016-03-17 10:44:46: ERROR[main]:    ...Data\mt\minetest-0.4.13\bin\..\builtin\game\register.lua:216: in function 'really_register_tool'
2016-03-17 10:44:46: ERROR[main]:    ...t-0.4.13\bin\..\mods\Technic\technic_worldgen/crafts.lua:162: in function 'register_tool'
2016-03-17 10:44:46: ERROR[main]:    ...mt\minetest-0.4.13\bin\..\mods\unifiedinventory/bags.lua:173: in main chunk
2016-03-17 10:44:46: ERROR[main]:    [C]: in function 'dofile'
2016-03-17 10:44:46: ERROR[main]:    ...mt\minetest-0.4.13\bin\..\mods\unifiedinventory\init.lua:63: in main chunk
2016-03-17 10:44:46: ERROR[main]: Check debug.txt for details.
 

Hybrid Dog
Member
 
Posts: 2460
Joined: Thu Nov 01, 2012 12:46

Re: Post your modding questions here

by Hybrid Dog » Thu Mar 17, 2016 17:53

you called the mod folder unifiedinventory, but you need to call it unified_inventory

"read before asking for help"
http://wiki.minetest.net/Troubleshootin ... a.E2.80.9D
 

User avatar
BrunoMine
Member
 
Posts: 902
Joined: Thu Apr 25, 2013 17:29
GitHub: BrunoMine

Re: Post your modding questions here

by BrunoMine » Thu Mar 17, 2016 20:00

About the method:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
minetest.register_decoration()

How I can set a quantity of generated items?
 

User avatar
MineYoshi
Member
 
Posts: 4267
Joined: Wed Jul 08, 2015 13:20
GitHub: MineYosh
IRC: MineYoshi
In-game: Kirby_Retro

Re: Post your modding questions here

by MineYoshi » Tue Mar 22, 2016 22:50

Exactly how i can stop this function with other use?

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
minetest.register_tool("headphones:1headphones", {
   description = "Headphones Test Song",
   inventory_image = "testh.bmp",

   on_use = function()
      minetest.sound_play("test")
   end,
   
      
})


I mean i click one time, plays the sound, i click other time, the song plays again with the other.
I want to do this, i click one time, plays the sound, i click again and the stops the sound, how i do that?
People talk about freedom of speech, so i'll say that God exists.
Open your eyes!! See The big unicorn conspiracy.!! :D The government has been lying to us about unicorns!!
"I've learned there are three things you don't discuss with people: religion, politics and the Great Pumpkin" - Linus Van Pelt
I'm the Officially 1st ABJist in the world ( ͡° ͜ʖ ͡°)
 

User avatar
iangp
Member
 
Posts: 114
Joined: Sat May 31, 2014 19:26
GitHub: 14NGiestas
IRC: iangp
In-game: iangp

Re: Post your modding questions here

by iangp » Wed Mar 23, 2016 00:58

MineYoshi wrote:Exactly how i can stop this function with other use?

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
minetest.register_tool("headphones:1headphones", {
   description = "Headphones Test Song",
   inventory_image = "testh.bmp",

   on_use = function()
      minetest.sound_play("test")
   end,
   
      
})


I mean i click one time, plays the sound, i click other time, the song plays again with the other.
I want to do this, i click one time, plays the sound, i click again and the stops the sound, how i do that?

What if you:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
--Put a global var here
sound = 'no'
minetest.register_tool("headphones:1headphones", {
   description = "Headphones Test Song",
   inventory_image = "testh.bmp",

   on_use = function()
        if sound == 'no' then
            sound = minetest.sound_play("test") --keep the "reference" of the sound
        else
            minestes.sound_stop(sound)
           sound = 'no'
       end
   end,
   
      
})
God's not dead, He's surely alive!
エル プサイ コングルー

My mods (WIP):
 

PreviousNext

Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 4 guests

cron