Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 04-05-2007, 03:39 AM
Rapidwolve Rapidwolve is offline
Registered User
Join Date: Jul 2006
Posts: 1,241
Rapidwolve is an unknown quantity at this point
Yet Another Chat System

I just started on this. I'll probobly be done with everything by tommorow

PHP Code:
function onActionServerside(action){
  switch (
action){
    case 
"SendMessage":
    
SendMessage(player.accountparams[1], params[2]);
    break;
    
    case 
"BlockBuddy":
      if (
player.clientr.messaging_blocked.index(params[1]) < 0){
        
player.clientr.messaging_blocked.add(params[1]);
        
player.addMessage(format(_("%s was added to your block list"), params[1]));
      }
    break;
   }
}

public function 
SendMessage(fromtomessage){
 
temp.phead findPlayer(temp.from).headimg;
 
findPlayer(temp.to).triggerClient("gui"name"ReceivedMessage"temp.fromtemp.messagetemp.phead);
}
//#CLIENTSIDE
function onCreated()
  
CreateVariables();
  
function 
CreateVariables(){
join("functions_system");
this.defaultprofile "GuiBlue";
this.buttons = {"BuddyInfo""Block""Warn"};
this.buttonextent 60;
this.buttondistance 2;
}

function 
onActionClientside(action){
  switch (
action){
    case 
"ReceivedMessage":
    
drawText(format(/*"<%img src=%s offsetx=3 offsety=69 height=32 width=32 />*/"<b><font color=\"red\">%s:</b></font>"/*params[3],*/ params[1]), params[1]);
    
drawText(params[2], params[1]);
    break;
  }
}

function 
onPlayerChats(){
  if (
player.chat.starts(":im")){
    
temp.recipient player.chat.substring(4);
      if (
GetStatus(temp.recipient)){
        
drawWindow(temp.recipient);
    }
  }
}

function 
GetStatus(recipient){
  
temp.notBlocked = ((findPlayer(temp.recipient).clientr.messaging_blocked.index(player.account)) < 0);
  
temp.isOnline = (findPlayer(temp.recipient).account true false);
  
temp.canIM = (temp.notBlocked && temp.isOnline);
  return 
temp.canIM;
}

function 
drawWindow(recipient){
  if (
temp.recipient.length() < 2) return player.chat "Error";
  if ((
"IMWindow_" temp.recipient).visible) return;
  new 
GuiWindowCtrl("IMWindow_" temp.recipient){
    
profile format("%sWindowProfile"thiso.defaultprofile);
    
extent = {350300};
    
canResize canMaximize false;
    
title true;
    
text "Instant Message - " temp.recipient;
    
visible true;
    
    new 
GuiScrollCtrl("IMScroll_" temp.recipient){
      
profile format("%sScrollProfile"thiso.defaultprofile);
      
position = {624};
      
hScrollBar "alwaysOff";
      
vScrollbar "dynamic";
      
extent = {(this.parent.width 12), (this.parent.height 57)};
    
      new 
GuiMLTextCtrl("IMText_" temp.recipient){
        
profile format("%sTextProfile"thiso.defaultprofile);
        
extent = {(parent.width 6), 0};
        
text format("<b> Chat with %s, Started %i:%i:%i. All times are GMT</b>"temp.recipientgetRealTime(010)[0], getRealTime()[1], getRealTime()[2]);
      }
    }
    
    new 
GuiTextEditCtrl("IMTextEdit_" temp.recipient){
      
profile format("%sTextEditProfile"thiso.defaultprofile);
      
position = {6, (this.parent.height 31.5)};
      
text "";
      
extent = {((this.parent.width) - (20 thiso.buttons.size() * thiso.buttonextent thiso.buttondistance)), 25}; 
      
thiso.catchevent(this.name"onAction""SendMessage");
      
historySize 100;
    }
    for (
temp.0temp.thiso.buttons.size(); temp.i++){
      new 
GuiButtonCtrl("IMButton_" temp.recipient "_" thiso.buttons[temp.i]){
       
profile format("%sButtonProfile"thiso.defaultprofile);
       
position = {(((this.parent.width 60 thiso.buttonextent)/ thiso.buttons.size()) + (* (thiso.buttonextent thiso.buttondistance))), (this.parent.height 31.5)};
       
extent = {thiso.buttonextent25};
       
text thiso.buttons[temp.i];
       
thiso.catchevent(this.name"onAction""ButtonPressed");
      }
    }
  }
}

