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 = { 665340};

    
//Writing board
    
new GuiScrollCtrl("Notes_note_Scroll") {
      
profile GuiBlueScrollProfile;
      
hscrollbar "alwaysOff";
      
vscrollbar "dynamic";
      
extent = { 329252};
      
position = { 048};

     new 
GuiMLTextEditCtrl("Notes_note") {
        
profile GuiBlueMLTextProfile;
        
horizsizing "width";
        
text "What you want to write down?";
        
position = { 00};
        
extent = { 30016};
      }
    }
    
    
//Title
    
new GuiScrollCtrl("Notes_title_Scroll") {
      
profile GuiBlueScrollProfile;
      
hscrollbar "alwaysOff";
      
vscrollbar "alwaysOff";
      
position = { 83305};
      
extent = { 16118};
      
   new 
GuiMLTextEditCtrl("Notes_title") {
      
profile GuiBlueMLTextProfile;
      
horizsizing "width";
      
text "Title";
      
position = { 50};
      
extent = { 30016};
     }
   }
   
    
//Boxes
    
new GuiCheckBoxCtrl("Notes_boxTodo") {
      
profile GuiBlueCheckBoxProfile;
      
checked true;
      
text "To do";
      
extent = { 10020};
      
position = { 00};
    }
    new 
GuiCheckBoxCtrl("Notes_boxImp") {
      
profile GuiBlueCheckBoxProfile;
      
text "Importand";
      
extent = { 10020};
      
position = { 015};
    }
    new 
GuiCheckBoxCtrl("Notes_boxDone") {
      
profile GuiBlueCheckBoxProfile;
      
text "Done";
      
extent = { 10020};
      
position = { 030};
    }
    
    
//Buttons
    
new GuiButtonCtrl("Notes_bsave") {
      
profile GuiBlueButtonProfile;
      
alpha 0.879999995;
      
text "Apply";
      
position = { 0300};
      
extent = { 8030};
    }
    new 
GuiButtonCtrl("Notes_bclose") {
      
profile GuiBlueButtonProfile;
      
alpha 0.879999995;
      
text "Close";
      
position = { 428300};
      
extent = { 8030};
    }
    new 
GuiButtonCtrl("Notes_bdelete") {
      
profile GuiBlueButtonProfile;
      
alpha 1;
      
text "Delete";
      
position = { 248300};
      
extent = { 8030};

    }
    
    
//List
   
new GuiScrollCtrl("Notes_listscroll") {
      
profile GuiBlueScrollProfile;
      
position = { 3300};
      
extent = { 180300};
      
hScrollBar "dynamic";
      
vScrollBar "dynamic";
      
      new 
GuiTextListCtrl("Notes_list") {
        
profile GuiBlueTextListProfile;
        
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