Post your modding questions here

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

Re: Post your modding questions here

by iangp » Post

Well,I finally bookmarked your modding book Sir Ruben Wardy XD, It's a very useful reference material.
So, at end the code seems like that:

Code: Select all

local 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) --stop the sound
            sound = 'no'
       end
   end,
})
God's not dead, He's surely alive!
エル プサイ コングルー

My mods (WIP):


User avatar
MineYoshi
Member
Posts: 5374
Joined: Wed Jul 08, 2015 13:20
Contact:

Re: Post your modding questions here

by MineYoshi » Post

I think i am a little dumb, or i don't know the "enough" yet!

Anyways THX!
Have a nice day! :D

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

Re: Post your modding questions here

by iangp » Post

MineYoshi wrote:I think i am a little dumb, or i don't know the "enough" yet!

Anyways THX!
Not really, you just need practice.
make little challenges to yourself:
exercises, big projects, read some good book/e-book (not only about Lua),
It comes along with time, so be patient.

And of course think out the box :D
creativity helps to find a nicer way to solve a problem.
God's not dead, He's surely alive!
エル プサイ コングルー

My mods (WIP):


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

Re: Post your modding questions here

by Don » Post

iangp wrote:
MineYoshi wrote:I think i am a little dumb, or i don't know the "enough" yet!

Anyways THX!
Not really, you just need practice.
make little challenges to yourself:
exercises, big projects, read some good book/e-book (not only about Lua),
It comes along with time, so be patient.

And of course think out the box :D
creativity helps to find a nicer way to solve a problem.
I agree! I have been slowly learning. I still have a lot more to learn. Every challenge I give myself makes me have a little more knowledge. Keep trying.
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
MineYoshi
Member
Posts: 5374
Joined: Wed Jul 08, 2015 13:20
Contact:

Re: Post your modding questions here

by MineYoshi » Post

Don wrote:
iangp wrote:
MineYoshi wrote:I think i am a little dumb, or i don't know the "enough" yet!

Anyways THX!
Not really, you just need practice.
make little challenges to yourself:
exercises, big projects, read some good book/e-book (not only about Lua),
It comes along with time, so be patient.

And of course think out the box :D
creativity helps to find a nicer way to solve a problem.
I agree! I have been slowly learning. I still have a lot more to learn. Every challenge I give myself makes me have a little more knowledge. Keep trying.
THX for motivation i will try to be better!

=D
Have a nice day! :D

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

Re: Post your modding questions here

by Don » Post

Remember that failing is much better than not trying at all. Some of the best things in life are the result of failures.
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
MineYoshi
Member
Posts: 5374
Joined: Wed Jul 08, 2015 13:20
Contact:

Re: Post your modding questions here

by MineYoshi » Post

Good advice...

Many people said that to me too...
Have a nice day! :D

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

work with String

by BrunoMine » Post

How can I check each letter in a string?
How can I check the amount of characters in a string?
I want to create a verification loop of characters in a string.

User avatar
rubenwardy
Moderator
Posts: 6449
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: United Kingdom
Contact:

Re: Post your modding questions here

by rubenwardy » Post

For length: #str
For character: str.sub(i, 1)

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

How i can hook up on existing player inventory functions like in detached inventory functions "on_put","on_take","on_move" and so on? I mean a one, that are returned by "player:get_inventory()".

User avatar
mahmutelmas06
Member
Posts: 367
Joined: Mon Mar 02, 2015 13:10
GitHub: mahmutelmas06
IRC: mahmutelmas06
In-game: masum

Re: Post your modding questions here

by mahmutelmas06 » Post

i use formspecs to make a coffee machine but i need help
can i use itemgroup instead of an item ?

for exp instead of "flowers:tulip" i want to use group flowers

inv:contains_item("src", ItemStack("flowers:tulip"))
My Mods:

Beverage

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

Re: Post your modding questions here

by Don » Post

mahmutelmas06 wrote:i use formspecs to make a coffee machine but i need help
can i use itemgroup instead of an item ?

for exp instead of "flowers:tulip" i want to use group flowers

inv:contains_item("src", ItemStack("flowers:tulip"))
You can see how to do groups in this mod
viewtopic.php?f=11&t=11780
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

