Can a ABM?

User avatar
Jordach
Member
 
Posts: 4412
Joined: Mon Oct 03, 2011 17:58
GitHub: Jordach
IRC: Jordach
In-game: Jordach

Can a ABM?

by Jordach » Thu Apr 19, 2012 16:48

ABM change a node to a random node, such as node:alpha_1 to node:alpha_5 and then node:alpha_3 ??

Making a TV is really hard.
Last edited by Jordach on Thu Apr 19, 2012 16:49, edited 1 time in total.

( ͡° ͜ʖ ͡°) ( ͡o ͜ʖ ͡o) [$ ( ͡° ͜ʖ ͡°) $] ( ͡$ ͜ʖ ͡$) ヽ༼ຈل͜ຈ༽ノ



My image and media server is back online and is functioning as normal.
 

User avatar
sfan5
Member
 
Posts: 3636
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5

by sfan5 » Thu Apr 19, 2012 16:50

Yep
Mods: Mesecons | WorldEdit | Nuke
Minetest builds for Windows (32-bit & 64-bit)
 

User avatar
Jordach
Member
 
Posts: 4412
Joined: Mon Oct 03, 2011 17:58
GitHub: Jordach
IRC: Jordach
In-game: Jordach

by Jordach » Thu Apr 19, 2012 16:50

Awesome? Care to share?

As in:

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_abm(
        {nodenames = {"default:test_1"},
        interval = 0,
        chance = 1,
        action = function(pos)
                minetest.env:add_node(pos, {name="default:test_.math.random(1,10)"})
        end,
})
Last edited by Jordach on Thu Apr 19, 2012 16:54, edited 1 time in total.

( ͡° ͜ʖ ͡°) ( ͡o ͜ʖ ͡o) [$ ( ͡° ͜ʖ ͡°) $] ( ͡$ ͜ʖ ͡$) ヽ༼ຈل͜ຈ༽ノ



My image and media server is back online and is functioning as normal.
 

User avatar
mauvebic
Member
 
Posts: 1550
Joined: Fri Jan 27, 2012 11:32

by mauvebic » Thu Apr 19, 2012 16:57

look at my trafficlights
"Fuck the hat." - Paulie Gualtieri
 

User avatar
Jordach
Member
 
Posts: 4412
Joined: Mon Oct 03, 2011 17:58
GitHub: Jordach
IRC: Jordach
In-game: Jordach

by Jordach » Thu Apr 19, 2012 16:58

I need something like math.random(1,10) to change the nodes around, kddkadenz's desert mod is helping.

( ͡° ͜ʖ ͡°) ( ͡o ͜ʖ ͡o) [$ ( ͡° ͜ʖ ͡°) $] ( ͡$ ͜ʖ ͡$) ヽ༼ຈل͜ຈ༽ノ



My image and media server is back online and is functioning as normal.
 

User avatar
mauvebic
Member
 
Posts: 1550
Joined: Fri Jan 27, 2012 11:32

by mauvebic » Thu Apr 19, 2012 17:09

what are you trying to do?
"Fuck the hat." - Paulie Gualtieri
 

User avatar
Jordach
Member
 
Posts: 4412
Joined: Mon Oct 03, 2011 17:58
GitHub: Jordach
IRC: Jordach
In-game: Jordach

by Jordach » Thu Apr 19, 2012 17:13

Do something really clever.

( ͡° ͜ʖ ͡°) ( ͡o ͜ʖ ͡o) [$ ( ͡° ͜ʖ ͡°) $] ( ͡$ ͜ʖ ͡$) ヽ༼ຈل͜ຈ༽ノ



My image and media server is back online and is functioning as normal.
 

User avatar
Jordach
Member
 
Posts: 4412
Joined: Mon Oct 03, 2011 17:58
GitHub: Jordach
IRC: Jordach
In-game: Jordach

by Jordach » Thu Apr 19, 2012 17:20

I just found the answer I hope.

