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.catchevent( this.name , "onAction" , "onSendMessage" );
}
}
That should trigger this Event:
PHP Code:
function onSendMessage( obj ) {
temp.a = obj.tokenize("$")[1];
temp.b = ( "Chat_MultiLineEdit1$" @ temp.a ).text;
if ( temp.b.starts("/") ) {
if ( temp.b == "/clear" ) {
( "Chat_MultiLineEdit1$" @ temp.a ).text = "";
( "Chat_MultiLine1$" @ temp.a ).text = "<u>Chat history with " @ temp.a @"</u>";
}
else ( "Chat_MultiLineEdit1$" @ temp.a ).text = "Unknown command.";
}
else {
if ( temp.b.pos("<") == -1 ) {
if ( temp.b.length() >= 1 ) {
( "Chat_MultiLineEdit1$" @ temp.a ).text = "";
( "Chat_MultiLine1$" @ temp.a ).text @= "<br><b>" @ player.account @ ":</b> " @ temp.b;
( "Chat_MultiLine1$" @ temp.a ).scrolltobottom();
triggerServer("gui",name,"SendMessage",temp.a,player.account,temp.b);
}
}
else ( "Chat_MultiLineEdit1$" @ temp.a ).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 :]