Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > Code Gallery
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 04-19-2009, 09:53 AM
Nature2 Nature2 is offline
Registered User
Nature2's Avatar
Join Date: May 2005
Location: Germany
Posts: 171
Nature2 will become famous soon enough
Send a message via ICQ to Nature2 Send a message via AIM to Nature2 Send a message via MSN to Nature2 Send a message via Yahoo to Nature2
Simple Online-Notepad

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

Attached Thumbnails
Click image for larger version

Name:	online-notepad.png
Views:	219
Size:	54.0 KB
ID:	48170  
__________________

Last edited by Tigairius; 04-19-2009 at 10:16 AM.. Reason: Removed GK-Specific functions
Reply With Quote
  #2  
Old 04-19-2009, 10:09 AM
Schetti Schetti is offline
SC2 Player
Schetti's Avatar
Join Date: Nov 2008
Location: Austria
Posts: 269
Schetti is on a distinguished road
I am working on something simmilary just with other saving.
I think yours is better, because mine wont work
__________________
“Peace cannot be kept by force. It can only be achieved by understanding.” – Albert Einstein
Reply With Quote
  #3  
Old 04-19-2009, 10:11 AM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
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)
__________________
Reply With Quote
  #4  
Old 04-19-2009, 10:17 AM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
Nice
__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote
  #5  
Old 04-19-2009, 10:19 AM
Schetti Schetti is offline
SC2 Player
Schetti's Avatar
Join Date: Nov 2008
Location: Austria
Posts: 269
Schetti is on a distinguished road
Quote:
Originally Posted by Chompy View Post
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*
__________________
“Peace cannot be kept by force. It can only be achieved by understanding.” – Albert Einstein
Reply With Quote
  #6  
Old 04-19-2009, 10:35 AM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by Schetti View Post
Read the last post in that thread, *cough*
__________________
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 06:26 PM.


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