Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Code Gallery (https://forums.graalonline.com/forums/forumdisplay.php?f=179)
-   -   Pixel Perfect Tile Editor (https://forums.graalonline.com/forums/showthread.php?t=134267103)

0PiX0 09-11-2012 05:21 AM

Pixel Perfect Tile Editor
 
1 Attachment(s)
[VERSION]1.3.0[/VERSION]
Pixel Perfect Tile Editor
Version
  • - 1.3

Features
  • - Relatively easy setup with simple configuration
  • - Works with graal file browser rights system
  • - Scrolls automatically when selecting large portions of the gui
  • - Open, save, and delete tile clipboard files
  • - Undo & redo (Note: history is cleared when the editor closes)
  • - [Toggle] Fade inactive tilelayers
  • - [Toggle] Level grid to separate tiles
  • - [Toggle] Extra cursor info
  • - [Toggle] External window
  • - Create new levels
  • - Flood fill
  • - Automatically checks if there is an update available when the script is initialized
  • - More

Installation
  1. Create a new weapon script named -Development/TileEditor or
    whatever whatever is pleasing to you
  2. Copy the entire text of the pastebin document into the script
  3. Modify the configuration portion of the script to suit your
    server best
  4. Give (npcserver) the required rights
    By default, this includes:
    rw access to TileEditor/Clipboard/ and subfolders,
    rw access to TileEditor/Data/ and subfolders,
    rw access to a levels folder (to create new levels),
    rw access to levels/images/tileeditor_icon_1-1.png ,
    rw access to levels/images/tileeditor_bucket_1-1.png ,
    rw access to levels/images/tileeditor_pencil_1-1.png
    Quote:

    rw TileEditor/Clipboard/*
    rw TileEditor/Clipboard/*/*
    rw TileEditor/Clipboard/*/*/*
    rw TileEditor/Data/*
    rw TileEditor/Data/*/*
    rw TileEditor/Data/*/*/*
    rw levels/levels/*
    rw levels/images/tileeditor_icon_1-1.png
    rw levels/images/tileeditor_bucket_1-1.png
    rw levels/images/tileeditor_pencil_1-1.png
  5. Give level designers necessary rights
    r and/or w access to TileEditor/Clipboard/ and/or
    subfolders, rw access to level files to use this program on
    Quote:

    rw TileEditor/Clipboard/*
    rw TileEditor/Clipboard/*/*
    rw TileEditor/Clipboard/*/*/*
    rw levels/levels/*
  6. Add the weapon script to the level designers

Directions
  • Type /te into the chat bar to open the program
  • Left click to select tiles, right click to paste the selection

Script Interface
- The following clientside public functions are available:
  • open() - triggers the request to open the editor
  • close() - triggers the program to close
  • isOpen() - returns true if the program is open

What's new in 1.3?
  • Improved the grid feature. It now uses different colors to represent modulo offsets of 64, 32, 16, and 8
  • Fixed the use of the default graal rights system on gmaps. It now will not allow any tiles to be placed unless every part of the rectangle is within a level you have WRITE rights to. (It previously required write rights to the .gmap itself)
  • Added a menu item to check for an update within the program at Options->Check for update
  • Other small bug fixes, optimizations, and meaningless changes

http://forums.graalonline.com/forums...1&d=1347329811
Note: tiles in screenshot are just some free tiles found online

Please report any problems or bugs in this thread. I will try to fix it as soon as I have time. Also any suggestions for a future version are welcome! Enjoy!

PASTEBIN

http://pastebin.graalcenter.org/read/6101023324639

Old versions:
1.2
1.1 revision 3

cbk1994 09-11-2012 09:38 AM

Looks nice, good work. Thanks for sharing.

NicoX 09-11-2012 09:42 AM

Good job!

xXziroXx 09-11-2012 01:14 PM

It looks nice. Good job!

callimuc 09-11-2012 06:09 PM

Looks... very interesting!

WanDaMan 09-11-2012 08:25 PM

Brilliant contribution + rep.

0PiX0 09-12-2012 04:01 AM

Thanks for the positive feedback. I hope the editor works well for everyone's purposes. Let me know if you have any problems.

I made a few updates:
  • Automatically checks if there is an update available when the script is initialized
  • [Toggle] Extra cursor info
  • Optimizations and bug fixes to the flood fill algorithm

The original post has been updated with the new version.

Emera 09-12-2012 08:44 AM

Quote:

Originally Posted by 0PiX0 (Post 1703617)
Thanks for the positive feedback. I hope the editor works well for everyone's purposes. Let me know if you have any problems.

I made a few updates:
  • Automatically checks if there is an update available when the script is initialized
  • [Toggle] Extra cursor info
  • Optimizations and bug fixes to the flood fill algorithm

The original post has been updated with the new version.

Fantastic, really good work.

MattKan 09-13-2012 03:35 AM

Was wondering when I'd see this...

It's fantastic :)

0PiX0 09-18-2012 02:07 AM

It's very frustrating that I cannot edit the original post. I plan on doing updates every now and then to this, and I really would like to be able to update my post.

I have come out with a new release: 1.3

http://pastebin.graalcenter.org/read/6101023324639

What's new in this version?
  • Improved the grid feature. It now uses different colors to represent modulo offsets of 64, 32, 16, and 8
  • Fixed the use of the default graal rights system on gmaps. It now will not allow any tiles to be placed unless every part of the rectangle is within a level you have WRITE rights to. (It previously required write rights to the .gmap itself)
  • Added a menu item to check for an update within the program at Options->Check for update
  • Other small bug fixes, optimizations, and meaningless changes

If a moderator could update the original post or allow me access to edit it again, I would be very grateful. The update checking feature of the program will not work if the original post cannot be updated.

Important: If you update the original post, please change the text between [VERSION] and [/VERSION] to 1.3.0 so that the program's update checking works.

Thank you!

cbk1994 09-18-2012 11:47 AM

You can't edit posts after 24 hours, which is really annoying in the Code Gallery. If you ask a moderator, they'll generally do it for you.

Tricxta 09-18-2012 12:32 PM

Nice work pix, I was wondering what you'd been up to.

boolean 09-21-2012 03:08 AM

and it only took 2000 lines of boilerplate code to get a thread that lacks any criticism whatsoever

lol k

0PiX0 09-28-2012 06:59 AM

New Version 1.4
http://pastebin.graalcenter.org/read/92657616352

Here's what's new:
  • File -> Update Level ( immediately saves tile changes to the level file you are currently in )
  • Layer -> Add ( Adds a tilelayer )
  • Layer -> Remove ( Removes a tilelayer. Note that the default client behavior of removing a tilelayer can be very buggy. It's not recommended to remove tilelayers. )
  • Fixed a few problems with rights on gmaps.
  • Other minor fixes and changes as usual

There are changes which must be made to (npcserver) rights. This is the new list of default (npcserver) rights:
Quote:

rw TileEditor/Clipboard/*
rw TileEditor/Clipboard/*/*
rw TileEditor/Clipboard/*/*/*
rw levels/images/tileeditor_icon_1-1.png
rw levels/images/tileeditor_bucket_1-1.png
rw levels/images/tileeditor_pencil_1-1.png
rw levels/*
rw levels/*/*
rw levels/*/*/*
rw levels/*/*/*/*
rw to all levels is required for the these features:
  • Create new levels
  • Force immediate level save
  • Add and remove tilelayers
however, rw to all levels will also be required for future features.

Here's the current goal for version 1.5:
  • View/Edit signs
  • View/Edit level links
  • View/Edit npcs
  • Rename from "Tile Editor" to "Level Editor"

Please report any problems you find. :)

Bam112 10-01-2012 03:04 AM

Nice work! :)

Twinny 10-02-2012 02:54 AM

I would much prefer the option to be able to use your own rights to save levels rather than open up NPC-Server to everything...especially on a server like Testbed :|

0PiX0 10-02-2012 05:06 AM

Quote:

Originally Posted by Twinny (Post 1704939)
I would much prefer the option to be able to use your own rights to save levels rather than open up NPC-Server to everything...especially on a server like Testbed :|

I would prefer that as well, but currently it's not possible. You can certainly still use the editor, but special features won't work without the NPC-Server having rights. I'm aware that it is a security risk, but the servers that aren't worried about that are able to enjoy these features.

savelevel(str) needs to be fixed by Stefan before you will be able to save levels immediately without NPC-Server having rights.

Other special features will probably require NPC-Server rights for a long time. Stefan would have to provide additional functionality. He's already busy as it is, so it won't be soon.

Tim_Rocks 10-02-2012 07:00 AM

He means adding something to the script to check serverside if you actually have the rights to the current level. At least that's what I'm assuming :)

0PiX0 10-02-2012 03:11 PM

Quote:

Originally Posted by Tim_Rocks (Post 1704953)
He means adding something to the script to check serverside if you actually have the rights to the current level. At least that's what I'm assuming :)

It already does that :). He was saying that if he gave the Testbed NPC-Server rw rights to all levels, that it could be abused by malicious scripters. Possibly destroying others' work.

MattKan 10-02-2012 10:38 PM

I have used a level editor that did not require the NPC server to be given rights.

0PiX0 10-03-2012 12:56 AM

Quote:

Originally Posted by MattKan (Post 1704990)
I have used a level editor that did not require the NPC server to be given rights.

The editing of tiles does not require NPC-Server rights.

Draenin 11-06-2012 09:41 PM

1 Attachment(s)
This thing is really nice. However, I'd like to request a feature.


This editor does work on terrain maps as well, but the image of the tiles you currently have selected in the clipboard shows up on the ground quite a bit below where the cursor is, making it offset by a lot and confusing to work with. Would it be possible to include an option to toggle off the clipboard display, or change it so that it also hovers on the screen layer where the mouse is?

Here's a screenshot of what I mean. The cursor position is in red, the clipboard image is in blue.

Cubical 11-19-2012 06:43 AM

I cannot get this to work on a terrain gmap, I have all the correct rights set however when i try to place a tile nothing happens

Draenin 02-20-2013 03:34 AM

I have it working partially on terrain maps, but the icons and tiles stored in the clipboard don't quite play nice when z-height gets involved. I can lay down tiles and save them on terrain maps, but it's awkward.

Also, on another subject... In future versions, could you try to work in something for setting links in levels too? Even if it's a separate tool, that would be fantastic.


And I just wanted to say again, this is excellent work.

MattKan 03-18-2013 10:43 PM

Where are the images for this?

fowlplay4 03-18-2013 11:00 PM

Quote:

Originally Posted by MattKan (Post 1715149)
Where are the images for this?

They're generated by the script. See the long base64 strings near the top of the script.

JohnnyChimpo 09-06-2013 02:19 AM

So i am having trouble with this editor saving.
Problem: When i go to file update level it says that the npcserver does not have read rights to levels/0. The problem seems to be that it can not find the correct filepath. However i modified the script to have the correct filepath and also gave the npcserver rights to that exact file and still i have the same error message. The level does save if i let it sit and after a few seconds it will save on its on.

Let me explain a few things. My levels files are in a folder in the levels folder. ex: levels/mainOW/*
ex: levels/temp/* etc. I gave myself and my npcserver the needed rights, also set savelevels=true in server options.

alissalee 09-06-2013 02:55 PM

Quote:

Originally Posted by JohnnyChimpo (Post 1722350)
So i am having trouble with this editor saving.
Problem: When i go to file update level it says that the npcserver does not have read rights to levels/0. The problem seems to be that it can not find the correct filepath. However i modified the script to have the correct filepath and also gave the npcserver rights to that exact file and still i have the same error message. The level does save if i let it sit and after a few seconds it will save on its on.

Let me explain a few things. My levels files are in a folder in the levels folder. ex: levels/mainOW/*
ex: levels/temp/* etc. I gave myself and my npcserver the needed rights, also set savelevels=true in server options.

please message me on aim jaycassini or msg me on atrius. i had loged on today to see if you were there but you were not on. i would like to see the issue u described.

JohnnyChimpo 09-06-2013 10:11 PM

The problem still persists, if your reading this and own a server, i suggest you take a look into the problem yourself it seems like i am not alone.

Testing the problem:
1. Open /te and put down a tile.
2. Goto File->Update Level.
3. Update the level on your player account by saying "update level"
4. Does the tile stay? Did you get a message after you went to File->Update Level?

If you are having the same problem it could be because of a recent update by Stefan, earlier this week. Please post and let me know.

JohnnyChimpo 09-16-2013 12:40 AM

After further analysis it seems the loadfolder() function is not working properly anymore. I have made a very simple work around for those whos pixel editors are malfunctioning.

1. Add this line to configurations.
PHP Code:

//FOLDER CONFIG
this.levelFolders = {"YourLevelFolder1","YourLevelFolder2"}; 

Add the folders that contain your levels in the array.
2. Replace the function
PHP Code:

function getLevelFilePath(temp.levelName) {
  if(
this.levelFolders.size()>0){
    for(
temp.i=0i<this.levelFolders.size(); i++){
      
temp.fileList = {};
      
temp.fileList.loadfolder("levels/"@this.levelFolders[i]@"/*"1);
        for (
temp.fileNametemp.fileList) {
          if (
temp.fileName == temp.levelName) {
              
temp.filePath this.levelFolders[i]@ "/" temp.fileName;
           return 
temp.filePath;
          }
       }
    } 
  }
  
temp.fileList  = {};
  
temp.fileList.loadfolder("levels/*.nw"1);
  for (
temp.fileNametemp.fileList) {
    if (
temp.fileName == temp.levelName) {
       return 
temp.fileName;
    }
  }
  return 
NULL;



Thats it! Hopefully that solves some headaches.:D

xXziroXx 09-16-2013 12:43 AM

Quote:

Originally Posted by JohnnyChimpo (Post 1722637)
After further analysis it seems the loadfolder() function is not working properly anymore. I have made a very simple work around for those whos pixel editors are malfunctioning.

Thats it! Hopefully that solves some headaches.:D

I installed this script on Maloria two days ago and it was working flawlessly back then. I also just tried loadfolder() and it works like intended. If it doesn't work, it's because you haven't given (npcserver) read rights to said folder.

alissalee 09-16-2013 12:47 AM

ziro i had the same problem to after the update from stefan. npcserver had the rights and so did his.. this glich was just for the update level function in the editor.

sssssssssss 09-21-2013 01:06 PM

We had serious issues with this editor and downloading the level and using gonstruct as well. Using this editor, then going to gonstruct, messed up tile layers somehow, and using gonstruct after this editor left invisible blocking tiles that had to be cleared to continue using gonstruct.

Just FYI. Don't know why we got so unlucky.

Torankusu 09-23-2013 03:56 PM

Quote:

Originally Posted by sssssssssss (Post 1722785)
We had serious issues with this editor and downloading the level and using gonstruct as well. Using this editor, then going to gonstruct, messed up tile layers somehow, and using gonstruct after this editor left invisible blocking tiles that had to be cleared to continue using gonstruct.

Just FYI. Don't know why we got so unlucky.

I personally have found it is best to not even use this editor online if you have added layers via gonstruct.

Unfortunately, I can't contribute more information in my testing, but I do not see layers >0 (listed as 1 in this editor) if I open the editor online, but otherwise they are all there and function properly (even on a gmap) if I do not open the editor.

xXziroXx 09-23-2013 04:44 PM

Quote:

Originally Posted by Torankusu (Post 1722808)
I personally have found it is best to not even use this editor online if you have added layers via gonstruct.

Unfortunately, I can't contribute more information in my testing, but I do not see layers >0 (listed as 1 in this editor) if I open the editor online, but otherwise they are all there and function properly (even on a gmap) if I do not open the editor.

It's not possible to read layers on gmaps by script, which is why I'd only recommend this editor for levels that are not part of a gmap.

MattKan 06-16-2015 03:26 PM

When you do 'update level' to save changes it erases the changes. I remember that there used to be a time when this didn't happen and then Stefan or someone changed something so that you had to wait 2-3 minutes in between levels. Now I'm having no such luck. Has this time been increased even further? Can something be done about it?

fowlplay4 06-16-2015 04:37 PM

Quote:

Originally Posted by MattKan (Post 1736749)
When you do 'update level' to save changes it erases the changes. I remember that there used to be a time when this didn't happen and then Stefan or someone changed something so that you had to wait 2-3 minutes in between levels. Now I'm having no such luck. Has this time been increased even further? Can something be done about it?

Could have a script that reads all the live tile data and saves it to file.

Draenin 06-16-2015 07:03 PM

Quote:

Originally Posted by MattKan
When you do 'update level' to save changes it erases the changes. I remember that there used to be a time when this didn't happen and then Stefan or someone changed something so that you had to wait 2-3 minutes in between levels. Now I'm having no such luck. Has this time been increased even further? Can something be done about it?

A number of people keep running into the problem of levels saving weirdly. I think I know what the cause is.

In serveroptions, if you do 'autosavelevels = true', the server will be saving levels several minutes after they have been updated last. If you are not frequently using the Update Level command as you work, sometimes the level files will get saved automatically by the server, but not updated. If you leave the map or get disconnected, the tiles will look like they have been erased, but sometimes you can recover them by actually chatting 'update level' in the client.

I'm not sure that I've seen a case where using the Update Level command in the editor will accidentally erase tile work, but I'll keep my eyes peeled for that as well. But again, I suspect that server option can interfere with the tile editor.

MysticalDragon 06-16-2015 11:02 PM

Quote:

Originally Posted by MattKan (Post 1736749)
When you do 'update level' to save changes it erases the changes. I remember that there used to be a time when this didn't happen and then Stefan or someone changed something so that you had to wait 2-3 minutes in between levels. Now I'm having no such luck. Has this time been increased even further? Can something be done about it?

We fixed this on delteria, it was a issue where you had to wait a few minutes to save, now there is a actual save button that saves the levels on demand. However Alpho is working on a pretty new level editor concept that uses updating the textfile opposed to using savelevels. Hopefully he will be done with it soon.

MattKan 06-17-2015 06:49 PM

Quote:

Originally Posted by MysticalDragon (Post 1736760)
We fixed this on delteria, it was a issue where you had to wait a few minutes to save, now there is a actual save button that saves the levels on demand.

Are you willing to post the code?


All times are GMT +2. The time now is 07:46 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.