Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 12-18-2006, 03:47 AM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
Online Level editor

I'm working on an online editor.
Well, actually, 2.
The one will be for online use by staff members, where they can drag tiles from a gui directly onto the level.
The other one I hope to have added to the login level.
It would be a replacement to the current level editor, and allow users to make levels, and save them to their computer.

Now, I don't know how to take from the tileset image, and put it onto the level. If anyone's made a level editor in the past, I could use some advice here.

I have a screenshot below. The edit level as text button is a feature I plan to add to allow the user to edit NPCs. Got the script from Kuji
Basically, looking for some help, if anyone is interested, PM me, I would love to have more people working on this.
Attached Thumbnails
Click image for larger version

Name:	Picture 1.png
Views:	263
Size:	48.6 KB
ID:	38957  
Reply With Quote
  #2  
Old 12-18-2006, 03:54 AM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
This is something that would be best if made with a scripting language that isn't GScript.
Reply With Quote
  #3  
Old 12-18-2006, 03:57 AM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
Quote:
Originally Posted by Gambet View Post
This is something that would be best if made with a scripting language that isn't GScript.
Reasons for gscript:
It can be built into the client (login server)
It will work for all platforms.
Reply With Quote
  #4  
Old 12-18-2006, 05:25 AM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
Quote:
Originally Posted by excaliber7388 View Post
Reasons for gscript:
It can be built into the client (login server)
It will work for all platforms.


Lag.
Insufficiency.
Uncomfortable.
Unsafe.
Not For GScript.


Not to mention getting a whole bunch of people to input their own little bit to the system will only cause problems in the end.

