Post your modding questions here

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

by BrunoMine » Sat Dec 07, 2013 19:43

philipbenr wrote:Okay. If you want everyone to be able to use, edit and distribute the mod, then use GPLv3. If you want any other license, you might try LGPL or some other one. CC licenses aren't really for code...


Yes!
Get to work!
:D
My small square universe under construction ... Minemacro
Comunidade Minetest Brasil
www.minetestbrasil.com
 

User avatar
Krock
Member
 
Posts: 3598
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker

by Krock » Sun Dec 08, 2013 08:26

Topic: Are things like this here possible? (A scrollbar in chests)
Image
Reason: Mods
More Info: Could be interesting to work with that
Last edited by Krock on Sun Dec 08, 2013 08:27, edited 1 time in total.
Newest Win32 builds - Find a mod - All my mods
ALL YOUR DONATION ARE BELONG TO PARAMAT (Please support him and Minetest)
New DuckDuckGo !bang: !mtmod <keyword here>
 

User avatar
Nightshade
Member
 
Posts: 25
Joined: Thu Oct 24, 2013 15:25

by Nightshade » Sun Dec 08, 2013 16:38

Ok, so I'm putting together a mod for personal use, and I added a food item. But on use of this food item, I want part of it to return back to the inventory (it's soda, I want an empty bottle back). I have no coding experience, so I'm just going on what I see in minetest_game mods and other mods. I have this...
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_craftitem("morestuff:apple_soda", {
    description = "Apple Soda",
    inventory_image = "apple_soda.png",
    on_use = minetest.item_eat(3),
    replacements = { {"morestuff:apple_soda", "vessels:glass_bottle"} },
})

Can someone tell me where I'm going wrong?
 

User avatar
Krock
Member
 
Posts: 3598
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker

by Krock » Sun Dec 08, 2013 17:33

Nightshade wrote:Ok, so I'm putting together a mod for personal use, and I added a food item. But on use of this food item, I want part of it to return back to the inventory (it's soda, I want an empty bottle back). I have no coding experience, so I'm just going on what I see in minetest_game mods and other mods. I have this...
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_craftitem("morestuff:apple_soda", {
    description = "Apple Soda",
    inventory_image = "apple_soda.png",
    on_use = minetest.item_eat(3),
    replacements = { {"morestuff:apple_soda", "vessels:glass_bottle"} },
})

Can someone tell me where I'm going wrong?


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
... replacements = { { ...

those are used in the crafting grid
Codes from moretree mod:
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
-- Food recipes!

minetest.register_craftitem("moretrees:coconut_milk", {
    description = "Coconut Milk",
    inventory_image = "moretrees_coconut_milk_inv.png",
    wield_image = "moretrees_coconut_milk.png",
    on_use = minetest.item_eat(2),
})

More I can't help you, try and try, maybe you'll find a possible soulation :)

EDIT:
you could do it like the bucket mod: (modifed)
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
on_use = function(itemstack, user, pointed_thing)
        -- Dig if pointed on node
        if pointed_thing.type == "node" then
            return
        end
        minetest.item_eat(3)
        return ItemStack({name = "vessels:glass_bottle"})
    end,
Last edited by Krock on Sun Dec 08, 2013 17:39, edited 1 time in total.
Newest Win32 builds - Find a mod - All my mods
ALL YOUR DONATION ARE BELONG TO PARAMAT (Please support him and Minetest)
New DuckDuckGo !bang: !mtmod <keyword here>
 

User avatar
Nightshade
Member
 
Posts: 25
Joined: Thu Oct 24, 2013 15:25

by Nightshade » Sun Dec 08, 2013 18:25

Krock wrote:EDIT:
you could do it like the bucket mod: (modifed)
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
on_use = function(itemstack, user, pointed_thing)
        -- Dig if pointed on node
        if pointed_thing.type == "node" then
            return
        end
        minetest.item_eat(3)
        return ItemStack({name = "vessels:glass_bottle"})
    end,

This worked perfectly, thanks!
 

User avatar
LionsDen
Member
 
Posts: 525
Joined: Thu Jun 06, 2013 03:19

by LionsDen » Sun Dec 08, 2013 19:01

Krock wrote:Topic: Are things like this here possible? (A scrollbar in chests)
http://i.imgur.com/ohpm62H.png
Reason: Mods
More Info: Could be interesting to work with that


An actual scroll bar that works, maybe but I think it would be very difficult to do. You could however have an up arrow button and a down arrow button and use them to scroll through different inventories. To do something like that I would suggest you study the code for unified inventory which is part of the technic mod.
 

User avatar
Krock
Member
 
Posts: 3598
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker

by Krock » Sun Dec 08, 2013 19:07

Nightshade wrote:This worked perfectly, thanks!

Wow, and I didn't even test it :3

LionsDen wrote:To do something like that I would suggest you study the code for unified inventory which is part of the [unified infentory mod]

Okay thanks, maybe are scrollbars needed somewhen :)
Last edited by Krock on Sun Dec 08, 2013 19:08, edited 1 time in total.
Newest Win32 builds - Find a mod - All my mods
ALL YOUR DONATION ARE BELONG TO PARAMAT (Please support him and Minetest)
New DuckDuckGo !bang: !mtmod <keyword here>
 

