Post your modding questions here

Locked
User avatar
Enke
Member
Posts: 469
Joined: Fri Nov 15, 2013 02:56
GitHub: NANOsoldierEnke
IRC: Enke
In-game: Enke
Location: The internet

by Enke » Post

paramat wrote:tiles should be "troll_troll.png" not "troll:troll.png" etc :)
*WHAP* I don't know how I missed that. Thank you.
Lush8
ExtraVars for Red Eclipse

<Anarchid> my turn was still the most awesome, yielding all the cripples, two captured paranormals, and death rate of about 30%
<ORCACommander> Anarchid: you need to work harder
<ORCACommander> I am hereby putting you under review until you can increase the casualty rate

User avatar
Enke
Member
Posts: 469
Joined: Fri Nov 15, 2013 02:56
GitHub: NANOsoldierEnke
IRC: Enke
In-game: Enke
Location: The internet

by Enke » Post

does this:

Code: Select all

chance = 10,
make it so that there is a 10% chance or a 90% chance?

*Edit* Okay, working on a real mod. I am trying to register craftitems, and here is my code:

Code: Select all

minetest.register_craftitem("inlaid:inlaytool", {
    description = "Inlay tool",
    inventory_image = "inlaid_inlaytool.png",
})

minetest.register_craftitem("inlaid:chisel", {
    description = "Chisel",
    inventory_image = "inlaid_chisel.png",
})
and I get this error when I run it:

Code: Select all

21:52:48: ERROR[main]: ...minetest-0.4.7-5094a39-win32\bin\..\mods\inlaid\init.lua:15: unfinished string near '"inlaid_chisel.png,'
Can someone explain?
Last edited by Enke on Wed Nov 20, 2013 03:59, edited 1 time in total.
Lush8
ExtraVars for Red Eclipse

<Anarchid> my turn was still the most awesome, yielding all the cripples, two captured paranormals, and death rate of about 30%
<ORCACommander> Anarchid: you need to work harder
<ORCACommander> I am hereby putting you under review until you can increase the casualty rate

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

by LionsDen » Post

It's the last comma in each item's definition. A comma is only there when there is more information to be placed in the definition. Try removing them and try again.

User avatar
paramat
Developer
Posts: 3700
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat
IRC: paramat
Location: UK

by paramat » Post

No those last commas are fine and should not cause a problem. Can't see anything wrong in the code, might be an error outside the code you have pasted here.

jin_xi
Member
Posts: 165
Joined: Mon Jul 02, 2012 18:19

by jin_xi » Post

Enke wrote: [...] and I get this error when I run it:

Code: Select all

21:52:48: ERROR[main]: ...minetest-0.4.7-5094a39-win32\bin\..\mods\inlaid\init.lua:15: unfinished string near '"inlaid_chisel.png,'
Can someone explain?
are you sure you posted the relevant part of your code? check line numbers again. The string quoted in the error message is indeed unfinished, and should be closed with and " before the comma.

User avatar
Enke
Member
Posts: 469
Joined: Fri Nov 15, 2013 02:56
GitHub: NANOsoldierEnke
IRC: Enke
In-game: Enke
Location: The internet

by Enke » Post

This is all the code I have, and I have no clue why the error message says that the line is unfinished.
Lush8
ExtraVars for Red Eclipse

<Anarchid> my turn was still the most awesome, yielding all the cripples, two captured paranormals, and death rate of about 30%
<ORCACommander> Anarchid: you need to work harder
<ORCACommander> I am hereby putting you under review until you can increase the casualty rate

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

by LionsDen » Post

Did you do a direct copy/paste of your code here? Because according to your error you are missing a quote mark " at the end of the line that has inlaid_chisel.png. Maybe while typing it in for the lua file your finger accidentally pressed 2 keys at once which causes some keyboards to send some other key code to the computer. It's very easy to do. I have found that sometimes the only way to fix that type of error is select the line around where the problem is and delete it and then retype it in.

jin_xi
Member
Posts: 165
Joined: Mon Jul 02, 2012 18:19

by jin_xi » Post

Enke wrote:This is all the code I have, and I have no clue why the error message says that the line is unfinished.
...

lol, sry to have bothered you

User avatar
Enke
Member
Posts: 469
Joined: Fri Nov 15, 2013 02:56
GitHub: NANOsoldierEnke
IRC: Enke
In-game: Enke
Location: The internet

by Enke » Post

Wow, major derp.... the code I was fiddling with was my backup copy. It did need quote marks in the original code. Thanks guys.

Geez, a derp every day... I'm terribly sorry to have troubled you.
Last edited by Enke on Wed Nov 20, 2013 23:30, edited 1 time in total.
Lush8
ExtraVars for Red Eclipse

<Anarchid> my turn was still the most awesome, yielding all the cripples, two captured paranormals, and death rate of about 30%
<ORCACommander> Anarchid: you need to work harder
<ORCACommander> I am hereby putting you under review until you can increase the casualty rate

User avatar
hoodedice
Member
Posts: 1374
Joined: Sat Jul 06, 2013 06:33
GitHub: hoodedice
IRC: hoodedice
In-game: hoodedice
Location: world
Contact:

by hoodedice » Post

Where is the code for the default inventory stored?
7:42 PM - Bauglio: I think if you go to staples you could steal firmware from a fax machine that would run better than win10 does on any platform
7:42 PM - Bauglio: so fudge the stable build
7:43 PM - Bauglio: get the staple build

