I have a Problem to put two variables in one

User avatar
yves_de_beck
Member
 
Posts: 65
Joined: Wed Jan 02, 2013 10:45

I have a Problem to put two variables in one

by yves_de_beck » Mon Jan 21, 2013 12:22

Hallo all,

Perhaps someone have an idea to fix my problem:

I make some experiments with the nodebox value.


I want make from two variables one:

My Example:
variable1 = {abcabc}
variable2 = {xyzxyz}

varibalenew = variable1 variable2

--> output of 'variablenew' should be -> {abcabc}{xyzxyz}

I have tryed all. It won't work =(



this is my code:

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
math.randomseed(os.time())
local detail = 16
local testnoc = {}
local testbox1 = {}
local testbox2 = {}

for i = 0, detail-1 do
    hoehe = math.random (0,5)
    testbox1[i+1]={-0.5, -0.5, (i/detail)-0.5, -0.5+(1/detail), hoehe*0.1, (i/detail)-0.5+(1/detail)}
    hoehe = math.random (0,5)
    testbox2[i+1]={-0.5+(1/detail), -0.5, (i/detail)-0.5, -0.5+(2*(1/detail)), hoehe*0.1, (i/detail)-0.5+(1/detail)}
end


local testbox = testbox1, testbox2   


minetest.register_node("test:test_object2", {
    description = "TEST OBJECT2",
    drawtype = "nodebox",
    tiles = {"default_desert_sand.png"},
    paramtype = "light",
    paramtype2 = "facedir",
    walkable = true,
    selection_box = {
        type = "fixed",
        fixed = {-0.5,-0.5,-0.5,0.5,0.5,0.5},
    },
    node_box = {
        type = "fixed",
        fixed = testbox,
    },
    groups = {snappy=1,choppy=2,oddly_breakable_by_hand=3,flammable=2},
})



Now it works without an error, but in the var 'testbox' is only the value of 'testbox1'.

Wat i'm doing wrong???
Last edited by yves_de_beck on Mon Jan 21, 2013 12:23, edited 1 time in total.
 

User avatar
kaeza
Member
 
Posts: 2141
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza

by kaeza » Mon Jan 21, 2013 12:27

Try something like 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
math.randomseed(os.time())
local detail = 16
local testnoc = {}
local testbox = {}

for i = 0, detail-1, 2 do
    hoehe = math.random (0,5)
    testbox[i+1]={-0.5, -0.5, (i/detail)-0.5, -0.5+(1/detail), hoehe*0.1, (i/detail)-0.5+(1/detail)}
    hoehe = math.random (0,5)
    testbox[i+2]={-0.5+(1/detail), -0.5, (i/detail)-0.5, -0.5+(2*(1/detail)), hoehe*0.1, (i/detail)-0.5+(1/detail)}
end

minetest.register_node("test:test_object2", {
    description = "TEST OBJECT2",
    drawtype = "nodebox",
    tiles = {"default_desert_sand.png"},
    paramtype = "light",
    paramtype2 = "facedir",
    walkable = true,
    selection_box = {
        type = "fixed",
        fixed = {-0.5,-0.5,-0.5,0.5,0.5,0.5},
    },
    node_box = {
        type = "fixed",
        fixed = testbox,
    },
    groups = {snappy=1,choppy=2,oddly_breakable_by_hand=3,flammable=2},
})
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 | BTC: 1DFZAa5VtNG7Levux4oP6BuUzr1e83pJK2
 

User avatar
yves_de_beck
Member
 
Posts: 65
Joined: Wed Jan 02, 2013 10:45

by yves_de_beck » Mon Jan 21, 2013 12:40

kaeza wrote:Try something like 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
math.randomseed(os.time())
local detail = 16
local testnoc = {}
local testbox = {}

for i = 0, detail-1, 2 do
    hoehe = math.random (0,5)
    testbox[i+1]={-0.5, -0.5, (i/detail)-0.5, -0.5+(1/detail), hoehe*0.1, (i/detail)-0.5+(1/detail)}
    hoehe = math.random (0,5)
    testbox[i+2]={-0.5+(1/detail), -0.5, (i/detail)-0.5, -0.5+(2*(1/detail)), hoehe*0.1, (i/detail)-0.5+(1/detail)}
end

minetest.register_node("test:test_object2", {
    description = "TEST OBJECT2",
    drawtype = "nodebox",
    tiles = {"default_desert_sand.png"},
    paramtype = "light",
    paramtype2 = "facedir",
    walkable = true,
    selection_box = {
        type = "fixed",
        fixed = {-0.5,-0.5,-0.5,0.5,0.5,0.5},
    },
    node_box = {
        type = "fixed",
        fixed = testbox,
    },
    groups = {snappy=1,choppy=2,oddly_breakable_by_hand=3,flammable=2},
})




Wooooow thank you for the very fast answer kaeza!!!! =) =)

I've tested it.... and it works.

Super!!
Last edited by yves_de_beck on Mon Jan 21, 2013 12:41, edited 1 time in total.
 

User avatar
kaeza
Member
 
Posts: 2141
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza

by kaeza » Mon Jan 21, 2013 13:05

yves_de_beck wrote:Wooooow thank you for the very fast answer kaeza!!!! =) =)

I've tested it.... and it works.

Super!!

You're welcome :)
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 | BTC: 1DFZAa5VtNG7Levux4oP6BuUzr1e83pJK2
 


Return to WIP Mods

Who is online

Users browsing this forum: Google [Bot] and 10 guests

cron