Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > Code Gallery
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 04-26-2011, 08:10 AM
MrOmega MrOmega is offline
One More Time
MrOmega's Avatar
Join Date: Aug 2010
Location: TN, USA
Posts: 631
MrOmega is an unknown quantity at this point
Send a message via AIM to MrOmega Send a message via MSN to MrOmega Send a message via Yahoo to MrOmega
Omega's Tile Editor

Well, I made this as an experiment to test my abilities. You all will probably be pissed, cause in fact it is a tile Editor. :P But I think mine is somewhat unique, maybe not to you, but I'm satisfied with it currently. Maybe when my server needs some of the features in the to-do list, I will add them. But for now, I'm not worried about them. If anyone wants to go ahead and add the features. Also, I have attached my server's current tileset, you can use it on your server, just give recognition appropriately.

I think my favorite achievement was keeping this under 1000 lines. :P

But here's the break down in the top of the file.

PHP Code:
/***********************************************************
                 _____________________
                |                     |
                | OMEGA's Tile Editor |
                |_____________________|
  
  HOW TO USE :
  
    Simply, click and drag your mouse to select tiles either 
    on the Tileset Image, Prefabricated object, or the Graal 
    Screen to select tiles. If tileset tiles are selected, 
    just move your mouse into the Graal Screen and left-mouse 
    click to place them, same with prefabricated tiles. When 
    Graal Screen tiles are select you can either move them by 
    left clicking and moving the mouse. ( The fill tile will 
    replace where these tiles were) You can also right-click 
    to copy these tiles and move your mouse where want these
    tiles to be. You can place by either mouse button. Middle-
    mouse scroll button will scroll through the layers and 
    pushing the middle mouse button will toggle the layer fade.

  Functonality :
  
    - Layer Support 
        Can edit Layers, 0 through 10, by either typing in 
        the layer Number or using the +/- buttons.
    - Flood Fill
        Can flood fill, large areas may/can lag though. Fill
        tile can be seen in the top-left.
    - Delete Fill
        Pressing either, delete or backspace, while level 
        tiles are select will replace currently selected tile 
        with fill tile.
    - Update Button
        Sends a command to the NPC-Control, to update your
        current level.
    - PreFab Button
        Opens a list of object that you can add to your 
        level. You can also, add or delete these objects.
    - Fade Layers
        You can fade the layers to see what's on the current 
        layer.
    - Grid Effect
        Draws a grid so you can see where each tile is.
    - Show/Hide NPCs
        If checked, NPC's will be shown, otherwise all NPCs
        will hidden.
    - External capabilities
        If checked, the Tile Editor will be directed to an 
        external window, allowing an unobstructed editing
        area.
    - Get Tile Array
        Button in the bottom-right will be active when you 
        have tiles selcted. Click to make the NPC-Control 
        PM you both a line-style array of the current 
        selected tiles and a block-style array of the 
        current selected tiles, in hexadecimal.
        
  OTHER FEATURES :
  
    - Name of the current level you can edit is displayed 
      in the title of the editor.
    - Displays either level coordinates or Tileset 
      coordinates in the bottom-left of editor. Depending 
      on what you mouse over.
    - Also, displays both the Decimal and Hexadecimal value
      of the tile your mouse is currently over.
    - Shows width and height (in tiles) of the selection.
    - Shows current tile in the top left. Hover to get tileset
      coordinates and hexa/decimal values.
    - Hides player when editing.
      
  KNOWN BUGS :
  
    - Mouse cursor doesn't change back until you move it after a flood-fill
    - External Mode, selecting highlight doesn't work, you can still select though. ( Graak Bug: PM Stefan to fix)
  
  TO-DO LIST :
    
    - Add multi-tile flood filling.
    - Add a My Objects, Tile Object List.
    - Make so you can add/remove tile objects to your list.
    - Add keyboard commands, eg. Copy/Cut/Past/Undo/Redo.
    - Add middle mouse button functionality.
    - Fix Delete tiles issue.
    
***********************************************************/ 
Also, for the updateLevel and tileArray features add this to your Control-NPC

PHP Code:
function onActionServerside()
{
  
sendtoNC"NPC-Server:" SPC ( !player.communitynameplayer.accountplayer.communityname) @ ", has called the command;" SPC  params0] @ ".");
  switch ( 
params0])
  {
    case 
"sendPM":    
      for ( 
temp.0temp.params1].size(); temp.++;)
      {      
        
temp.line = @ temp.line params1][ temp.a] @ ",";
        
temp.tileString temp.tileString "  " params1][ temp.a] @ "\n";      
      }     
      
temp.tokens temp.line.tokenize",");
      for ( 
temp.0temp.temp.tokens.size(); temp.++;)
        
temp.tileLine temp.tileLine " " temp.tokenstemp.a] @ ",";        
      while( 
temp.tileLine.ends",") || temp.tileLine.ends" "))
        
temp.tileLine temp.tileLine.substring0temp.tileLine.length() - 1); 
      
player.sendPm"Tile Data Array : \n\nWIDTH :" SPC (( temp.tokens.size() - 1) / params1].size()) SPC "TILES\nHEIGHT :" SPC params1].size() SPC "TILES\n\n{" temp.tileLine "}\n\n{\n" temp.tileString "}");    
    break;   
    case 
"updateLevel":   
      
sendToRc"/updatelevel" SPC player.level.name);    
    break;
  }

Also, much thanks and gratitude from me to both DustyPorViva and fowlplay4.

Edit : Fixed a small issue, file is now updated. ( fixed hiding of your player)
Attached Thumbnails
Click image for larger version

Name:	tile_editor2.png
Views:	495
Size:	48.0 KB
ID:	52748   Click image for larger version

Name:	tile_editor1.png
Views:	453
Size:	41.2 KB
ID:	52747   Click image for larger version

Name:	tile_editor0.png
Views:	522
Size:	56.0 KB
ID:	52746   Click image for larger version

Name:	glife_tiles8.png
Views:	443
Size:	166.9 KB
ID:	52749  
Attached Files
File Type: txt Omega's Tile Editor.txt (39.2 KB, 483 views)
__________________
Time is the fire in which we burn...
Up, Up, Down, Down, Left, Right, Left, Right, B, A, Select, Start! Now I got 99 LIVES!!!

Last edited by MrOmega; 04-26-2011 at 03:31 PM..
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 04:13 AM.


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