Lucki
New member
Posts: 1
Joined: Wed Mar 30, 2016 13:55
In-game: Lucki

Re: Post your modding questions here

by Lucki » Post

How I can check, a player is death? If this happens I want to Drop an Item.
And sorry for my english because i´m from germany and 12 years old.
I want to make a "Capture the FlagMod"

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

Re: Post your modding questions here

by Don » Post

Lucki wrote:How I can check, a player is death? If this happens I want to Drop an Item.
And sorry for my english because i´m from germany and 12 years old.
I want to make a "Capture the FlagMod"
Use this

http://dev.minetest.net/minetest.register_on_dieplayer
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
ynong123
Member
Posts: 20
Joined: Fri Mar 11, 2016 13:24
GitHub: ynong123
IRC: ynong123
In-game: ynong123
Location: Malaysia

Post A Topic

by ynong123 » Post

Question: How to post a topic?
Reason: I want to release a mod.

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:

Re: Post your modding questions here

by kaeza » Post

rubenwardy wrote:For length: #str
For character: str.sub(i, 1)
Correction: `str:sub(i, i)`

Arguments are start and end pos, not start pos and length.
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
kaeza
Moderator
Posts: 2162
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza
Location: Montevideo, Uruguay
Contact:

Re: work with String

by kaeza » Post

BrunoMine wrote:[...]I want to create a verification loop of characters in a string.
Patterns are probably faster. For example, this code tells you if you have any non-alphanumeric chars:

Code: Select all

if str:find("[^A-Za-z0-9]") then
  error("please only use letters or digits")
end
Read more about patterns here.

Edit: If you need to know the position for whatever reason:

Code: Select all

local start, fin, what = str:find("[^A-Za-z0-9]")
if start then
  error("character "..what.." (at position "..start..") is not allowed")
end
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
jp
Member
Posts: 841
Joined: Wed Dec 18, 2013 09:03
GitHub: kilbith
Location: France

Re: Post your modding questions here

by jp » Post

This would be even simpler using :

Code: Select all

str:find("%W")

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

Re: Post A Topic

by Don » Post

ynong123 wrote:Question: How to post a topic?
Reason: I want to release a mod.
You release a mod in the wip mods section.
When the mod is complete and the forum topic is set up following the guidelines then you request that your mod gets moved to releases.
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
MineYoshi
Member
Posts: 5374
Joined: Wed Jul 08, 2015 13:20
Contact:

Re: Post your modding questions here

by MineYoshi » Post

A question!

How make when i use an item send a message to the player who have it?

It's for a very big project, it's an easter egg!
Have a nice day! :D

User avatar
Hybrid Dog
Member
Posts: 2783
Joined: Thu Nov 01, 2012 12:46
GitHub: HybridDog

Re: Post your modding questions here

by Hybrid Dog » Post

http://dev.minetest.net/minetest.register_node#on_use

minetest.chat_send_player(player:get_player_name(), "some text")

‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪

User avatar
MineYoshi
Member
Posts: 5374
Joined: Wed Jul 08, 2015 13:20
Contact:

Re: Post your modding questions here

by MineYoshi » Post

how to make, when i click a chest of one space(left click) with a craft_item, drop the item in the chest?
Have a nice day! :D

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

Re: Post your modding questions here

by Don » Post

MineYoshi wrote:how to make, when i click a chest of one space(left click) with a craft_item, drop the item in the chest?
Use on_use.
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
BrunoMine
Member
Posts: 1081
Joined: Thu Apr 25, 2013 17:29
GitHub: BrunoMine
Location: SP-Brasil
Contact:

Re: Post your modding questions here

by BrunoMine » Post

How can I place an item in a biome.
For example: I want to appear in a chest in a jungle forest.

I can not check the area next to jungle trees that have just been generated.

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

Re: Post your modding questions here

by Don » Post

BrunoMine wrote:How can I place an item in a biome.
For example: I want to appear in a chest in a jungle forest.

I can not check the area next to jungle trees that have just been generated.
Are you trying to do it when the map loads or could you use an abm or lbm to make it place?
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

Locked

Who is online

Users browsing this forum: No registered users and 2 guests