User avatar
LionsDen
Member
 
Posts: 525
Joined: Thu Jun 06, 2013 03:19

by LionsDen » Sun Dec 08, 2013 21:35

I believe that the unified inventory mod is no longer being developed at that thread and is now a part of technic. A sub-mod if you will. At least I remember hearing about that at one point months ago.
 

User avatar
Nightshade
Member
 
Posts: 25
Joined: Thu Oct 24, 2013 15:25

by Nightshade » Mon Dec 09, 2013 03:17

Nightshade wrote:This worked perfectly, thanks!

Ok, so maybe it didn't work as perfectly as I thought. First what I did was take out my "on_use" then put in yours. that didn't allow the soda to heal. Then I combined the two, but if you tried to drink one from a whole stack, the whole stack was taken. SO, I added a stack limit of 1, and that fixed it. I ended up with this:
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_craftitem("morestuff:apple_soda", {
    description = "Apple Soda",
    inventory_image = "apple_soda.png",
    stack_max = 1,
    on_use = minetest.item_eat(4),
    on_use = function(itemstack, user, pointed_thing)
        -- Dig if pointed on node
        if pointed_thing.type == "node" then
            return
        end
        minetest.item_eat(4)
        return ItemStack({name = "vessels:glass_bottle"})
    end,
})

I may look into the code of the farming:bread and change some stuff around later though. :)
Last edited by Nightshade on Mon Dec 09, 2013 03:18, edited 1 time in total.
 

D0431791
Member
 
Posts: 19
Joined: Wed Nov 06, 2013 11:43

by D0431791 » Mon Dec 09, 2013 10:52

Topic: [0.4.8]How to get the seed string?
Reason: I want to make a mod that generates pseudo random number based on kikito/md5.lua .
More Info(optional): The seed string, which is available in 0.4.8 but not in 0.4.7 .
Minetest can be better if
*better data structure for players and unstackable items like JSON
*multi sqlite files so that multi dimension can be easily implemented
*more convenient mob developing interface
 

User avatar
Krock
Member
 
Posts: 3598
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker

by Krock » Mon Dec 09, 2013 16:51

[spoiler=my problem was...]Topic: How do I use "minetest.show_formspec" correctly?
Reason: I've this problem:
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
function get_prochest_formspec(number) -- returns string with formspec:
    "invsize[12,10;]"..
    "label[0,0;ProChest]"..
    "label[1,0.5;Your grid:]"..
    "list[current_name;cust_ow;1,1;2,2;]"..
    "button[3,1.5;2,1;exchange;Exchange]"..
    "label[6,3;You get:]"..
    "list[current_name;cust_og;6,3.5;2,2;]"..
    "list[current_player;main;2,6;8,4;]")

In the node definition: ("cust_ow" and "cust_og" are defined with 2*2 as size in on_construct)
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
on_rightclick = function(pos, node, clicker, itemstack)
        local meta = minetest.env:get_meta(pos)
        if clicker:get_player_name() == meta:get_string("owner") then
            minetest.show_formspec(clicker:get_player_name(),"testing:prochest_formspec",get_prochest_formspec(1))
        else
            minetest.show_formspec(clicker:get_player_name(),"testing:prochest_formspec",get_prochest_formspec(1))
        end
    end,


