Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Code Gallery (https://forums.graalonline.com/forums/forumdisplay.php?f=179)
-   -   Message System [middle of screen] (https://forums.graalonline.com/forums/showthread.php?t=78915)

xAndrewx 03-03-2008 12:16 PM

Message System [middle of screen]
 
Here's a message system, simply trigger the client to add a message.


Message Data = {"Message Type: [Guildmessage [green], normal [white]]", "Message Here", "Either Nickname or Account Name"}

PHP Code:

//#CLIENTSIDE
function onActionClientSide()
{
  
this.drawMessage( {params[2] @ ":" SPC params[1], "bc", (params[0] == "Guildmessage"? {0, 1, 0}: {1, 1, 1}) } );
}

function 
drawMessage(stuff)
{  
  
client.cMessages.insert(0, temp.stuff);
  if (
client.cMessages.size() >= 5)
  {
    
client.cMessages.delete(5);
  }

  
this.updateMessages();
}

function 
updateMessages()
{
  for (
temp.i: client.cMessages)
  {
    
temp.o++;
    
temp.width = textwidth(0.6, "Tahoma", temp.i[1], temp.i[0]);
  
    
showtext(300 + temp.o, (screenwidth / 2) + (temp.width / 2), (screenheight - 16) - (temp.o * 16), "Tahoma", temp.i[1], temp.i[0]);
    
changeimgvis(300 + temp.o, 4);
    
changeimgzoom(300 + temp.o, 0.6);
    
changeimgcolors(300 + temp.o, temp.i[2][0], temp.i[2][1], temp.i[2][2], 1);
    
    
this.("mode_" @ temp.o) = temp.i[2];
    
this.("fade_" @ temp.o) = 1;
  }
  
  if (
temp.o != null)
  {
    
scheduleevent( (temp.o / 15) + 3, "Fade", "");      
  }   
}
  
function 
onFade()
{
  
temp.i = client.cMessages.size();
    
  
this.("fade_" @ temp.i) -= 0.005;
  
  if (
this.("fade_" @ temp.i) <= 0)
  {
    
client.cMessages.delete(temp.i - 1);
    
this.updateMessages();
    
    return 
false;
  }
  
  
temp.g = this.("mode_" @ temp.i);
  
changeimgcolors(300 + temp.i, temp.g[0], temp.g[1], temp.g[2], this.("fade_" @ temp.i));
     
  
scheduleevent(0.05, "Fade", "");
} 


Dan 03-03-2008 05:40 PM

Quite simple x-x

Maybe add some wraptext thing to make it a little special atleast? >_<

Rapidwolve24 03-03-2008 11:45 PM

Quote:

Originally Posted by Dan (Post 1377701)
Maybe add some wraptext thing to make it a little special atleast? >_<

*Chuckles* :asleep:

Crow 03-04-2008 03:53 PM

Hm, I remember this from somewhere ;P
It's the old /toguild thing that was used on Era. I'm not sure, but dont you need permission to post that? I know that "rule" is stupid, but still.


All times are GMT +2. The time now is 08:20 PM.

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