( ͡° ͜ʖ ͡°) ( ͡o ͜ʖ ͡o) [$ ( ͡° ͜ʖ ͡°) $] ( ͡$ ͜ʖ ͡$) ヽ༼ຈل͜ຈ༽ノ



My image and media server is back online and is functioning as normal.
 

User avatar
Jordach
Member
 
Posts: 4412
Joined: Mon Oct 03, 2011 17:58
GitHub: Jordach
IRC: Jordach
In-game: Jordach

by Jordach » Thu Apr 19, 2012 17:30

I needed to use 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
local i = math.random(1,10)

if i = 1 then
    minetest.env:add_node(pos, {node:generic})


This under a ABM plus 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_abm(
        {nodenames = {"tv:screen_1", "tv:screen_2", "tv:screen_3", "tv:screen_4", "tv:screen_5", "tv:screen_6", "tv:screen_7", "tv:screen_8", "tv:screen_9", "tv:screen_10"},


Is how I almost got it to work. This has not BEEN TESTED, WILL GIVE A RELEASE ON GIT SOON.

( ͡° ͜ʖ ͡°) ( ͡o ͜ʖ ͡o) [$ ( ͡° ͜ʖ ͡°) $] ( ͡$ ͜ʖ ͡$) ヽ༼ຈل͜ຈ༽ノ



My image and media server is back online and is functioning as normal.
 

User avatar
mauvebic
Member
 
Posts: 1550
Joined: Fri Jan 27, 2012 11:32

by mauvebic » Thu Apr 19, 2012 17:35

you want a tv that flickers between channels?
"Fuck the hat." - Paulie Gualtieri
 

User avatar
Jordach
Member
 
Posts: 4412
Joined: Mon Oct 03, 2011 17:58
GitHub: Jordach
IRC: Jordach
In-game: Jordach

by Jordach » Thu Apr 19, 2012 17:37

No no. But I am almost done. Just add textures.

( ͡° ͜ʖ ͡°) ( ͡o ͜ʖ ͡o) [$ ( ͡° ͜ʖ ͡°) $] ( ͡$ ͜ʖ ͡$) ヽ༼ຈل͜ຈ༽ノ



My image and media server is back online and is functioning as normal.
 

User avatar
Jordach
Member
 
Posts: 4412
Joined: Mon Oct 03, 2011 17:58
GitHub: Jordach
IRC: Jordach
In-game: Jordach

by Jordach » Thu Apr 19, 2012 17:49

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
local i = math.random(1,10)

if i== 1 then
    minetest.env:add_node(pos, {node:generic})
    end
end


This makes an error, and function is (pos) what is my error.

( ͡° ͜ʖ ͡°) ( ͡o ͜ʖ ͡o) [$ ( ͡° ͜ʖ ͡°) $] ( ͡$ ͜ʖ ͡$) ヽ༼ຈل͜ຈ༽ノ



My image and media server is back online and is functioning as normal.
 

User avatar
mauvebic
Member
 
Posts: 1550
Joined: Fri Jan 27, 2012 11:32

by mauvebic » Thu Apr 19, 2012 17:57

you seem to have an extra 'end' statement
"Fuck the hat." - Paulie Gualtieri
 

User avatar
mauvebic
Member
 
Posts: 1550
Joined: Fri Jan 27, 2012 11:32

by mauvebic » Thu Apr 19, 2012 17:59

Jordach wrote: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
    minetest.env:add_node(pos, {node:generic})




try this instead:
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.env:add_node(pos,{type="node",name='node:generic'})
Last edited by mauvebic on Thu Apr 19, 2012 18:02, edited 1 time in total.
"Fuck the hat." - Paulie Gualtieri
 

User avatar
Jordach
Member
 
Posts: 4412
Joined: Mon Oct 03, 2011 17:58
GitHub: Jordach
IRC: Jordach
In-game: Jordach

by Jordach » Thu Apr 19, 2012 18:06

Keeps on saying: function arguments expected near '}'

No code change.
Last edited by Jordach on Thu Apr 19, 2012 18:07, edited 1 time in total.

( ͡° ͜ʖ ͡°) ( ͡o ͜ʖ ͡o) [$ ( ͡° ͜ʖ ͡°) $] ( ͡$ ͜ʖ ͡$) ヽ༼ຈل͜ຈ༽ノ



My image and media server is back online and is functioning as normal.
 

User avatar
mauvebic
Member
 
Posts: 1550
Joined: Fri Jan 27, 2012 11:32

by mauvebic » Thu Apr 19, 2012 18:07

if you know which line the errors happenning on post that portion of the code, else post the whole thing and ill take a look

looks more like a LUA syntax/typo thing than a modding API thing
Last edited by mauvebic on Thu Apr 19, 2012 18:08, edited 1 time in total.
"Fuck the hat." - Paulie Gualtieri
 

User avatar
Jordach
Member
 
Posts: 4412
Joined: Mon Oct 03, 2011 17:58
GitHub: Jordach
IRC: Jordach
In-game: Jordach

by Jordach » Thu Apr 19, 2012 18:10

mauvebic wrote:if you know which line the errors happenning on post that portion of the code, else post the whole thing and ill take a look

looks more like a LUA syntax/typo thing than a modding API thing

Email sent.

( ͡° ͜ʖ ͡°) ( ͡o ͜ʖ ͡o) [$ ( ͡° ͜ʖ ͡°) $] ( ͡$ ͜ʖ ͡$) ヽ༼ຈل͜ຈ༽ノ



My image and media server is back online and is functioning as normal.
 

User avatar
mauvebic
Member
 
Posts: 1550
Joined: Fri Jan 27, 2012 11:32

by mauvebic » Thu Apr 19, 2012 18:10

in debug.txt it should tell you which line is causing the problem
"Fuck the hat." - Paulie Gualtieri
 

User avatar
Jordach
Member
 
Posts: 4412
Joined: Mon Oct 03, 2011 17:58
GitHub: Jordach
IRC: Jordach
In-game: Jordach

by Jordach » Thu Apr 19, 2012 18:11

Mail sent.

( ͡° ͜ʖ ͡°) ( ͡o ͜ʖ ͡o) [$ ( ͡° ͜ʖ ͡°) $] ( ͡$ ͜ʖ ͡$) ヽ༼ຈل͜ຈ༽ノ



My image and media server is back online and is functioning as normal.
 

User avatar
mauvebic
Member
 
Posts: 1550
Joined: Fri Jan 27, 2012 11:32

by mauvebic » Thu Apr 19, 2012 18:12

line 130: you have a comma after end
"Fuck the hat." - Paulie Gualtieri
 

User avatar
Jordach
Member
 
Posts: 4412
Joined: Mon Oct 03, 2011 17:58
GitHub: Jordach
IRC: Jordach
In-game: Jordach

by Jordach » Thu Apr 19, 2012 18:14

Changed that, nothing doing.

( ͡° ͜ʖ ͡°) ( ͡o ͜ʖ ͡o) [$ ( ͡° ͜ʖ ͡°) $] ( ͡$ ͜ʖ ͡$) ヽ༼ຈل͜ຈ༽ノ



My image and media server is back online and is functioning as normal.
 

User avatar
mauvebic
Member
 
Posts: 1550
Joined: Fri Jan 27, 2012 11:32

by mauvebic » Thu Apr 19, 2012 18:15

and in
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
{name=tv:screen_1}


should be

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
{name="tv:screen_1"}
"Fuck the hat." - Paulie Gualtieri
 

User avatar
Jordach
Member
 
Posts: 4412
Joined: Mon Oct 03, 2011 17:58
GitHub: Jordach
IRC: Jordach
In-game: Jordach

by Jordach » Thu Apr 19, 2012 18:18

It works!

( ͡° ͜ʖ ͡°) ( ͡o ͜ʖ ͡o) [$ ( ͡° ͜ʖ ͡°) $] ( ͡$ ͜ʖ ͡$) ヽ༼ຈل͜ຈ༽ノ



My image and media server is back online and is functioning as normal.
 

User avatar
mauvebic
Member
 
Posts: 1550
Joined: Fri Jan 27, 2012 11:32

by mauvebic » Thu Apr 19, 2012 18:24

try 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
--Tv Mod, by Jordan Snelling 2012.
--Mauvebic, did I miss anything, or get anything wrong?

minetest.register_node("tv:screen_1", {
    description = "TV",
    tile_images = {"tv_screen_1.png"},
    is_ground_content = true,
    groups = {snappy=1,bendy=2,cracky=1,melty=2,level=2},
    drop = 'tv:screen_1',
})

minetest.register_node("tv:screen_2", {
    description = "TV",
    tile_images = {"tv_screen_2.png"},
    is_ground_content = true,
    groups = {snappy=1,bendy=2,cracky=1,melty=2,level=2},
    drop = 'tv:screen_1',
})

minetest.register_node("tv:screen_3", {
    description = "TV",
    tile_images = {"tv_screen_3.png"},
    is_ground_content = true,
    groups = {snappy=1,bendy=2,cracky=1,melty=2,level=2},
    drop = 'tv:screen_1',
})

minetest.register_node("tv:screen_4", {
    description = "TV",
    tile_images = {"tv_screen_4.png"},
    is_ground_content = true,
    groups = {snappy=1,bendy=2,cracky=1,melty=2,level=2},
    drop = 'tv:screen_1',
})

minetest.register_node("tv:screen_5", {
    description = "TV",
    tile_images = {"tv_screen_5.png"},
    is_ground_content = true,
    groups = {snappy=1,bendy=2,cracky=1,melty=2,level=2},
    drop = 'tv:screen_1',
})

minetest.register_node("tv:screen_6", {
    description = "TV",
    tile_images = {"tv_screen_6.png"},
    is_ground_content = true,
    groups = {snappy=1,bendy=2,cracky=1,melty=2,level=2},
    drop = 'tv:screen_1',
})

minetest.register_node("tv:screen_7", {
    description = "TV",
    tile_images = {"tv_screen_7.png"},
    is_ground_content = true,
    groups = {snappy=1,bendy=2,cracky=1,melty=2,level=2},
    drop = 'tv:screen_1',
})

minetest.register_node("tv:screen_8", {
    description = "TV",
    tile_images = {"tv_screen_8.png"},
    is_ground_content = true,
    groups = {snappy=1,bendy=2,cracky=1,melty=2,level=2},
    drop = 'tv:screen_1',
})

minetest.register_node("tv:screen_9", {
    description = "TV",
    tile_images = {"tv_screen_9.png"},
    is_ground_content = true,
    groups = {snappy=1,bendy=2,cracky=1,melty=2,level=2},
    drop = 'tv:screen_1',
})
minetest.register_node("tv:screen_10", {
    description = "TV",
    tile_images = {"tv_screen_10.png"},
    is_ground_content = true,
    groups = {snappy=1,bendy=2,cracky=1,melty=2,level=2},
    drop = 'tv:screen_1',
})

minetest.register_abm({
        nodenames = { "startrek:viewscreen" },
        interval = 3,
        chance = 3,
       
        action = function(pos, node, active_object_count, active_object_count_wider)
            minetest.env:add_node({x=pos.x,y=pos.y,z=pos.z},{type="node",name="startrek:viewscreenoff"})
        end
})
minetest.register_abm(
    {nodenames = {"tv:screen_1", "tv:screen_2", "tv:screen_3", "tv:screen_4", "tv:screen_5", "tv:screen_6", "tv:screen_7", "tv:screen_8", "tv:screen_9", "tv:screen_10"},
    interval = 2000,
    chance = 200,
    action = function(pos)
        local i = math.random(1,10)
       
            if i== 1 then
                minetest.env:add_node(pos,{type="node",name="tv:screen_1"})
       
            elseif i== 2 then
                minetest.env:add_node(pos,{type="node",name="tv:screen_2"})

            elseif i== 3 then
                minetest.env:add_node(pos,{type="node",name="tv:screen_3"})
       
            elseif i== 4 then
                minetest.env:add_node(pos,{type="node",name="tv:screen_4"})
       
            elseif i== 5 then
                minetest.env:add_node(pos,{type="node",name="tv:screen_5"})

            elseif i== 6 then
                minetest.env:add_node(pos,{type="node",name="tv:screen_6"})
       
            elseif i== 7 then
                minetest.env:add_node(pos,{type="node",name="tv:screen_7"})
       
            elseif i== 8 then
                minetest.env:add_node(pos,{type="node",name="tv:screen_8"})
       
            elseif i== 9 then
                minetest.env:add_node(pos,{type="node",name="tv:screen_9"})
       
            elseif i== 10 then
                minetest.env:add_node(pos,{type="node",name="tv:screen_10"})
            end
       
        end
})
"Fuck the hat." - Paulie Gualtieri
 

User avatar
Jordach
Member
 
Posts: 4412
Joined: Mon Oct 03, 2011 17:58
GitHub: Jordach
IRC: Jordach
In-game: Jordach

by Jordach » Thu Apr 19, 2012 18:28

Just made the changes by hand, they work.

( ͡° ͜ʖ ͡°) ( ͡o ͜ʖ ͡o) [$ ( ͡° ͜ʖ ͡°) $] ( ͡$ ͜ʖ ͡$) ヽ༼ຈل͜ຈ༽ノ



My image and media server is back online and is functioning as normal.
 

User avatar
mauvebic
Member
 
Posts: 1550
Joined: Fri Jan 27, 2012 11:32

by mauvebic » Thu Apr 19, 2012 18:31

yeah you had a syntax error here:

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.env:add_node(pos,{type="node",name="tv:screen_5"))


shoulda been:

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.env:add_node(pos,{type="node",name="tv:screen_5"})
"Fuck the hat." - Paulie Gualtieri
 

User avatar
Jordach
Member
 
Posts: 4412
Joined: Mon Oct 03, 2011 17:58
GitHub: Jordach
IRC: Jordach
In-game: Jordach

by Jordach » Thu Apr 19, 2012 18:32

Actually, you don't need the type="node", this seems to check whether the drawtype is, a cube, sign fence post and what not.

( ͡° ͜ʖ ͡°) ( ͡o ͜ʖ ͡o) [$ ( ͡° ͜ʖ ͡°) $] ( ͡$ ͜ʖ ͡$) ヽ༼ຈل͜ຈ༽ノ



My image and media server is back online and is functioning as normal.
 

User avatar
mauvebic
Member
 
Posts: 1550
Joined: Fri Jan 27, 2012 11:32

by mauvebic » Thu Apr 19, 2012 18:37

thats prolly right, half my mods have register crafts that use node "themod:thenode" and the other half use simply themod:thenode
"Fuck the hat." - Paulie Gualtieri
 

User avatar
Jordach
Member
 
Posts: 4412
Joined: Mon Oct 03, 2011 17:58
GitHub: Jordach
IRC: Jordach
In-game: Jordach

by Jordach » Thu Apr 19, 2012 18:40

I set the interval and chance to 1, 1. They shuffled like dice!

( ͡° ͜ʖ ͡°) ( ͡o ͜ʖ ͡o) [$ ( ͡° ͜ʖ ͡°) $] ( ͡$ ͜ʖ ͡$) ヽ༼ຈل͜ຈ༽ノ



My image and media server is back online and is functioning as normal.
 

User avatar
mauvebic
Member
 
Posts: 1550
Joined: Fri Jan 27, 2012 11:32

by mauvebic » Thu Apr 19, 2012 18:41

allright but keep in mind, the more of your nodes are in the game, the more FPS intense the abms get.
"Fuck the hat." - Paulie Gualtieri
 

Next

Return to WIP Mods

Who is online

Users browsing this forum: No registered users and 6 guests

cron