More info: I don't see any lists :([/spoiler]

solved myself with listname = "nodemeta:"..pos.x..","..pos.y..","..pos.z
Last edited by Krock on Tue Dec 10, 2013 16:33, edited 1 time in total.
Newest Win32 builds - Find a mod - All my mods
ALL YOUR DONATION ARE BELONG TO PARAMAT (Please support him and Minetest)
New DuckDuckGo !bang: !mtmod <keyword here>
 

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

by BrunoMine » Tue Dec 10, 2013 01:17

I do not know how to skip lines.
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
  meta:set_string("formspec",
            "size[8,9]"..
            "textarea[0,0;8,8;Texto;Aventura de Minerador (O Troféu);Para conseguir o troféu de minerador você deverá encontrar o livro de receiras 'Corpo de Troféo' e 'Base de Troféu', depois faça os itens e unaos para obter o belo troféu]"
            )
        return formspec
My small square universe under construction ... Minemacro
Comunidade Minetest Brasil
www.minetestbrasil.com
 

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

by BrunoMine » Wed Dec 11, 2013 00:26

brunob.santos wrote:I do not know how to skip lines.
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
  meta:set_string("formspec",
            "size[8,9]"..
            "textarea[0,0;8,8;Texto;Book of bla;Bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla]"
            )
        return formspec


