skyduskguy
Member
Posts: 14 Joined: Mon Jan 04, 2016 04:16
by skyduskguy » Thu Jan 07, 2016 10:03
Post
ERROR[Main]: ...netest-0.4.13-98d16e0-win64\bin\..\mods\testing\init.lua:6: '}' expected near '='
Code: Select all
minetest.register_abm(
{nodenames = {"default:dirt"},
interval = 5,
chance = 10,
action = function(pos)
local airpos = minetest.find_node_near({x.pos, y.pos=y.pos+1, z.pos}, 1, {"default:air"})
if airpos==true then
minetest.env:add_node(airpos, {name="default:sand"})
end,
})
rubenwardy
Moderator
Posts: 7026 Joined: Tue Jun 12, 2012 18:11
GitHub:
rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: London, United Kingdom
Contact:
by rubenwardy » Thu Jan 07, 2016 10:11
Post
The problem is Here: minetest.find_node_near({x.pos, y.pos=y.pos+1, z.pos}, 1, {"default:air"})
Should be
minetest.find_node_near({x = pos.x, y = pos.y +1, z = pos.z}, 1, {"default:air"})
Also, use minetest.add_node not minetest.env:add_node
They're the same function. It's at some point end:add_node was changed to add_node
Also consider using set_node instead of add node. I can't remember what the differences are off the top of my head.
Don
Member
Posts: 1643 Joined: Sat May 17, 2014 18:40
GitHub:
DonBatman
IRC: Batman
In-game: Batman
by Don » Thu Jan 07, 2016 14:55
Post
add_node is an alias for set_node. They do the same thing. I am not sure if add_node will be depreciated or not.
It would be best to just use set_node just in case.
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
skyduskguy
Member
Posts: 14 Joined: Mon Jan 04, 2016 04:16
by skyduskguy » Thu Jan 07, 2016 17:01
Post
Thanks big time for the help, but now I get
ERROR[Main]: ...netest-0.4.13-98d16e0-win64\bin\..\mods\testing\init.lua:9: unexpected symbol near ','
Code: Select all
minetest.register_abm(
{nodenames = {"default:dirt"},
interval = 5,
chance = 10,
action = function(pos)
local airpos = minetest.find_node_near({x = pos.x, y = pos.y +1, z = pos.z}, 1, {"default:air"})
if airpos==true then
minetest.set_node(airpos, {name="default:sand"})
end,
})
skyduskguy
Member
Posts: 14 Joined: Mon Jan 04, 2016 04:16
by skyduskguy » Thu Jan 07, 2016 17:23
Post
Adding another end in there shut it up but it doesn't seem to be doing anything now
poop
skyduskguy
Member
Posts: 14 Joined: Mon Jan 04, 2016 04:16
by skyduskguy » Thu Jan 07, 2016 17:29
Post
it seems to be WORKING! im excited :P
Big ole TY for the help bros
Code: Select all
minetest.register_abm(
{nodenames = {"default:dirt"},
interval = 10,
chance = 100,
action = function(pos)
local airpos = minetest.find_node_near({x = pos.x, y = pos.y +1, z = pos.z}, 1, {"default:air"})
if airpos~=true then
minetest.set_node({x=pos.x, y=pos.y +1, z=pos.z}, {name="default:sand"})
end
end,
})
skyduskguy
Member
Posts: 14 Joined: Mon Jan 04, 2016 04:16
by skyduskguy » Thu Jan 07, 2016 17:47
Post
tried adding a radius limit to the dirt checking but.....this is so hard :(
skyduskguy
Member
Posts: 14 Joined: Mon Jan 04, 2016 04:16
by skyduskguy » Thu Jan 07, 2016 19:09
Post
actually its not working, shouldnt be placing stuff where something already exists
i changed the type to wood to watch it easier
Code: Select all
minetest.register_abm(
{nodenames = {"default:wood"},
interval = 2,
chance = 100,
action = function(pos)
local airpos = minetest.get_node({x = pos.x, y = (pos.y +1), z = pos.z})
if airpos ~= "default:air" then
minetest.set_node({x=pos.x, y=pos.y +1, z=pos.z}, {name="stairsplus:slab_wood"})
minetest.chat_send_all(airpos)
end
end,
})
kaadmy
Member
Posts: 706 Joined: Thu Aug 27, 2015 23:07
GitHub:
kaadmy
IRC: KaadmY
In-game: KaadmY kaadmy NeD
by kaadmy » Thu Jan 07, 2016 19:17
Post
skyduskguy wrote: actually its not working, shouldnt be placing stuff where something already exists
i changed the type to wood to watch it easier
Code: Select all
minetest.register_abm(
{nodenames = {"default:wood"},
interval = 2,
chance = 100,
action = function(pos)
local airpos = minetest.get_node({x = pos.x, y = pos.y + 1, z = pos.z})
if airpos.name == "default:air" then
minetest.set_node({x = pos.x, y = pos.y + 1, z = pos.z}, {name = "stairsplus:slab_wood"})
end
end
})
Fixed the code for you ;)
Edit: typo
Never paint white stripes on roads near Zebra crossings.
Pixture
skyduskguy
Member
Posts: 14 Joined: Mon Jan 04, 2016 04:16
by skyduskguy » Thu Jan 07, 2016 19:37
Post
nothing seems to be replaced
Code: Select all
minetest.register_abm(
{nodenames = {"default:wood"},
interval = 2,
chance = 1,
action = function(pos)
local airpos = minetest.get_node({x = pos.x, y = pos.y + 1, z = pos.z})
if airpos.name == "default:air" then
print(dump(airpos))
minetest.set_node({x = pos.x, y = pos.y + 1, z = pos.z}, {name = "stairsplus:slab_wood"})
end
end
})
kaadmy
Member
Posts: 706 Joined: Thu Aug 27, 2015 23:07
GitHub:
kaadmy
IRC: KaadmY
In-game: KaadmY kaadmy NeD
by kaadmy » Thu Jan 07, 2016 19:41
Post
skyduskguy wrote: nothing seems to be replaced
[...]
Make the chance = 1.
Never paint white stripes on roads near Zebra crossings.
Pixture
skyduskguy
Member
Posts: 14 Joined: Mon Jan 04, 2016 04:16
by skyduskguy » Thu Jan 07, 2016 19:47
Post
I have, nothing happening in console either
kaadmy
Member
Posts: 706 Joined: Thu Aug 27, 2015 23:07
GitHub:
kaadmy
IRC: KaadmY
In-game: KaadmY kaadmy NeD
by kaadmy » Thu Jan 07, 2016 19:51
Post
Just say
That might work, because air is handled differently than normal nodes.
Never paint white stripes on roads near Zebra crossings.
Pixture
skyduskguy
Member
Posts: 14 Joined: Mon Jan 04, 2016 04:16
by skyduskguy » Thu Jan 07, 2016 19:59
Post
if airpos.name == "air" then
works after you mentioned that i figured id print the airpos dump earlier in the code to see what it was called
you have all been super helpful <3 <3