Graal Forums  

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

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 07-20-2008, 07:32 PM
The_Kez The_Kez is offline
N-Pulse Asst. Manager
The_Kez's Avatar
Join Date: Dec 2007
Posts: 106
The_Kez is on a distinguished road
Send a message via MSN to The_Kez
Few questions

I have just a couple questions (mostly dealing with GUI stuff) and I don't really want to make three different topics, so I'll just do it all here.

First of all, about using onAction to check if the return key has been pressed in a text edit control, (I've decided to script a sort of instant-messaging thing just to test GUI functionalities) I have a dynamic GUI:

PHP Code:
    new GuiScrollCtrl"Chat_MultiLineEdit1_Scroll$" acct ) {
      
//scroll stuff
      
      
new GuiMLTextEditCtrl"Chat_MultiLineEdit1$" acct ) {
        
//textedit stuff
        
thiso.catcheventthis.name "onAction" "onSendMessage" );
      }
    } 
That should trigger this Event:

PHP Code:
function onSendMessageobj ) {
  
temp.obj.tokenize("$")[1];
  
temp.= ( "Chat_MultiLineEdit1$" temp.).text;
  if ( 
temp.b.starts("/") ) {
    if ( 
temp.== "/clear" ) {
      ( 
"Chat_MultiLineEdit1$" temp.).text "";
      ( 
"Chat_MultiLine1$" temp.).text "<u>Chat history with " temp.@"</u>";
    }
    else ( 
"Chat_MultiLineEdit1$" temp.).text "Unknown command.";
  }
  else {
    if ( 
temp.b.pos("<") == -) {
      if ( 
temp.b.length() >= ) {
        ( 
"Chat_MultiLineEdit1$" temp.).text "";
        ( 
"Chat_MultiLine1$" temp.).text @= "<br><b>" player.account ":</b> " temp.b;
        ( 
"Chat_MultiLine1$" temp.).scrolltobottom();
        
triggerServer("gui",name,"SendMessage",temp.a,player.account,temp.b);
      }
    }
    else ( 
"Chat_MultiLineEdit1$" temp.).text "HTML tags are not allowed.";
  }

I have a 'send' button that uses catchevent to send a message, and that triggers perfectly, but I'd rather be able to press 'enter' instead of clicking send every time to send a message.
Only the send button sends the trigger though, for some reason pressing return in a textedit doesn't seem to be invoking onAction. I've tried using autoindent = false, incase maybe indenting is causing it to not sent onAction or something, but that didn't seem to help.


Second question, can anyone explain how TextList columns work; how to add a column and choose which column to add text to, etc.? I've looked up the syntax on the graalwiki and graalbible and I've seen how they're supposed to be set up but didn't really understand the explanation for that since there wasn't any sort of example of them being used.

Third, I have a scrit that uses loadLines to load files from a text file into an array. LoadLines works perfectly, and I can retrieve the data and use it just fine. When I try to use saveLines on the exact same file, nothing seems to save to the files. It's like it can only read from the file and not write to it.
I've double checked that the NPC server has write rights, this is the exact line from the folder rights for (npcserver):
rw logs/profiles/*.txt
So it should be able to both read from and write to the file. Anyone else having this problem?

Thanks :]
Reply With Quote
 


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 02:43 PM.


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