HELP!
:(
Last edited by BrunoMine on Wed Dec 11, 2013 00:27, edited 1 time in total.
My small square universe under construction ... Minemacro
Comunidade Minetest Brasil
www.minetestbrasil.com
 

User avatar
Krock
Member
 
Posts: 3598
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker

by Krock » Wed Dec 11, 2013 14:06

skip lines? how do you mean that?
Newest Win32 builds - Find a mod - All my mods
ALL YOUR DONATION ARE BELONG TO PARAMAT (Please support him and Minetest)
New DuckDuckGo !bang: !mtmod <keyword here>
 

User avatar
PilzAdam
Member
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam

by PilzAdam » Wed Dec 11, 2013 16:05

brunob.santos wrote:
brunob.santos wrote:I do not know how to skip lines.
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
  meta:set_string("formspec",
            "size[8,9]"..
            "textarea[0,0;8,8;Texto;Book of bla;Bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla]"
            )
        return formspec


HELP!
:(

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
  meta:set_string("formspec",
            "size[8,9]"..
            "textarea[0,0;8,8;Texto;Book of bla;Bla bla bla bla bla bla bla bla bla bla"..
            " bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla"..
            " bla bla bla bla bla bla bla]"
            )
return formspec
 

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

by BrunoMine » Wed Dec 11, 2013 16:52

PilzAdam wrote:
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
  meta:set_string("formspec",
            "size[8,9]"..
            "textarea[0,0;8,8;Texto;Book of bla;Bla bla bla bla bla bla bla bla bla bla"..
            " bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla"..
            " bla bla bla bla bla bla bla]"
            )
return formspec

Does not work!
[spoiler]Image[/spoiler]
My small square universe under construction ... Minemacro
Comunidade Minetest Brasil
www.minetestbrasil.com
 

User avatar
PilzAdam
Member
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam

by PilzAdam » Wed Dec 11, 2013 17:17

brunob.santos wrote:
PilzAdam wrote:
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
  meta:set_string("formspec",
            "size[8,9]"..
            "textarea[0,0;8,8;Texto;Book of bla;Bla bla bla bla bla bla bla bla bla bla"..
            " bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla"..
            " bla bla bla bla bla bla bla]"
            )
return formspec

Does not work!
[spoiler]http://img823.imageshack.us/img823/7295/5g4u.png[/spoiler]

Oh, you want the newlines in-game. Use \n for that.
 

User avatar
AMMOnym
Member
 
Posts: 682
Joined: Tue Sep 10, 2013 14:18
IRC: AMMOnym
In-game: AMMOnym

by AMMOnym » Thu Dec 12, 2013 19:27

i need only one thing: i making on my mod from simple mobs but i dont know how i can set jumping to any lenght , high and speed. Please help me
 

User avatar
pandaro
Member
 
Posts: 266
Joined: Sun Jan 08, 2012 21:34
GitHub: pandaro

by pandaro » Wed Dec 18, 2013 12:39

'm sorry but I have tried in several ways. I'm not able to change the position of a HUD through "hud_change ()"

EXAMPLE of not working test:

minetest.register_tool("player_radar:radar_hud",{
description="radar hud",
inventory_image = ("portable_receiver.png"),
tool_capabilities = {
groupcaps={
snappy = {times={[2]=0.95}, uses=20, maxlevel=1},
--fleshy = {times={[3]=1.6}, uses=10, maxlevel=1}
}
},
on_use=function(itemstack,user)
player_radar_hud[user:get_player_name()] = user:hud_add({
hud_elem_type = "image",
position = {x=0.5,y=0.5},
scale = {x=0.1, y=0.1},
text = "radar13cmp2.png",
number = 1,
alignment = {x=0,y=0},
offset = {
x = 0;
y = 0;
},
})
end,
on_place=function(itemstack,placer)
placer:hud_change(player_radar_hud[placer:get_player_name()],"position",{x=0.1,y=0.1})
print(dump(placer:hud_get(player_radar_hud[placer:get_player_name()])))
end,
})

someone could pass me an example?
sorry for bad english
Linux debian 7 wheezy 64
kde
 

User avatar
kaeza
Member
 
Posts: 2141
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza

by kaeza » Wed Dec 18, 2013 15:05

Pandaro: seems like a typo in the Lua HUD. I have submitted a patch for it.

For now, you can use "pos" instead of "position".
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal | BTC: 1DFZAa5VtNG7Levux4oP6BuUzr1e83pJK2
 

User avatar
AMMOnym
Member
 
Posts: 682
Joined: Tue Sep 10, 2013 14:18
IRC: AMMOnym
In-game: AMMOnym

by AMMOnym » Thu Dec 19, 2013 13:10

It is possible that it can be from one combination to produce more things as output?
minetest.register_craft({
output = 'poke:magicarp', 'poke:psyduck',->?
recipe = {
{'poke:randomwater'},
{'poke:awakening'},
}
 

User avatar
AMMOnym
Member
 
Posts: 682
Joined: Tue Sep 10, 2013 14:18
IRC: AMMOnym
In-game: AMMOnym

by AMMOnym » Thu Dec 19, 2013 19:08

thx
 

User avatar
pandaro
Member
 
Posts: 266
Joined: Sun Jan 08, 2012 21:34
GitHub: pandaro

by pandaro » Fri Dec 20, 2013 12:12

kaeza wrote:Pandaro: seems like a typo in the Lua HUD. I have submitted a patch for it.

For now, you can use "pos" instead of "position".


kaeza thanks, it works!
I hope that your patch is accepted.
sorry for bad english
Linux debian 7 wheezy 64
kde
 

User avatar
Casimir
Member
 
Posts: 1101
Joined: Fri Aug 03, 2012 16:59

by Casimir » Fri Dec 20, 2013 20:11

About the hud; No matter what I set "direction" to, it always looks the same. Could it be that this is not implemented yet?
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
player_bubbles[name] = player:hud_add({
    hud_elem_type = "statbar",
    text = "bubble.png",
    number = 20,
    direction = 1,
    position = {x=0.5,y=0.9},
    offset = {x=0, y=19},
})
Last edited by Casimir on Fri Dec 20, 2013 20:12, edited 1 time in total.
 

wcwyes
Member
 
Posts: 145
Joined: Wed Jul 31, 2013 22:42

by wcwyes » Sun Dec 22, 2013 12:50

Is there a way to connect two worlds? Has anyone done it? Is it in the realm of possibilities thru lua or is it something I would have to get into the hard coding for?
 

User avatar
Casimir
Member
 
Posts: 1101
Joined: Fri Aug 03, 2012 16:59

by Casimir » Sun Dec 22, 2013 14:15

Depending on what you want, there are two things I can think of. Both would be possible in Lua.
1. With some portal thing when entered the player file is copied to the second world, in one file there is saved that the player left the world. Then the player is kicked out of the server and can not connect until the "player is not in this world" file is changed from an other world. You would have to manually connect to the new server.
2. A shared build area. When ever a node is altered in the defined area, it is saved in a worldedit file and sent to the second server/world together with a timestamp and then loaded into the second world.
Last edited by Casimir on Sun Dec 22, 2013 14:15, edited 1 time in total.
 

wcwyes
Member
 
Posts: 145
Joined: Wed Jul 31, 2013 22:42

by wcwyes » Sun Dec 22, 2013 20:36

Casimir wrote:Depending on what you want, there are two things I can think of. Both would be possible in Lua.
1. With some portal thing when entered the player file is copied to the second world, in one file there is saved that the player left the world. Then the player is kicked out of the server and can not connect until the "player is not in this world" file is changed from an other world. You would have to manually connect to the new server.
2. A shared build area. When ever a node is altered in the defined area, it is saved in a worldedit file and sent to the second server/world together with a timestamp and then loaded into the second world.
couldn't I make a .js file to use theplayer profile to automatically log the player into the new server?
 

User avatar
fairiestoy
Member
 
Posts: 191
Joined: Sun Jun 09, 2013 19:25

by fairiestoy » Mon Dec 23, 2013 05:28

Question is: What are you exactly aiming at? Do you want to cross-connect several servers by portals? If you just want to give the player the imagination that hes wandering between different worlds, you could create a mod which adds unpassable borders at specific heights and generate new land above this borders. If a player gets ported to the destination, he cannot get back to the original level without the portals. Thats at least the most useable solution ( imo ) when you don't want to kick out the user from his server and force him to reconnect somewhere else ( where he might run into problems when not finding it in the server list for example ).

If you want the crossconnect stuff ( which is interesting ), you have to suggest a API facility to the devs ( like minetest.client_connect_to( <connection parameters> ) ) which holds the current connection but tries to get the user into the other server. On success, he gives free the original connection. Should be a client-only thing.
Last edited by fairiestoy on Mon Dec 23, 2013 05:30, edited 1 time in total.
Interesting about new things is, to figure out how it works ...
 

User avatar
Krock
Member
 
Posts: 3598
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker

by Krock » Mon Dec 23, 2013 19:44

Topic: Can someone put this C# code into LUA?
Reason: Mods
More Info: This here is the code:
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
//for the 3D-coords
struct Position {
     public int x, y, z;
}
//node
struct Node {
     public int param2;
}
//nplayer
class Player {
     //just pointing to the existence of this
}

//now the codes
void testing(Position pos, Node node, Player player) {
     for(int x = pos.x - 1, x <= pos.x + 1, x++) {
     for(int y = pos.y - 1, y <= pos.y + 1, y++) {
     for(int z = pos.z - 1, z <= pos.z + 1, z++) {
          Position xpos = new Position();
          xpos.x = x;
          xpos.y = y;
          xpos.z = z;
          minetest.env:remove_node(xpos);
     }
     }
     }
}


In short: it should dig a 3*3*3 block, without changing the "pos" variable.
Last edited by Krock on Mon Dec 23, 2013 19:47, edited 1 time in total.
Newest Win32 builds - Find a mod - All my mods
ALL YOUR DONATION ARE BELONG TO PARAMAT (Please support him and Minetest)
New DuckDuckGo !bang: !mtmod <keyword here>
 

User avatar
Krock
Member
 
Posts: 3598
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker

by Krock » Tue Dec 24, 2013 12:46

Hybrid Dog wrote:function dig3(pos)
for i = -1,1 do
for j = -1,1 do
for k = -1,1 do
minetest.remove_node({x=pos.x+i, y=pos.y+j, z=pos.z+k})
end
end
end
end

Oh thanks, I simply thought too much.
Newest Win32 builds - Find a mod - All my mods
ALL YOUR DONATION ARE BELONG TO PARAMAT (Please support him and Minetest)
New DuckDuckGo !bang: !mtmod <keyword here>
 

PreviousNext

Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 6 guests

cron