View Single Post
  #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") 
        {
          
x = 0;
          
y = 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