Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Code Gallery (https://forums.graalonline.com/forums/forumdisplay.php?f=179)
-   -   Simple Online-Notepad (https://forums.graalonline.com/forums/showthread.php?t=85216)

Nature2 04-19-2009 09:53 AM

Simple Online-Notepad
 
1 Attachment(s)
Thats a very simple online-notepad with a simple save function that saves the strings to your account as client.blah = blah.
copy it into a weapon and press "-"

im sure it could be better but lets keep it simple ;P


PHP Code:

//#CLIENTSIDE

function onKeyPressed(keycharcharacter)

  if (
character == "-"){
  
notepad();
 } 
function 
notepad() {
//Main Window
  
new GuiWindowCtrl("Main_Window") {
    
profile GuiWindowProfile;
    
clientrelative true;
    
clientextent "320,310";

    
canclose false;
    
canmove true;
    
canminimize false;
    
canmaximize false;
    
canresize false;
    
closequery false;
    
destroyonhide false;
    
text "Online Notepad -" SPC player.account;
    
450;
    
180;
//CLose Button
    
new GuiButtonCtrl("Close_Button") {
      
profile GuiButtonProfile;
      
text "Close";
      
width 80;
      
height 20;
      
240;
      
291;
    }
    
//Select Window(Combo)
   
new GuiPopUpMenuCtrl("Select_Combo") {
      
profile GuiPopUpMenuProfile;
      
textprofile GuiTextListProfile;
      
scrollprofile GuiScrollProfile;
      
110;
      
291;
      
width 100;
      
height 20;
    
//Available Select
  
clearrows();
    
addrow(0,"Personal Notes"); //client.note
    
addrow(1,"My Kingdom"); //client.note_kingdom
    
addrow(2,"Buddys");//client.note_buddys
    
addrow(3,"Events");//client.note_events
    
addrow(4,"Trading");//client.note_trading
  
setSelectedRow(0);
}  
//Save Button
    
new GuiButtonCtrl("Save_Button") {
      
profile GuiButtonProfile;
      
text "Save";
      
width 80;
      
height 20;
      
291;
    }
    
//Text Field
    
new GuiScrollCtrl("Scroll_Field") {
      
profile GuiScrollProfile;
      
height 292;
      
hscrollbar "dynamic";
      
vscrollbar "dynamic";
      
width 320;
//Notepad text display
      
new GuiMLTextEditCtrl("Notepad_Text") {
        echo(
"Test");
        
profile GuiMLTextEditProfile;
        
height 16;
        
horizsizing "width";
        
text "NO NOTES LOADED";
        
width 295;
      }
    }
  }
}

function 
Close_Button.onAction() {
if(
client.note_dontask == 1){

Main_Window.destroy();
} else {
//Warning Window
  
new GuiWindowCtrl("Warning_Window1") {
    
profile GuiWindowProfile;
    
clientrelative true;
    
clientextent "253,106";

    
canclose false;
    
canmove true;
    
canresize true;
    
closequery false;
    
destroyonhide false;
    
text "Warning!";
    
524;
    
235;
//Yes window
    
new GuiButtonCtrl("Warning_Button1") {
      
profile GuiButtonProfile;
      
text "Yes";
      
width 80;
      
19;
      
51;
    }
    
//No window
    
new GuiButtonCtrl("Warning_Button2") {
      
profile GuiButtonProfile;
      
text "No";
      
width 80;
      
154;
      
50;
    }
    
//warning text1
    
new GuiTextCtrl("Warning_Text1") {
      
profile GuiBlueTextProfile;
      
height 20;
      
text "Really Want to close?";
      
width 104;
      
79;
    }
    
//warning text2
    
new GuiTextCtrl("Warning_Text2") {
      
profile GuiBlueTextProfile;
      
height 20;
      
text "If you haven't saved, all changes will be lost!";
      
width 213;
      
21;
      
24;
    }
  }
}
//If yes pressed
function Warning_Button1.onAction() {
 
Warning_Window1.destroy();
 
Main_Window.destroy();
}
//if no pressed
function Warning_Button2.onAction() {
 
Warning_Window1.destroy();
 }
}
//if save pressed
function Save_Button.onAction() {

 if(
Select_Combo.getselectedid() == 0){

client.note Notepad_Text.gettext();
  
player.chat "Your personal notes are saved!";
 }
  if(
Select_Combo.getselectedid() == 1){

client.note_kingdom Notepad_Text.gettext();
  
player.chat "Your kingdom notes are saved!";
 }
   if(
Select_Combo.getselectedid() == 2){

client.note_buddys Notepad_Text.gettext();
  
player.chat "Your buddy notes are saved!";
 }
   if(
Select_Combo.getselectedid() == 3){

client.note_events Notepad_Text.gettext();
  
player.chat "Your event notes are saved!";
 }
   if(
Select_Combo.getselectedid() == 4){

client.note_trading Notepad_Text.gettext();
  
player.chat "Your trading notes are saved!";
 }
}
//if a section is selected
function Select_Combo.onSelect(entryid,entrytext,entryindex){

if(
entryid == 0){
Notepad_Text.text client.note;
 }
 if(
entryid == 1){
Notepad_Text.text client.note_kingdom;
 }
  if(
entryid == 2){
Notepad_Text.text client.note_buddys;
 }
  if(
entryid == 3){
Notepad_Text.text client.note_events;
 }
  if(
entryid == 4){
Notepad_Text.text client.note_trading;
 }



Schetti 04-19-2009 10:09 AM

I am working on something simmilary just with other saving.
I think yours is better, because mine wont work

Chompy 04-19-2009 10:11 AM

Well, seeing as player attributes (such as client. and clientr.) can hold more then 255 characters, it will get cut down when the player attributes are altered through RC.

I would suggest looking up usage of load/savelines() clientside :] (As it will save the file in the player's graal folder)

Tigairius 04-19-2009 10:17 AM

Nice :)

Schetti 04-19-2009 10:19 AM

Quote:

Originally Posted by Chompy (Post 1485100)
Well, seeing as player attributes (such as client. and clientr.) can hold more then 255 characters, it will get cut down when the player attributes are altered through RC.

I would suggest looking up usage of load/savelines() clientside :] (As it will save the file in the player's graal folder)

*cough* http://forums.graalonline.com/forums...ad.php?t=85148*cough*

Chompy 04-19-2009 10:35 AM

Quote:

Originally Posted by Schetti (Post 1485103)

Read the last post in that thread, *cough* ;)


All times are GMT +2. The time now is 05:38 AM.

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