Saving Blocks

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

MusicManSK

Active Member
Nov 30, 2017
230
11
18
Hello!
im trying to make skript which will save blocks somewhere and then i can recover it.. its works good.. i made it.. but its saving to variables and there is 1000000 blocks and thats 1000000 variables and skript cant work.. (variables file has 4GB).. so.. where i should save that blocks? i tried to save it to some file but it took very long time to write and server has error "Server stop responding" or "Time out"..so i dont know how to make it.. i need it for minigames to reseting worlds and areas..
my code:
code_language.skript:
function BlockSave(game: text, pos1: location, pos2: location):
    set {_blocks} to 0
    delete file "plugins\\BlockSaver\\%{_game}%.txt"
    wait 1 tick
    create file "plugins\\BlockSaver\\%{_game}%.txt"
    loop blocks within {_pos1} and {_pos2}:
        add 1 to {_blocks}
        write "%loop-block%" at line {_blocks} to file "plugins\\BlockSaver\\%{_game}%.txt"
        broadcast "q"
        wait 1 tick
    broadcast "c"
    loop all players:
        if name of loop-player is "MataxePlay":
            send "&8[&cBlockSaver&8] &e%{_blocks}% &bblocks has been saved to &e""plugins\\BlockSaver\\%{_game}%.txt""&b!" to loop-player
            stop
    
function BlockLoad(game: text, pos1: location, pos2: location):
    set {_blocks} to 0
    loop blocks within {_pos1} and {_pos2}:
        add 1 to {_blocks}
        set {_text} to file "plugins\\BlockSaver\\%{_game}%.txt"'s line {_blocks}
        set loop-block to {_text}
    loop all players:
        if name of loop-player is "MataxePlay":
            send "&8[&cBlockSaver&8] &e%{_blocks}% &bblocks has been restored from &e""plugins\\BlockSaver\\%{_game}%.txt""&b!" to loop-player
            stop
 
hmm.. good idea but i am never before using schematics and if i may be honest i havent known that WG supports schematics
 
ohhh.. i can do it directly from skript without executing commans? it perfect! Ok ill try it later because im doing another minigame in this time... (which not contains changing map)
[doublepost=1526751071,1526750994][/doublepost]@TPGamesNL nevermind.. im need it to work.. it can be for citizens.. but it must work.. and then its OK :emoji_grinning:
 
@ShaneBee that's all for WorldEdit, not WorldGuard
oh god stupid me, haha! Im not sure why i said world guard...
yeah, world edit :emoji_slight_smile: Thanks. I guess because the two are basically used together i get them mixed up

ohhh.. i can do it directly from skript without executing commans? it perfect! Ok ill try it later because im doing another minigame in this time... (which not contains changing map)
[doublepost=1526751071,1526750994][/doublepost]@TPGamesNL nevermind.. im need it to work.. it can be for citizens.. but it must work.. and then its OK :emoji_grinning:
Yeah.. you can do it all within script, its pretty awesome.
i think the only thing I did in game was select the region i wanted to save, and saved the schematic, the rest was done using my skript.
 
correct.
Im sure you can save a WE region using skript, i just didn't do it that way, because i basically had to be in game to see the boundaries anyways.
 
yes.. and may be good because i can make game region in skript and it would be used for game(death line) but to WE too.. ok.. its amazing.. thanks
 
Status
Not open for further replies.