Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Online Level editor (https://forums.graalonline.com/forums/showthread.php?t=70851)

excaliber7388 12-18-2006 03:47 AM

Online Level editor
 
1 Attachment(s)
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 :D
Basically, looking for some help, if anyone is interested, PM me, I would love to have more people working on this.

Gambet 12-18-2006 03:54 AM

This is something that would be best if made with a scripting language that isn't GScript.

excaliber7388 12-18-2006 03:57 AM

Quote:

Originally Posted by Gambet (Post 1254707)
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.
:D

Gambet 12-18-2006 05:25 AM

Quote:

Originally Posted by excaliber7388 (Post 1254708)
Reasons for gscript:
It can be built into the client (login server)
It will work for all platforms.
:D



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).

Devil 12-18-2006 05:33 AM

It sounds all well and dandy, but how far are you with it?

Twinny 12-18-2006 05:37 AM

You're very inspiring Gambet ^^.

Anywho, I'm sure it could be done if effort was put into it.

excaliber7388 12-18-2006 05:40 AM

All I have is some gui stuffs. :p
All I really need is to understand how to take a part of the image, and convert it to a tile for the level.

Twinny 12-18-2006 05:50 AM

I may have a few materials you could use. I'll get back to you with them.

excaliber7388 12-18-2006 06:00 AM

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.

Devil 12-18-2006 06:01 AM

Sounds good.

Googi 12-18-2006 06:10 AM

Quote:

Originally Posted by Gambet (Post 1254728)
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.

excaliber7388 12-18-2006 06:26 AM

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.

Skyld 12-18-2006 10:27 AM

Quote:

Originally Posted by Gambet (Post 1254728)
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. x_x

Devil 12-18-2006 11:10 AM

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.

Crono 12-18-2006 01:32 PM

Quote:

Originally Posted by Skyld (Post 1254766)
Either post something constructive, or don't post at all. x_x

When was it wrong to post something unconstructive?

Looks ok cali, but Clash made a superior one. Didn't lay tiles down though. XD

excaliber7388 12-18-2006 07:00 PM

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.

excaliber7388 12-18-2006 08:50 PM

4 Attachment(s)
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

zephirot 12-18-2006 08:52 PM

What about NPC?=O
Predefinied
Tiles
NPC,Chest, etc..

Gambet 12-18-2006 10:11 PM

Quote:

Originally Posted by Skyld (Post 1254766)
Then why don't you use your apparently superior knowledge to help? Either post something constructive, or don't post at all. x_x


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.

excaliber7388 12-18-2006 10:52 PM

Quote:

Originally Posted by zephirot (Post 1254848)
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.

Maniaman 12-18-2006 11:16 PM

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.

excaliber7388 12-18-2006 11:19 PM

Yeah.
Well, fix it then.
Make one that works on all platforms, and allows the players to make and test NPCs right away.

Maniaman 12-18-2006 11:21 PM

Quote:

Originally Posted by excaliber7388 (Post 1254908)
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.

excaliber7388 12-18-2006 11:30 PM

Quote:

Originally Posted by Maniaman (Post 1254911)
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 :D
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?

excaliber7388 12-19-2006 04:33 AM

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;
  }



Maniaman 12-19-2006 04:52 AM

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.

excaliber7388 12-19-2006 04:53 AM

Quote:

Originally Posted by Maniaman (Post 1255089)
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.

Riot 12-19-2006 05:23 AM

Perhaps you should look at the old version Stefan released a year ago?

http://forums.graalonline.com/forums...t=level+editor

excaliber7388 12-19-2006 05:33 AM

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};
  }



excaliber7388 12-19-2006 06:08 AM

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");
      }
    }
  }



Googi 12-19-2006 06:09 AM

Quote:

Originally Posted by Gambet (Post 1254880)
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"?

Andy0687 12-19-2006 06:18 AM

Quote:

Originally Posted by excaliber7388 (Post 1255116)
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.

Gambet 12-19-2006 06:18 AM

Quote:

Originally Posted by Googi (Post 1255142)
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.

excaliber7388 12-19-2006 06:27 AM

Quote:

Originally Posted by Andy0687 (Post 1255148)
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.

Twinny 12-20-2006 05:11 PM

I've been perfecting my current level editor. It can copy but I can improve on the method. It also does layers ^^.

excaliber7388 12-21-2006 11:41 PM

Quote:

Originally Posted by Twinny (Post 1255673)
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.

Googi 12-22-2006 12:30 AM

Quote:

Originally Posted by Gambet (Post 1255149)
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.

Crono 12-22-2006 12:44 AM

Quote:

Originally Posted by Googi (Post 1255990)
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. :]

excaliber7388 12-27-2006 06:31 PM

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. :(

Chompy 12-27-2006 07:01 PM

Quote:

Originally Posted by excaliber7388 (Post 1257834)
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?


All times are GMT +2. The time now is 10:12 PM.

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