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

Need some help making a script

Discussion in 'CraftScripts' started by Zanaria, Mar 23, 2014.

  1. Zanaria

    Zanaria New Member

    I have some knowledge of javascript and have programmed in it before, but I was thinking of trying to make a script to solve a little problem I was having with Worldedit. That problem of course was the editing of large areas at a time. I know there is a plugin or two for servers that solve the problem, but unfortunately every solution to the problem I found was for servers and I am just looking for single player.

    Anyway I have been letting my programming skills slide a bit lately so I figured I would try this to get some practice. I already have an idea of how it would work, but there are a few things I need to know first. Those would be: How do you make use of the position selected? And how would you make use of Worldedit's set command? And also is there a way to make the process delay before repeating?

    Currently thinking of the arguments being the block type (which could be just hard coded for air since I am planning to use it to clear large amounts of land but for usability it can be passed in), the number of blocks to go in, the directions to go in, and how high up and down to go.

    Like for example if I wanted to clear a 50x50 area north and east of the selection I would put the arguments in like: 0 50 50 n e

    That would clear the area at the level of the selection going over 1 block at a time but if I put in: 0 50 50 n e 10 0 then it would expand the selection 10 up and do the same thing, clearing all the blocks at the level of the selection and 10 above it.

    I was looking at the maze script and have a few ideas about it, and I noticed the API for Worldedit as well, but I have always had a little trouble understanding the APIs.

    (Note not asking someone to make the script, I am pretty sure I can, though if someone else wants to, or if there is already one like this then feel free to direct me to it. ^.^)
  2. Zanaria

    Zanaria New Member

    So can no one help me out with this? I don't do well with APIs, I find it much easier to learn how to do something by seeing a simple example, which is something that most APIs I have seen lack.
  3. PseudoKnight

    PseudoKnight Well-Known Member Developer

    "editing of large areas"
    "single player"

    Sorry that this isn't a direct response, but why not use MCEdit when the edit's going to be too big for your computer to handle? It's singleplayer already. All map makers do this.

    Queueing is on its way into WorldEdit proper, but who knows how long that'll take. I imagine the difficulty is maintaining a proper history when doing that.
  4. Zanaria

    Zanaria New Member

    Well as I said, I am getting a bit rusty on my programming and wanted to try this out. I know that it is possible of course.

    As for using MCEdit, as far as I am aware it doesn't display mods, so if I built something with it then it would be just vanilla whereas with Worldedit I could place mod blocks too.
  5. PseudoKnight

    PseudoKnight Well-Known Member Developer

    Both MCEdit and WorldEdit should treat mods the same.. as in they don't care. It'll still work with them, as long as they don't need special treatment. But ya, MCEdit uses a different rendering engine.

    Most of those questions could be found in other scripts in this forum, except probably the process delay, which might break history and other things.
  6. Zanaria

    Zanaria New Member

    But MCEdit is an external program though, unless I am thinking of something else. So how would it show mod items?
  7. PseudoKnight

    PseudoKnight Well-Known Member Developer

    I believe it'd show it as a generic block, but it'd be able to copy and move around those blocks. I don't use those mods, so I can't tell you for sure. Why not try it yourself? There are some benefits to using MCEdit over WorldEdit. Some things you just can't do in a live game and a limited API.
  8. Zanaria

    Zanaria New Member

    I have used MCEdit before, that's why I knew about it. But the point is that using something that doesn't work with mods is completely useless when you are trying to build with mods. You would just have to destroy it in game and rebuild it with things from the mods. And if that's the case then it's no different than just building it manually in game.

    I know very well that what I am looking for is possible with world edit and scripting, the maze script is actually more advanced than what I am thinking of. But I cant very well make what I am thinking of if I don't know how to do it, and unfortunately for me APIs do not provide enough information or examples to show me how to do something.
  9. Robert Snead

    Robert Snead New Member

    Some features in worldedit have the expand feature which will expand the current selection of your region in any direction, as well as shifting or removing part of the selection. You can then use the set command to clear the area(eg. //set air). Also my scripts do have examples of compare and set use in worldedit, as well as how to grab and use the points you have declared. You will have to hard code the set and get using vectors, you can also expand from the current selection. Also check out setTimeout method in javascript to delay your function calls. Hope this helps!