Post your modding questions here

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

by LionsDen » Post

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
Developer
Posts: 4650
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

by Krock » Post

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.
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

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

by LionsDen » Post

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 » Post

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:

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 » Post

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
Developer
Posts: 4650
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

by Krock » Post

Spoiler
Topic: How do I use "minetest.show_formspec" correctly?
Reason: I've this problem:

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)

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 :(
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.
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

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

by BrunoMine » Post

I do not know how to skip lines.

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: 1082
Joined: Thu Apr 25, 2013 17:29
GitHub: BrunoMine
Location: SP-Brasil
Contact:

by BrunoMine » Post

brunob.santos wrote:I do not know how to skip lines.

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
Developer
Posts: 4650
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

by Krock » Post

skip lines? how do you mean that?
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

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

by PilzAdam » Post

brunob.santos wrote:
brunob.santos wrote:I do not know how to skip lines.

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!
:(

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: 1082
Joined: Thu Apr 25, 2013 17:29
GitHub: BrunoMine
Location: SP-Brasil
Contact:

by BrunoMine » Post

PilzAdam wrote:

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
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
Location: Germany

by PilzAdam » Post

brunob.santos wrote:
PilzAdam wrote:

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
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
Location: Slovakia

by AMMOnym » Post

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: 327
Joined: Sun Jan 08, 2012 21:34
GitHub: pandaro
Location: behind

by pandaro » Post

'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
Moderator
Posts: 2162
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza
Location: Montevideo, Uruguay
Contact:

by kaeza » Post

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

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

by AMMOnym » Post

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
Location: Slovakia

by AMMOnym » Post

thx

User avatar
pandaro
Member
Posts: 327
Joined: Sun Jan 08, 2012 21:34
GitHub: pandaro
Location: behind

by pandaro » Post

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: 1207
Joined: Fri Aug 03, 2012 16:59
GitHub: CasimirKaPazi

by Casimir » Post

About the hud; No matter what I set "direction" to, it always looks the same. Could it be that this is not implemented yet?

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 » Post

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: 1207
Joined: Fri Aug 03, 2012 16:59
GitHub: CasimirKaPazi

by Casimir » Post

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 » Post

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
Location: Germany

by fairiestoy » Post

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
Developer
Posts: 4650
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

by Krock » Post

Topic: Can someone put this C# code into LUA?
Reason: Mods
More Info: This here is the code:

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.
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

User avatar
Krock
Developer
Posts: 4650
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

by Krock » Post

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.
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

Locked

Who is online

Users browsing this forum: No registered users and 6 guests