1. NOTE: These forums are no longer used. Please use Discord instead.

[Request/Help]Set blocks at coordinates

Discussion in 'CraftScripts' started by martini002, Jul 14, 2014.

  1. martini002

    martini002 New Member


    I just discovered CraftScripts and this is awesome,
    i have some ideas for start but cant find out some help,
    im not programmer of JS, but i have knowledges with this.

    May you guys can help me to start?

    I want to set Block Id 101 at coordinates 1,0,0 / 1,0,0
    and Block Id 76 at 0,1,0 / 0,1,0
    if these blocks are set then remove them.
    How can i do that?

    I was reading this http://wiki.sk89q.com/wiki/WorldEdit/Scripting
    but cant sucess with this yet.

  2. sk89q

    sk89q Administrator Developer

    Code (Text):
    var sess = context.remember();
    sess.setBlock(origin.add(1, 0, 0), new BaseBlock(101));
    sess.setBlock(origin.add(0, 1, 0), new BaseBlock(76));
  3. Ed Greenberg

    Ed Greenberg New Member

    In sk's code above, where is origin defined? I'm trying to figure out how to define a point from actual coordinates. The examples all initialize origin with player.getBlockOn or In.

    Thanks, Ed G
  4. wizjany

    wizjany Administrator Developer

    new Vector(x, y, z)
  5. Ed Greenberg

    Ed Greenberg New Member

    Thank you. I was doing x=Vector(x,y,z). I think I was stuck in Python :) This is really useful and enjoyable. Thanks to the developer. Also thanks for the very quick response.