function 
ButtonPressed(){
  
temp.buttonName params[0].substring(params[0].positions("_")[params[0].positions("_").size()-1] + 1);
  
temp.buttonParent params[0].parent;
  (
"Button" temp.buttonName)(temp.buttonParent);
}

function 
SendMessage(control) {
  
temp.textcontrol makevar("IMText_" temp.recipient);
    if (
temp.control.text.length() < 1) return;
  
temp.recipient temp.control.substring(("IMTextEdit_").length());
  
drawText(format(/*"<img src=%s offsetx=3 offsety=69 width=26 height=23 />*/"<b><font color=\"blue\">%s:</b></font>"/*player.headimg,*/ player.account), temp.recipient);
  
drawText(temp.control.texttemp.recipient);
  
triggerServer("gui"name"SendMessage"temp.recipienttemp.control.text);
  
temp.control.text "";
}

function 
drawText(textrecipient){
  if (
temp.text.length() < 1) return;
   
temp.window makevar("IMWindow_" temp.recipient);
   
temp.control makevar("IMText_" temp.recipient);
  if (!
temp.window.visibledrawWindow(temp.recipient);
   
temp.control.addText("\n" SPC temp.texttrue);
   
temp.control.scrolltoBottom();
}

function 
ButtonClose(window)
  (
temp.window).destroy();

function 
ButtonWarn(window)
  return;

function 
BuddyInfo()
  return;

function 
ButtonBlock(window){
  
temp.recipientName temp.window.substring(("IMWindow_").length());
    if (
temp.recipientName == player.account) return player.addMessage("You cannot block yourself");
  
triggerServer("gui"name"BlockBuddy"temp.recipientName);
  (
temp.window).destroy();

Ever since I saw Chandlers I realized how much I wanted to make my own lol,
anyways I removed displaying of heads as it was buggy. Just say :im <acc>
to start a conversation, make sure they have the weapon.
Reply With Quote
  #2  
Old 04-09-2007, 10:14 PM
Rapidwolve Rapidwolve is offline
Registered User
Join Date: Jul 2006
Posts: 1,241
Rapidwolve is an unknown quantity at this point
Major Update

Next im going to disable all html tags and create a custom text editor and smiley inserter, not gonna release the script until its done because there are a couple minor (but annoying) bugs.
Attached Thumbnails
Click image for larger version

Name:	rapidwolve_chatsystem.png
Views:	328
Size:	6.0 KB
ID:	40515  
Reply With Quote
  #3  
Old 04-09-2007, 10:15 PM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
Haha, that does look pretty nifty, hehe
Reply With Quote
  #4  
Old 04-09-2007, 11:31 PM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
That looks very nice, though I fear it's rather unecessary and won't be used.



Great job on it so far, by all means don't quit, but personally, I don't even like using Client-RC for the mere fact that it's stuck to my client. The last thing I would want is a custom PM system that takes up space in my screen.


But, just a personal opinion. Regardless, you should finish it
Reply With Quote
  #5  
Old 04-10-2007, 07:41 AM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
Quote:
Originally Posted by Gambet View Post
That looks very nice, though I fear it's rather unecessary and won't be used.



Great job on it so far, by all means don't quit, but personally, I don't even like using Client-RC for the mere fact that it's stuck to my client. The last thing I would want is a custom PM system that takes up space in my screen.


But, just a personal opinion. Regardless, you should finish it
You're wrong.
Reply With Quote
  #6  
Old 04-10-2007, 08:02 AM
contiga contiga is offline
Graal2001 Administration
contiga's Avatar
Join Date: Jul 2004
Location: Netherlands
Posts: 419
contiga is an unknown quantity at this point
Send a message via ICQ to contiga Send a message via AIM to contiga Send a message via MSN to contiga Send a message via Yahoo to contiga
Quote:
Originally Posted by Gambet View Post
That looks very nice, though I fear it's rather unecessary and won't be used.
I like it very much and I think it IS going to be used, it's easy for instant-talking to a player in some other level without having to double click a player in the playerlist, type, click send OR having to rightclick, click: history to see what you've said. It's all in one small window inside screen now which is easy for when you're fullscreen for example.
__________________
AIM: Contiga122
MSN: [email protected]
Status:
Quote:
Originally Posted by unixmad View Post
I am also awake 3AM to help correct problems.
Quote:
Originally Posted by Bomy Island RC people
Daniel: HoudiniMan is a bad guy =p
*Bell: rofl. I first read that as houdini is a bad man. like the little kid that wants his mommy to keep her away from that boogie man
Daniel: xD
*Rufus: I wouldn't want my kids around him.
Reply With Quote
  #7  
Old 04-10-2007, 08:32 AM
smirt362 smirt362 is offline
Tee Hee
smirt362's Avatar
Join Date: Feb 2005
Location: Texas
Posts: 2,101
smirt362 has a brilliant futuresmirt362 has a brilliant futuresmirt362 has a brilliant futuresmirt362 has a brilliant futuresmirt362 has a brilliant futuresmirt362 has a brilliant futuresmirt362 has a brilliant future
Send a message via AIM to smirt362 Send a message via MSN to smirt362
I like it very much, I would like to see it implemented on some of the main servers.
__________________

Don Hertzfeldt <3
Reply With Quote
  #8  
Old 04-10-2007, 02:14 PM
Novo Novo is offline
[TServerDeveloper]
Join Date: Jun 2006
Posts: 448
Novo will become famous soon enough
Thumbs up here!
Reply With Quote
  #9  
Old 04-10-2007, 02:25 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Custom transparency And perhaps have a GAT make a less 'bulky' gui graphic than the default.
Reply With Quote
  #10  
Old 04-10-2007, 06:25 PM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
I'd use this on Era
Reply With Quote
  #11  
Old 04-11-2007, 01:18 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
This is VERY NICE! I love it! Keep up the good work, I may have to make something similar. Good use of GUIs.
__________________
Reply With Quote
  #12  
Old 04-11-2007, 01:57 AM
Rapidwolve Rapidwolve is offline
Registered User
Join Date: Jul 2006
Posts: 1,241
Rapidwolve is an unknown quantity at this point
Quote:
Originally Posted by smirt362 View Post
I like it very much, I would like to see it implemented on some of the main servers.
Quote:
Originally Posted by Chandler View Post
I'd use this on Era
I would love to see me log on a server and its there, thats why once its done I will release everything.

Next on my list is to add text manipulation functions, replace icons, a more graal friendly GUI profile, and create a smiley set (I was going to use graal's PM default but I changed my mind), but I need to find a Graphics Designer for most of those.

Last edited by Rapidwolve; 04-11-2007 at 02:37 AM..
Reply With Quote
  #13  
Old 04-13-2007, 04:29 AM
Rapidwolve Rapidwolve is offline
Registered User
Join Date: Jul 2006
Posts: 1,241
Rapidwolve is an unknown quantity at this point
Released a preview build on Zodiac.

Snapshot:
Reply With Quote
  #14  
Old 04-13-2007, 04:42 AM
xXziroXx xXziroXx is offline
Master of Puppets
xXziroXx's Avatar
Join Date: May 2004
Location: Sweden
Posts: 5,288
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Send a message via AIM to xXziroXx Send a message via MSN to xXziroXx
Ahahaha! You just HAD to get a screenie of me exploiting HTML tags didnt you?
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
Reply With Quote
  #15  
Old 04-13-2007, 06:38 AM
Bl0nkt Bl0nkt is offline
Era Developer
Bl0nkt's Avatar
Join Date: Mar 2005
Location: Pennsylvania
Posts: 1,589
Bl0nkt will become famous soon enough
Send a message via AIM to Bl0nkt
how do u get rid of this?
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 08:24 AM.


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