Thread: player.loadvars
View Single Post
  #10  
Old 04-16-2009, 01:10 PM
Schetti Schetti is offline
SC2 Player
Schetti's Avatar
Join Date: Nov 2008
Location: Austria
Posts: 269
Schetti is on a distinguished road
HMM... better posting full script

Sry, I couldnt folow the part with GuiMLTextCtrl, how newb I am. Also tell me if you think thats above my ability level, but I dont think so.
I know there will be lot of nobish stuff, and ignore the boxes, I dont think I will/can use them.
PHP Code:
//#CLIENTSIDE
function onCreated() { 
 }
function 
onPlayerChats()
{  
 if (
player.chat == "/notes")
  {
    
onOpenNotes();
  }
}

function 
onOpenNotes(){
  new 
GuiWindowCtrl("notes_Window1") {
    
profile = GuiBlueWindowProfile;
    
clientrelative = true;
    
clientextent = "508,330";
    
canclose=canminimize=canmaximize=canresize=false;
    
canmove=destroyonhide=true;
    
text = @ player.account @"'s Notes";
    
position = { 665, 340};

    
//Writing board
    
new GuiScrollCtrl("Notes_note_Scroll") {
      
profile = GuiBlueScrollProfile;
      
hscrollbar = "alwaysOff";
      
vscrollbar = "dynamic";
      
extent = { 329, 252};
      
position = { 0, 48};

     new 
GuiMLTextEditCtrl("Notes_note") {
        
profile = GuiBlueMLTextProfile;
        
horizsizing = "width";
        
text = "What you want to write down?";
        
position = { 0, 0};
        
extent = { 300, 16};
      }
    }
    
    
//Title
    
new GuiScrollCtrl("Notes_title_Scroll") {
      
profile = GuiBlueScrollProfile;
      
hscrollbar = "alwaysOff";
      
vscrollbar = "alwaysOff";
      
position = { 83, 305};
      
extent = { 161, 18};
      
   new 
GuiMLTextEditCtrl("Notes_title") {
      
profile = GuiBlueMLTextProfile;
      
horizsizing = "width";
      
text = "Title";
      
position = { 5, 0};
      
extent = { 300, 16};
     }
   }
   
    
//Boxes
    
new GuiCheckBoxCtrl("Notes_boxTodo") {
      
profile = GuiBlueCheckBoxProfile;
      
checked = true;
      
text = "To do";
      
extent = { 100, 20};
      
position = { 0, 0};
    }
    new 
GuiCheckBoxCtrl("Notes_boxImp") {
      
profile = GuiBlueCheckBoxProfile;
      
text = "Importand";
      
extent = { 100, 20};
      
position = { 0, 15};
    }
    new 
GuiCheckBoxCtrl("Notes_boxDone") {
      
profile = GuiBlueCheckBoxProfile;
      
text = "Done";
      
extent = { 100, 20};
      
position = { 0, 30};
    }
    
    
//Buttons
    
new GuiButtonCtrl("Notes_bsave") {
      
profile = GuiBlueButtonProfile;
      
alpha = 0.879999995;
      
text = "Apply";
      
position = { 0, 300};
      
extent = { 80, 30};
    }
    new 
GuiButtonCtrl("Notes_bclose") {
      
profile = GuiBlueButtonProfile;
      
alpha = 0.879999995;
      
text = "Close";
      
position = { 428, 300};
      
extent = { 80, 30};
    }
    new 
GuiButtonCtrl("Notes_bdelete") {
      
profile = GuiBlueButtonProfile;
      
alpha = 1;
      
text = "Delete";
      
position = { 248, 300};
      
extent = { 80, 30};

    }
    
    
//List
   
new GuiScrollCtrl("Notes_listscroll") {
      
profile = GuiBlueScrollProfile;
      
position = { 330, 0};
      
extent = { 180, 300};
      
hScrollBar = "dynamic";
      
vScrollBar = "dynamic";
      
      new 
GuiTextListCtrl("Notes_list") {
        
profile = GuiBlueTextListProfile;
        
x = y = 0;
        
width = 140;
        
fitparentwidth = true;

        
clearrows();
        
player.notes.loadvars("Notes/"@player.account@".txt");
        for(
i=0;i<player.notes.list.size();i++)
        {
          
addrow(i,player.notes.list[i]);
        }
      }
    }
  
 }

}
  
  
function 
Notes_bclose.onAction() {
notes_Window1.destroy();
}

function 
Notes_bsave.onAction(){
  if (
Notes_title.text != "")
  {
    
player.notes.loadvars("Notes/"@player.account@".txt");
    if (
Notes_title.text in player.notes.list)
    {
      
player.notes.(@Notes_title.text).add(Notes_note.text);
    }
    else
    {
      
player.notes.list.add(Notes_title.text);
      
player.notes.(@Notes_title.text).add(Notes_note.text);
    }
    
player.notes.savevars("Notes/"@player.account@".txt", false);

    
with("Notes_list"){
      
clearrows();
      
player.notes.loadvars("Notes/"@player.account@".txt");
      for(
i=0;i<player.notes.list.size();i++)
      {
        
addrow(i,player.notes.list[i]);
      }
    }
    
Notes_title.text = "";
    
Notes_note.text = "";

  }
}

function 
Notes_bdelete.onAction(){
  if (
Notes_title.text != "")
  {
    
player.notes.list.remove(Notes_title.text);
    
player.notes.(@Notes_title.text) = "";
    
player.notes.savevars("Notes/"@player.account@".txt", false);
    
with("Notes_list"){
      
clearrows();
      
player.notes.loadvars("Notes/"@player.account@".txt");
      for(
i=0;i<player.notes.list.size();i++)
      {
        
addrow(i,player.notes.list[i]);
      }
    }
    
Notes_title.text = "";
    
Notes_note.text = "";
  }
}

function 
Notes_list.onSelect(id,text,indx){ 
  
player.notes.loadvars("Notes/"@player.account@".txt"); 
  
Notes_title.text = player.notes.list[id]; 
  
this.txt = player.notes.(@Notes_title.text); 

  
Notes_note.text = this.txt;
} 
Attached Thumbnails
Click image for larger version

Name:	gui.png
Views:	196
Size:	11.4 KB
ID:	48142  
__________________
“Peace cannot be kept by force. It can only be achieved by understanding.” – Albert Einstein
Reply With Quote