This has been tried before (like NP's online tile layer), but has failed miserably.

The only editor I see that is promising is Maniaman's, and that's because he isnt using GScript for it (I think he's using C or so).
Reply With Quote
  #5  
Old 12-18-2006, 05:33 AM
Devil Devil is offline
Banned
Join Date: Feb 2003
Location: Australia
Posts: 2,835
Devil has a little shameless behaviour in the past
Send a message via AIM to Devil Send a message via MSN to Devil
It sounds all well and dandy, but how far are you with it?
Reply With Quote
  #6  
Old 12-18-2006, 05:37 AM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
You're very inspiring Gambet .

Anywho, I'm sure it could be done if effort was put into it.
Reply With Quote
  #7  
Old 12-18-2006, 05:40 AM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
All I have is some gui stuffs.
All I really need is to understand how to take a part of the image, and convert it to a tile for the level.
Reply With Quote
  #8  
Old 12-18-2006, 05:50 AM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
I may have a few materials you could use. I'll get back to you with them.
Reply With Quote
  #9  
Old 12-18-2006, 06:00 AM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
I also plan to add the ability to create a new level, warp there, and edit it.
With the "edit level as text" button, you can edit the links, and npcs as well.
On a side note: anyone know why my tileset died? lol. It disappeared, even though I have all the files, etc.
Reply With Quote
  #10  
Old 12-18-2006, 06:01 AM
Devil Devil is offline
Banned
Join Date: Feb 2003
Location: Australia
Posts: 2,835
Devil has a little shameless behaviour in the past
Send a message via AIM to Devil Send a message via MSN to Devil
Sounds good.
Reply With Quote
  #11  
Old 12-18-2006, 06:10 AM
Googi Googi is offline
A Serious Epidemic
Googi's Avatar
Join Date: Oct 2001
Location: Canada
Posts: 18,866
Googi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud of
Send a message via AIM to Googi
Quote:
Originally Posted by Gambet View Post
Lag.
Insufficiency.
Uncomfortable.
Unsafe.
Not For GScript.
I am not aware of any major problems with online tile editors other than that current ones can only change one tile at a time. Lag shouldn't be a problem as long as you do everything except the actual tile changes clientside.
__________________
Reply With Quote
  #12  
Old 12-18-2006, 06:26 AM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
Well, if you use mouse down and mouse up, along with the x and y coordinates of when each even happened, selecting multiple tiles shouldn't be that hard.
All I need to do is figure out how to convert from x/y positions on an image to the textual code used in a level.
Reply With Quote
  #13  
Old 12-18-2006, 10:27 AM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Quote:
Originally Posted by Gambet View Post
Lag.
Insufficiency.
Uncomfortable.
Unsafe.
Not For GScript.


Not to mention getting a whole bunch of people to input their own little bit to the system will only cause problems in the end.

This has been tried before (like NP's online tile layer), but has failed miserably.

The only editor I see that is promising is Maniaman's, and that's because he isnt using GScript for it (I think he's using C or so).
Then why don't you use your apparently superior knowledge to help? Either post something constructive, or don't post at all.
__________________
Skyld
Reply With Quote
  #14  
Old 12-18-2006, 11:10 AM
Devil Devil is offline
Banned
Join Date: Feb 2003
Location: Australia
Posts: 2,835
Devil has a little shameless behaviour in the past
Send a message via AIM to Devil Send a message via MSN to Devil
I thought you'd be used to Gambet by now, ya know? Every post is picking on someone else's things, without actually showing he could do better.
Reply With Quote
  #15  
Old 12-18-2006, 01:32 PM
Crono Crono is offline
:pluffy:
Join Date: Feb 2002
Location: Sweden
Posts: 20,000
Crono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond repute
Quote:
Originally Posted by Skyld View Post
Either post something constructive, or don't post at all.
When was it wrong to post something unconstructive?

Looks ok cali, but Clash made a superior one. Didn't lay tiles down though. XD
__________________
Reply With Quote
  #16  
Old 12-18-2006, 07:00 PM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
Well, I have more to add to it. Right now I'm working on the new level function. Joey made something for viewing a level as text...although the script is above my levels XD I plan to integrate that into this. That way, you can edit the board, NPCs, links, signs, etc.
Once I can get it to lay tiles, I can work out ways of making it select multiple tiles, maybe even tiles that have already been laid. A predefined objects portion couldn't be too hard either.
Reply With Quote
  #17  
Old 12-18-2006, 08:50 PM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
I'm working on adding a few things, new levels, predefined objects, and view level at text options. The pics below are the different functions.
*edit* Fixed the text gui
Attached Thumbnails
Click image for larger version

Name:	Picture 3.png
Views:	153
Size:	18.8 KB
ID:	38962   Click image for larger version

Name:	Picture 1.png
Views:	143
Size:	16.1 KB
ID:	38966   Click image for larger version

Name:	Picture 2.png
Views:	144
Size:	39.9 KB
ID:	38967  

Last edited by excaliber7388; 12-18-2006 at 11:17 PM..
Reply With Quote
  #18  
Old 12-18-2006, 08:52 PM
zephirot zephirot is offline
Banned?
Join Date: Sep 2004
Location: Paris
Posts: 1,311
zephirot is a name known to allzephirot is a name known to allzephirot is a name known to all
Send a message via AIM to zephirot Send a message via MSN to zephirot
What about NPC?=O
Predefinied
Tiles
NPC,Chest, etc..
__________________

Quote:
Originally Posted by unixmad
Can you just shut up ?
MAGA
MFGA
MEGA
Reply With Quote
  #19  
Old 12-18-2006, 10:11 PM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
Quote:
Originally Posted by Skyld View Post
Then why don't you use your apparently superior knowledge to help? Either post something constructive, or don't post at all.

This has nothing to do with my scripting ability. If the right person did it, then yes, they probably could pull this off. As nice as a collaboration would be, it's just not very realistic. When you have multiple people working on the same system, you're bound to run into problems.

This is supposedly excaliber's project, sure, but he's already taken code from friends that wanted to give their small donation into it. It's not about getting it to work, it's about doing it right, and it's about making it as efficient, user-friendly, and lag-free as possible. This is something that would be near impossible to accomplish if you have multiple scripters working on the same system while changing things around and inputting their own bits and pieces of code.
Reply With Quote
  #20  
Old 12-18-2006, 10:52 PM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
Quote:
Originally Posted by zephirot View Post
What about NPC?=O
Predefinied
Tiles
NPC,Chest, etc..
I plan to add that later, right now, you will be able to do that through the 'edit as text' function. I have 3 weeks with an RC, I want to make as many dev tools as I can.

Last edited by excaliber7388; 12-18-2006 at 11:18 PM..
Reply With Quote
  #21  
Old 12-18-2006, 11:16 PM
Maniaman Maniaman is offline
Registered User
Join Date: Aug 2005
Posts: 326
Maniaman is on a distinguished road
The problem with online level editors is there is no good way to edit npcs or signs. You have to loadlines/savelines to edit npcs or chests. This cuses problems because if i remember correctly, updateboard2 does not save to the .nw file immediately.
__________________

Current Maloria Event: (click to go to it)
Reply With Quote
  #22  
Old 12-18-2006, 11:19 PM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
Yeah.
Well, fix it then.
Make one that works on all platforms, and allows the players to make and test NPCs right away.
Reply With Quote
  #23  
Old 12-18-2006, 11:21 PM
Maniaman Maniaman is offline
Registered User
Join Date: Aug 2005
Posts: 326
Maniaman is on a distinguished road
Quote:
Originally Posted by excaliber7388 View Post
Yeah.
Well, fix it then.
Sorry but I don't have access to the graal source code to fix it.
Quote:
Make one that works on all platforms, and allows the players to make and test NPCs right away.
I'll leave that part up to the people on other platforms.
__________________

Current Maloria Event: (click to go to it)
Reply With Quote
  #24  
Old 12-18-2006, 11:30 PM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
Quote:
Originally Posted by Maniaman View Post
Sorry but I don't have access to the graal source code to fix it.
No, I mane make an external program for all platforms w/ gs2.
Quote:
I'll leave that part up to the people on other platforms.
I figured
That's why something like this should be in place.

Still need a way to take tiles from the image.
I'm having trouble decoding Joey's text based editor for taking the text from an NW file, and then saving the changes you make. Any ideas on that?

Last edited by excaliber7388; 12-19-2006 at 12:18 AM..
Reply With Quote
  #25  
Old 12-19-2006, 04:33 AM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
I'm on and off a PC, so I can't test a lot. I need to figure out how to convert a normal value to hexadecimal, and placing the found tile on the level.
After that, I need some predefined objects, selecting multiple tiles, text editing, and new level creation.
PHP Code:
function onActionServerside()
{
  if(
params[0]=="create")
  {
    
setlevel2(params[1],31,31);
  }
}
//#CLIENTSIDE
function onWeaponfired()
{
  
this.on abs(this.on-1);
  if(
this.on==1)
  {
    
this.tilesx = (screenwidth/4)*2.5;
    
this.tilesy 10;
    
ol_level_edit.showtop();
    
ol_level_edit_scroll.showtop();
    
ol_level_edit_predefined_list.hide();
    
ol_level_edit_text_scroll.hide();
    
ol_level_edit_text_save.hide();
    new 
GuiWindowCtrl("ol_level_edit")
    {
      
profile "GuiBlueWindowProfile";
      
canResize false;
      
canMove true;
      
canMaximize false;
      
canMinimize false;
      
canClose true;
      
extent = {250,500};
      
position = {this.tilesx,this.tilesy};
      
text "Online Level Editor, by Excalibur";
      
      new 
GuiScrollCtrl("ol_level_edit_scroll")
      {
        
profile "GuiBlueScrollProfile";
        
position = {10,25};
        
extent = {230,370};
        new 
GuiDrawingPanel("ol_level_edit_tiles"
        {
          
0;
          
0;
          
width 2100;
          
height 510;
          
clearall();
          
drawimage(0,0,"pics1.png");
        }
      }
      new 
GuiRadioCtrl("ol_level_edit_tiles_r")
      {
        
profile "GuiBlueRadioProfile";
        
position = {10,395};
        
extent = {100,20};
        
text "Tiles";
        
groupnum 1;
        
checked true;
      }
      new 
GuiRadioCtrl("ol_level_edit_predefined_r")
      {
        
profile "GuiBlueRadioProfile";
        
position = {10,415};
        
extent = {110,20};
        
text "Predefined Objects";
        
groupnum 1;
        
checked false;
      }
      new 
GuiRadioCtrl("ol_level_edit_text_r")
      {
        
profile "GuiBlueRadioProfile";
        
position = {10,435};
        
extent = {100,20};
        
text "Edit Level as Text";
        
groupnum 1;
        
checked false;
      }
      new 
GuiButtonCtrl("ol_level_edit_new")
      {
        
profile "GuiBlueButtonProfile";
        
position = {10,460};
        
extent = {230,30};
        
text "New Level";
      }
    }
  }
  else
  {
    
ol_level_edit.hide();
    
ol_level_edit_text_win.hide();
    
new_level.hide();
  }
}
function 
ol_level_edit_tiles_r.onAction()
{
  
player.chat "Tiles";
  
ol_level_edit_scroll.showtop();
  
ol_level_edit_predefined_list.hide();
  
ol_level_edit_text_scroll.hide();
  
ol_level_edit_text_save.hide();
}
function 
ol_level_edit_predefined_r.onAction()
{
  
player.chat "Predefined Objects";
  
ol_level_edit_scroll.hide();
  
ol_level_edit_predefined_list.showtop();
  
ol_level_edit_text_scroll.hide();
  
ol_level_edit_text_save.hide();
  new 
GuiWindowCtrl("ol_level_edit")
  {
    new 
GuiPopUpMenuCtrl("ol_level_edit_predefined_list"
    {
      
profile "GuiBluePopUpMenuProfile";
      
textprofile "GuiBlueTextListProfile";
      
scrollprofile "GuiBlueScrollProfile";
      
position = {10,25};
      
extent = {230,20};
      
clearrows();
      
addrow(0,"None");
      
addrow(1,"Grass");
      
addrow(2,"Bush");
      
setSelectedRow(0);
    }
  }  
}
function 
ol_level_edit_text_r.onAction()
{
  
player.chat "Text Edit";
  
ol_level_edit_scroll.hide();
  
ol_level_edit_predefined_list.hide();
  
ol_level_edit_text_scroll.showtop();
  
ol_level_edit_text_save.showtop();
  new 
GuiWindowCtrl("ol_level_edit")
  {
    new 
GuiScrollCtrl("ol_level_edit_text_scroll")
    { 
      
profile "GuiBlueScrollProfile";
      
position = {10,25};
      
extent = {230,340};
      new 
GuiMLTextEditCtrl("ol_level_edit_text_text"
      {
        
position = {0,0};
        
extent = {1220,5000};
        
profile "GuiBlueMLTextEditProfile";
        
text "Level text";
        
syntaxhilighting true;
        
wordwrap false;
      }
    }
    new 
GuiButtonCtrl("ol_level_edit_text_save")
    {
      
profile "GuiBlueButtonProfile";
      
position = {10,365};
      
extent = {230,25};
      
text "Save Level";
    }
  }
}
function 
ol_level_edit_new.onAction()
{
  
new_level.showtop();
  new 
GuiWindowCtrl("new_level")
  {
    
profile "GuiBlueWindowProfile";
    
canResize false;
    
canMove true;
    
canMaximize false;
    
canMinimize false;
    
canClose true;
    
extent = {215,50};
    
position = {screenwidth/5,10};
    
text "New Level";
    new 
GuiTextEditCtrl("new_level_name")
    {
      
profile "GuiBlueTextEditProfile";
      
position = {7,24};
      
extent = {150,20};
      
text "Level name";
    }
    new 
GuiButtonCtrl("new_level_create")
    {
      
profile "GuiBlueButtonProfile";
      
position = {160,24};
      
extent = {47,20};
      
text "Create";
    }
  }
}
function 
new_level_create.onaction()
{
  
player.chat "Making level...";
  
triggeraction(0,0,"Serverside","Staff/Online Level Editor","create",new_level_name.text);
}
/*needs to:
-convert to hex
-place tile
function onMousedown()
{
  if(this.hastile==0)
  {
    this.mouserx = this.mousex-this.tilesx;
    this.mousery = this.mousey-this.tilesy;
    if(this.mouserx/16>=int(this.mouserx/16) && this.mouserx/16<int(this.mouserx/16)+16 && this.mousery/16>=int(this.mousery/16) && this.mousery/16<int(this.mousery/16)+16)
    {
      this.tilex = int(this.mouserx);
      this.tiley = int(this.mousery);
      this.hastile = 1;
    }
  }
  else
  {
    //set tile
    this.hastile = 0;
  }

Reply With Quote
  #26  
Old 12-19-2006, 04:52 AM
Maniaman Maniaman is offline
Registered User
Join Date: Aug 2005
Posts: 326
Maniaman is on a distinguished road
Tiles in the .nw file are base64.

For drawing the current tileset supposedly you can just put "TILES" (with quotes) as the image in the drawing panel. Not sure if this works though. Sometimes it has worked for me, sometimes it hasn't.
__________________

Current Maloria Event: (click to go to it)
Reply With Quote
  #27  
Old 12-19-2006, 04:53 AM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
Quote:
Originally Posted by Maniaman View Post
Tiles in the .nw file are base64.

For drawing the current tileset supposedly you can just put "TILES" (with quotes) as the image in the drawing panel. Not sure if this works though. Sometimes it has worked for me, sometimes it hasn't.
I haven't been able to test this: something's wrong with DR's tileset, and I can't test that.. Bt I still can't pull tiles from that and put it on the level.
Reply With Quote
  #28  
Old 12-19-2006, 05:23 AM
Riot Riot is offline
Delteria Management
Join Date: Nov 2003
Location: Seminole County, Florida
Posts: 280
Riot is on a distinguished road
Perhaps you should look at the old version Stefan released a year ago?

http://forums.graalonline.com/forums...t=level+editor
Reply With Quote
  #29  
Old 12-19-2006, 05:33 AM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
You have a great point there!
Maybe I should look into taking this editor, and improving it by adding predefined objects, text editing, etc.
The script is below.
Predefined objects would be saving the array to a client variable.
From there, we would need a gui that would show all the images.
X_X
This would take me a while...someone better want to step in.
PHP Code:
function onActionServerSide(action) {
  switch (
action) {
    case 
"paste": {
        
pasteTiles(params[1],params[2],params[3],params[4],params[5]);
        break;
      }
  }
}

function 
pasteTiles(pastex,pastey,pastew,pasteh,pastearr) {
  for (
tx=0tx<pastewtx++) for (ty=0ty<pastehty++)
    
tiles[pastex+tx,pastey+ty] = pastearr[tx+ty*pastew];
  
updateboard2(pastex,pastey,pastew,pasteh);
}

//#CLIENTSIDE
function onCreated() {
  
this.on false;
  
this.tilex 0;
  
this.tiley 0;
  
this.selecting false;
  
this.selected false;
  
this.selx this.sely this.selx2 this.sely2 0;

  
addGuiControls();
  
setTimer(0.05);
}

function 
onweaponfired() {
    if (
this.on
      
turnoff();
    else
      
turnon();
}

function 
turnon() {
  
this.on true;

  
GUIContainer.addControl(LevelEditor_Window);
  
GUIContainer.addControl(LevelEditor_DragTiles);
  
GraalControl.width GUIContainer.width 200;
  
GraalControl.horizSizing "width";
  
LevelEditor_Window.GUIContainer.width 200;
  
LevelEditor_Window.width 200;
  
LevelEditor_Window.height GUIContainer.height;
  
LevelEditor_Window.horizSizing "left";

  
drawTiles();
  
LevelEditor_Window.show();
}

function 
turnoff() {
  
this.on false;
  
GraalControl.width GUIContainer.width;
  
GraalControl.horizSizing "relative";
  
LevelEditor_Window.hide();
}

function 
onPlayerEnters() {
  if (!
this.on)
    return;
  
drawTiles();
}

function 
addGuiControls() {
  
LevelEditor_Window = new GuiWindowCtrl("LevelEditor_Window");
  
with (LevelEditor_Window) {
    
profile "GuiWindowProfile";
    
0;
    
0;
    
width 200;
    
height 300;
    
canMove true;
    
canResize true;
    
canClose true;
    
canMaximize true;
    
canMinimize true;
    
tile true;
    
text "Select Tiles";
    
visible false;

    new 
GuiScrollCtrl("LevelEditor_Scroll") {
      
profile "GuiScrollProfile";
      
horizSizing "width";
      
vertSizing "height";
      
position "5 23";
      
extent "190 272";
      
willFirstRespond true;
      
hScrollBar "alwaysOn";
      
vScrollBar "alwaysOn";
      
tile true;

      new 
GuiControl("LevelEditor_ScrollFiller") {
        
0;
        
0;
        
width 2048;
        
height 512;
        
scrolllinex 16;
        
scrollliney 16;
      }
    }

    new 
GuiDrawingPanel("LevelEditor_Tiles") {
      
6;
      
24;
      
width 169;
      
height 251;
      
horizSizing "width";
      
vertSizing "height";
    }

    new 
GuiShowImgCtrl("LevelEditor_TilesSelect") {
      
profile "GuiModelessDialogProfile";
      
7;
      
24;
      
width 170;
      
height 252;
      
horizSizing "width";
      
vertSizing "height";
      
dimension 2;
      
polygon NULL;
      
red green blue alpha 0.5;
    }
  }
  
LevelEditor_DragTiles = new GuiDrawingPanel("LevelEditor_DragTiles");
  
LevelEditor_DragTiles.visible false;
  if (
this.on)
    
drawTiles();
}

function 
onTimeout() {
  if (
this.dragging==true) {
    
// Check if the dragging is still ongoing
    
if (!leftmousebutton) {
      
this.dragging false;
      if (
this.dopaste) {
        
// Send the tiles and position to the server
        
wx int(worldx(LevelEditor_DragTiles.x,LevelEditor_DragTiles.x)+0.5);
        
wy int(worldy(LevelEditor_DragTiles.y,LevelEditor_DragTiles.y)+0.5);
        
tarrx int(this.selx/16);
        
tarry int(this.sely/16);
        
tarrw int((this.selx2-this.selx)/16);
        
tarrh int((this.sely2-this.sely)/16);
        
tarr = new[tarrw*tarrh];
        for (
ty=tarryty<tarry+tarrhty++) {
          for (
tx=tarrxtx<tarrx+tarrwtx++)
            
tarr[(tx-tarrx)+(ty-tarry)*tarrw] = int(tx/16)*32*16 ty*16 + (tx%16);
        }
        
triggerServer("gui","LevelEditor","paste",wx,wy,tarrw,tarrh,tarr);
      }
    } else if (!(
mousescreenx in <0,GUIContainer.width-1>) ||
        !(
mousescreeny in <0,GUIContainer.height-1>))
      
this.dragging false;
  }
  if (
this.dragging) {
    
// Move the selected tiles
    
LevelEditor_DragTiles.mousescreenx-this.dragrelx;
    
LevelEditor_DragTiles.mousescreeny-this.dragrely;
    
// Push the tiles behind the window for easier editing
    
if (LevelEditor_DragTiles.x+LevelEditor_DragTiles.width<LevelEditor_Window.x+10 ||
        
LevelEditor_DragTiles.x>=LevelEditor_Window.x+LevelEditor_Window.width-10 ||
        
LevelEditor_DragTiles.y+LevelEditor_DragTiles.height<LevelEditor_Window.y+10 ||
        
LevelEditor_DragTiles.y>=LevelEditor_Window.y+LevelEditor_Window.height-10) {
      
LevelEditor_DragTiles.pushtoback();
      
GraalControl.pushtoback();
      
this.dopaste true;
    }
  } else if (
LevelEditor_DragTiles.visible) {
    
// Hide the tiles if we are not dragging anymore
    
with (LevelEditor_DragTiles) {
      
width height 0;
      
hide();
    }
  }
  
setTimer(0.05);
}

function 
LevelEditor_Tiles.onResize(newwnewh) {
  
drawTiles();
}

function 
LevelEditor_Tiles.onMouseDown(mmodmxmy) {
  if (
checkDragStart(mx,my))
    return;
  
setFirstSelection(mx,my);
}

function 
LevelEditor_Tiles.onMouseDragged(mmodmxmy) {
  if (!
this.selecting)
    return;
  
setSecondSelection(mx,my);
}

function 
LevelEditor_Tiles.onMouseUp(mmodmxmy) {
  if (!
this.selecting)
    return;
  
setSecondSelection(mx,my,true);
}

function 
LevelEditor_Tiles.onMouseWheelUp() {
  
LevelEditor_Scroll.scrollDelta(0,-64);
}

function 
LevelEditor_Tiles.onMouseWheelDown() {
  
LevelEditor_Scroll.scrollDelta(0,64);
}

function 
LevelEditor_Scroll.onScrolled(scrollx,scrolly,deltax,deltay) {
  if (
this.tilex!=scrollx || this.tiley!=scrolly) {
    
this.tilex scrollx;
    
this.tiley scrolly;
    
drawTiles();
    
updateTilesSelection();
  }
}

function 
checkDragStart(mx,my) {
  
localcoord LevelEditor_Tiles.globaltolocalcoord({mx,my});
  
testx this.tilex localcoord[0];
  
testy this.tiley localcoord[1];
  if (
testx in |this.selx,this.selx2> &&
      
testy in |this.sely,this.sely2>) {
    
this.dragging true;
    
this.dopaste false;
    
this.dragrelx localcoord[0]-(this.selx-this.tilex)-1;
    
this.dragrely localcoord[1]-(this.sely-this.tiley)-1;
    
with (LevelEditor_DragTiles) {
      
mx-thiso.dragrelx;
      
my-thiso.dragrely;
      
width thiso.selx2 thiso.selx;
      
height thiso.sely2 thiso.sely;
      
drawimagerectangle(0,0,
        
"TILES",thiso.selx,thiso.sely,
        
width,height);
      
showtop();
    }
    
GraalControl.makefirstresponder(true);
    return 
true;
  } else
    return 
false;
}

function 
drawTiles() {
  
LevelEditor_Tiles.drawimagerectangle(0,0,
    
"TILES",this.tilex,this.tiley,
    
LevelEditor_Tiles.width,LevelEditor_Tiles.height);
}

function 
setFirstSelection(mx,my) {
  
this.selected false;
  
this.selecting true;
  
localcoord LevelEditor_Tiles.globaltolocalcoord({mx,my});
  
this.selorgx = (this.tilex localcoord[0]) & -16;
  
this.selorgy = (this.tiley localcoord[1]) & -16;
  
this.selx = (this.tilex localcoord[0]+8) & -16;
  
this.sely = (this.tiley localcoord[1]+8) & -16;
  
this.selx2 this.selx;
  
this.sely2 this.sely;
}

function 
setSecondSelection(mx,my,finished) {
  
localcoord LevelEditor_Tiles.globaltolocalcoord({mx,my});
  
this.selx2 = (this.tilex localcoord[0]+8) & -16;
  
this.sely2 = (this.tiley localcoord[1]+8) & -16;
  if (
finished) {
    if (
this.selx==this.selx2 && this.sely==this.sely2) {
      
this.selx this.selorgx;
      
this.sely this.selorgy;
      
this.selx2 this.selx 16;
      
this.sely2 this.sely 16;
    }
    
this.selected true;
    
this.selecting false;
  }
  
updateTilesSelection();
}

function 
updateTilesSelection() {
  
selpolx min(int(this.selx),this.selx2);
  
selpolw abs(this.selx2-this.selx);
  
selpoly min(int(this.sely),this.sely2);
  
selpolh abs(this.sely2-this.sely);
  if (
selpolw<=|| selpolh<=0)
    
LevelEditor_TilesSelect.polygon NULL;
  else {
    
selpolx -= this.tilex;
    
selpoly -= this.tiley;
    
LevelEditor_TilesSelect.polygon = {selpolx,selpoly,
      
selpolx+selpolw,selpoly,selpolx+selpolw,selpoly+selpolh,
      
selpolx,selpoly+selpolh};
  }


Last edited by excaliber7388; 12-19-2006 at 05:47 AM..
Reply With Quote
  #30  
Old 12-19-2006, 06:08 AM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
This is Joey's level editor. It's text based, so you can edit the NPCs, etc
Only problem is: I can't get it to work x_X
PHP Code:
function onActionServerSide(actionargs) {
  switch (
action) {
    case 
"openfile": {
      for (
temp.var: this.listfolders) {
        
temp.folder.loadfolder(temp.var @ "/*"true);
        
        for (
temp.var2temp.folder) {
          if (
temp.var2 == args[0]) {
            
temp.levelinfo = new TStaticVar();
            
temp.levelinfo.loadlines(temp.var @ "/" temp.var2);
            
            for (
temp.var3temp.levelinfotemp.linfo.add(temp.var3);
            
            
triggerclient("gui"this.name"openfile", {"levels/" temp.var @ "/" temp.var2temp.linfo});
            
            return 
true;
          }
        }
      }
      
      
player.addMsg("Server"format("No such file by %s was found!"args[0]), 15);
      
      break;
    }
    
    case 
"savefile": {
      
temp.levelinfo = new TStaticVar();
      
temp.levelinfo args[1];

      
temp.levelinfo.savelines(args[0], 0);
      
      
temp.toks args[0].tokenize("/");
      
      if (
temp.toks[temp.toks.size() - 1].pos(".nw") > 0) {
        
triggerclient("gui"this.name"updatelevel", {temp.toks[temp.toks.size() - 1]});
      }
      
      break;
    }
  }
}

function 
onCreated() {
  
// Add folders here
  
this.listfolders = {"levels","levelsinsidelevels","levels/outsidelevels"};
}

//#CLIENTSIDE
// Usage: !openfile FILE
function onCreated() {
  
this.buttons = {{"Save"10"Save File"}, {"Reload"150"Reload File"}, {"Close"290"Close File"}};
}

function 
ChatBar.onAction() {
  if (
ChatBar.text.starts("!openfile")) {
    
triggerserver("gui"this.name"openfile", {ChatBar.text.substring(10)});
  }
}

function 
onActionClientSide(actionargs) {
  switch (
action) {
    case 
"openfile": {
      
onTextWindow(args[0], args[1]);
    
      break;
    }
    
    case 
"updatelevel": {
      
sendtorc(format("/updatelevel %s"args[0]));
      
player.addMsg("Server""Saved and Updated successfully!"15);
     
      break;
    }
  }
}

function 
onActionButton(obj) {
  
temp.objid obj.substring(19);
  
this.sendu temp.objid;
  
  if (
obj.starts("TextEdit_")) {
    
temp.type temp.obj.substring(9);
    
temp.type temp.type.substring(0temp.type.length() - 1);
    
temp.uid  temp.obj.substring(temp.obj.length() - 1);
    
    switch (
temp.type) {
      case 
"Save": {
        
triggerserver("gui"this.name"savefile", {makevar("TextEdit_Window" temp.uid).text.substring(13), makevar("TextEdit_MultiLineEdit" temp.uid).getLines()});
       
        break;
      }
    
      case 
"Reload": {
        
makevar("TextEdit_MultiLineEdit" temp.uid).setLines(makevar("this.tefile_" temp.uid));
      
        break;
      }
      
      case 
"Close": {
        
makevar("TextEdit_Window" temp.uid).destroy();
        
        break;
      }
    }
  }
}

function 
onTextWindow(newFilenewText) {
  
this.teid++;
  
  
makevar("this.tefile_" this.teid) = newText;
  
  if (
makevar("TextEdit_Window" this.teid) != NULLmakevar("TextEdit_Window" this.teid).destroy();
  
  new 
GuiWindowCtrl("TextEdit_Window" thiso.teid) {
    
profile  "GuiBlueWindowProfile";
    
    
extent   = {400390};
    
position = {screenwidth 3screenheight 3};
    
    
text "Text Editor: " newFile;

    new 
GuiScrollCtrl("TextEdit_Scroll" thiso.teid) {
      
profile     "GuiBlueScrollProfile";
    
      
extent      = {388320};
      
position    = {624};
      
      
horizSizing "width";
      
vertsizing  "height";
      
      
hscrollbar  "dynamic";
      
vscrollbar  "dynamic";

      new 
GuiMLTextEditCtrl("TextEdit_MultiLineEdit" thiso.teid) {
        
profile     "GuiBlueMLTextProfile";
        
        
horizSizing "width";
        
vertsizing  "height";
        
        
wordwrap    false;
        
        
setlines(newText);
      }
    }
    
    for (
temp.var: thiso.buttons) {
      new 
GuiButtonCtrl("TextEdit_" temp.var[0] @ thiso.teid) {
        
profile     "GuiBlueButtonProfile";
      
        
extent      = {10030};
        
position    = {temp.var[1], 349};
      
        
vertsizing  "top";
      
        
text        temp.var[2];
        
        
thiso.catchevent(this.name"onAction""onActionButton");
      }
    }
  }

Reply With Quote
  #31  
Old 12-19-2006, 06:09 AM
Googi Googi is offline
A Serious Epidemic
Googi's Avatar
Join Date: Oct 2001
Location: Canada
Posts: 18,866
Googi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud of
Send a message via AIM to Googi
Quote:
Originally Posted by Gambet View Post
This has nothing to do with my scripting ability. If the right person did it, then yes, they probably could pull this off. As nice as a collaboration would be, it's just not very realistic. When you have multiple people working on the same system, you're bound to run into problems.

This is supposedly excaliber's project, sure, but he's already taken code from friends that wanted to give their small donation into it. It's not about getting it to work, it's about doing it right, and it's about making it as efficient, user-friendly, and lag-free as possible. This is something that would be near impossible to accomplish if you have multiple scripters working on the same system while changing things around and inputting their own bits and pieces of code.
Huh? What does this have to do with whether or not it's "for GScript"?
__________________
Reply With Quote
  #32  
Old 12-19-2006, 06:18 AM
Andy0687 Andy0687 is offline
Enigma
Join Date: Feb 2002
Posts: 1,072
Andy0687 is on a distinguished road
Quote:
Originally Posted by excaliber7388 View Post
This would take me a while...someone better want to step in.
PHP Code:

Ive been working on that code for a little while and ive done quite a bit with it, Could maybe release my updates when im finished.
Reply With Quote
  #33  
Old 12-19-2006, 06:18 AM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
Quote:
Originally Posted by Googi View Post
Huh? What does this have to do with whether or not it's "for GScript"?

Nothing?

I gave an instance on how it could possibly work, then explained why his couldn't.
Reply With Quote
  #34  
Old 12-19-2006, 06:27 AM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
Quote:
Originally Posted by Andy0687 View Post
Ive been working on that code for a little while and ive done quite a bit with it, Could maybe release my updates when im finished.
Nice.
What additions did you make?

You know...now that I think of it. I wasted all that time making a good gui system lol. Oh well. I'd rather have the ability to develop on my Mac than to have made it myself.
Reply With Quote
  #35  
Old 12-20-2006, 05:11 PM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
I've been perfecting my current level editor. It can copy but I can improve on the method. It also does layers .
Reply With Quote
  #36  
Old 12-21-2006, 11:41 PM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
Quote:
Originally Posted by Twinny View Post
I've been perfecting my current level editor. It can copy but I can improve on the method. It also does layers .
Copy tiles on the level? That was one of the things I was hoping (me or someone else) would implement.
Also some way of moving the tiles around once you've put them down would be nice too.
Reply With Quote
  #37  
Old 12-22-2006, 12:30 AM
Googi Googi is offline
A Serious Epidemic
Googi's Avatar
Join Date: Oct 2001
Location: Canada
Posts: 18,866
Googi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud of
Send a message via AIM to Googi
Quote:
Originally Posted by Gambet View Post
Nothing?

I gave an instance on how it could possibly work, then explained why his couldn't.
Your second reply said that it's "not for GScript" which makes no sense.
__________________
Reply With Quote
  #38  
Old 12-22-2006, 12:44 AM
Crono Crono is offline
:pluffy:
Join Date: Feb 2002
Location: Sweden
Posts: 20,000
Crono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond repute
Quote:
Originally Posted by Googi View Post
Your second reply said that it's "not for GScript" which makes no sense.
no u maek no sense, it iz not 4 gscript -________-;;

on a more serious note, if they were able to make a built in RC with gscript...level editor shouldn't be so far away. :]
__________________
Reply With Quote
  #39  
Old 12-27-2006, 06:31 PM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
Stefan's tile editor isn't saving the changes I do to the levels.
I have levelsaveauto=true in the server options, so this should be working....but...it doesn't.
Reply With Quote
  #40  
Old 12-27-2006, 07:01 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by excaliber7388 View Post
Stefan's tile editor isn't saving the changes I do to the levels.
I have levelsaveauto=true in the server options, so this should be working....but...it doesn't.
savelevels=true too?
__________________
Reply With Quote
Reply


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 11:42 PM.


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