User avatar
Neon
Member
Posts: 126
Joined: Thu Aug 15, 2013 02:03
In-game: Neon

by Neon » Post

I have an atmospheric node that seems to block the growth of trees. What would I need to set so trees will replace the node at the appropriate locations, rather than not grow at those locations?

Code: Select all

minetest.register_node("luna:oxygen", {
        drawtype = "glasslike",
        tiles = {"atmos.png"},
        paramtype = "light",
        sunlight_propagates = true,
        walkable = false,
        pointable = false,
        diggable = false,
        buildable_to = true,
        post_effect_color = {a=24, r=255, g=255, b=255},
        groups = {not_in_creative_inventory=1, air_like=1}
})

modsBr
New member
Posts: 1
Joined: Fri Nov 22, 2013 00:30

by modsBr » Post

how can I make my own mod?

User avatar
hoodedice
Member
Posts: 1374
Joined: Sat Jul 06, 2013 06:33
GitHub: hoodedice
IRC: hoodedice
In-game: hoodedice
Location: world
Contact:

by hoodedice » Post

modsBr wrote:how can I make my own mod?
lua_api.txt
7:42 PM - Bauglio: I think if you go to staples you could steal firmware from a fax machine that would run better than win10 does on any platform
7:42 PM - Bauglio: so fudge the stable build
7:43 PM - Bauglio: get the staple build

User avatar
Neon
Member
Posts: 126
Joined: Thu Aug 15, 2013 02:03
In-game: Neon

by Neon » Post

Thank you HD, but I am already using air for something else.

User avatar
Dan Duncombe
Member
Posts: 904
Joined: Thu May 09, 2013 21:11
Location: In the unknown depths of Earth

by Dan Duncombe » Post

Why not give it draw type air like?
Some Mods: Castles Prefab Camouflage
My Games: Nostalgia Realtest Revamped
Servers: See above games.

derpswa99
Member
Posts: 78
Joined: Sun Mar 24, 2013 21:26

by derpswa99 » Post

How do I use the "minetest.item_place_node" function?

User avatar
stu
Member
Posts: 923
Joined: Sat Feb 02, 2013 02:51
GitHub: stujones11
Location: United Kingdom

by stu » Post

derpswa99 wrote:How do I use the "minetest.item_place_node" function?
See: http://dev.minetest.net/minetest.place_node

User avatar
stu
Member
Posts: 923
Joined: Sat Feb 02, 2013 02:51
GitHub: stujones11
Location: United Kingdom

by stu » Post

How can I make a tool item wear when used pointing at nothing?

I tried this but is does not seem to have any effect.

Code: Select all

    on_use = function(itemstack, user, pointed_thing)
        itemstack:add_wear(100)
        user:set_wielded_item(itemstack)
    end,
Last edited by stu on Sun Nov 24, 2013 19:36, edited 1 time in total.

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

by PilzAdam » Post

stu wrote:How can I make a tool item wear when used pointing at nothing?

I tried this but is does not seem to have any effect.

Code: Select all

    on_use = function(itemstack, user, pointed_thing)
        itemstack:add_wear(100)
        user:set_wielded_item(itemstack)
    end,
on_use is only called when pointing at something.

User avatar
stu
Member
Posts: 923
Joined: Sat Feb 02, 2013 02:51
GitHub: stujones11
Location: United Kingdom

by stu » Post

PilzAdam wrote: on_use is only called when pointing at something.
That is not true. I can prove this by adding a print statement in there, point at the sky and press LMB

I think the problem is with how I am commiting the itemstack, though I got that idea from the dev wiki http://dev.minetest.net/Player
(changes will need to be "committed" by calling object:set_wielded_item(modifiedStack)
Last edited by stu on Sun Nov 24, 2013 20:45, edited 1 time in total.

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

by PilzAdam » Post

Oh, it was on_place() that was only called when pointing at something, sorry, my bad.

You should try return itemstack instead of set_wielded_item().

User avatar
stu
Member
Posts: 923
Joined: Sat Feb 02, 2013 02:51
GitHub: stujones11
Location: United Kingdom

by stu » Post

PilzAdam wrote:Oh, it was on_place() that was only called when pointing at something, sorry, my bad.

You should try return itemstack instead of set_wielded_item().
No problem, returning the itemstack does the business.

Thank you once again.

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

by Krock » Post

I've the feeling, it has already posted here alot but:
How do I make a crafting grid, that needs a pickaxe, which only gets a little damaged, when using it for crafting?

(just giving back is good too)

Okay, I've already found:

Code: Select all

replacements = { ... with ... }
Is there also a way to damage it?
Last edited by Krock on Mon Nov 25, 2013 13:44, 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
fairiestoy
Member
Posts: 191
Joined: Sun Jun 09, 2013 19:25
Location: Germany

by fairiestoy » Post

*ahem* Just follow this simple steps:
> Open your browser
> Go to https://github.com/minetest/minetest/bl ... ua_api.txt
> Press [Ctrl] + F ( default for Firefox if im not mistaken )
> Input 'wear' within the search field
> Iterate through document until functions are found

Thats how you get this result: https://github.com/minetest/minetest/bl ... .txt#L1754
Interesting about new things is, to figure out how it works ...

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

by AMMOnym » Post

How i can make throwing (like throwing mod) from block, then i punch block and block throw something.??:_?:?

Locked

Who is online

Users browsing this forum: No registered users and 6 guests