Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 09-17-2011, 09:40 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
This interested me enough to make something "working" the catch is that it's very in-efficient though since it's basically just sending the entire text back and forth instead of determining what's different then sending the only changes instead.

Text isn't stored on the server-side either.

PHP Code:
function onActionServerSide() {
  if (
params[0] == "update") {
    for (
temp.aallplayers) {
      if (
temp.== player) continue;
      if (
this in temp.a.weapons) {
        
temp.a.triggerclient(this.name"updated"params[1]);
      }
    }
  }
}

//#CLIENTSIDE

function onCreated() {
  new 
GuiWindowCtrl("Notepad_Window") {
    
profile GuiBlueWindowProfile;
    
clientrelative true;
    
clientextent "559,520";

    
canmaximize false;
    
canminimize false;
    
canmove true;
    
canresize true;
    
closequery false;
    
canresize false;
    
destroyonhide false;
    
text "Online Notepad";
    
= (screenwidth width) / 2;
    
100;

    new 
GuiScrollCtrl("Notepad_Scroll") {
      
profile GuiBlueScrollProfile;
      
height 494;
      
hscrollbar "dynamic";
      
vscrollbar "dynamic";
      
width 559;
      
25;

      new 
GuiMLTextEditCtrl("Notepad_Multiline") {
        
profile GuiBlueMLTextEditProfile;
        
height 17;
        
horizsizing "width";
        
text "";
        
width 534;
      }
    }
    new 
GuiTextCtrl("Notepad_Text") {
      
profile GuiBlueTextProfile;
      
height 20;
      
text "Active Collaboration";
      
width 432;
      
4;
      
2;
    }
  }
}

function 
onActionClientSide() {
  if (
params[0] == "updated") {
    
// Save Cursor Position
    
temp.old_cursor Notepad_Multiline.cursorposition;
    
// Update Text with Changes
    
Notepad_Multiline.text params[1];
    
// Restore Cursor Position
    
Notepad_Multiline.cursorposition temp.old_cursor;
    
// Update Last Width and Text
    
this.last Notepad_Multiline.text.length();
    
this.last_text Notepad_Multiline.text;
  }
}

// There is no onTextChanged for GuiMLTextCtrl
// Change in text does cause it be 'Reflowed' though.
function Notepad_Multiline.onReflow() {
  
// Check if text has changed
  
if (this.last != Notepad_Multiline.text.length()) {
    
// Text Changed
    
onTextChanged();
    
// Update Last Width and Text
    
this.last Notepad_Multiline.text.length();
    
this.last_text Notepad_Multiline.text;
  }
}

// Determine and Handle Changes Here
function onTextChanged() {
  
temp.new_text Notepad_Multiline.text;
  
temp.old_text this.last_text.link();
  
triggerserver("gui"name"update"temp.new_text);

__________________
Quote:
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 10:00 AM.


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