Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Code Gallery (https://forums.graalonline.com/forums/forumdisplay.php?f=179)
-   -   Message System (https://forums.graalonline.com/forums/showthread.php?t=84283)

[email protected] 02-18-2009 09:27 PM

Message System
 
HTML Code:

//#CLIENTSIDE
function onCreated() {
  this.onAddMessage("Welcome to [Dunno...]" SPC player.nick @ "!", "bu", "red");
  this.onAddMessage("Message System Test" SPC player.nick @ "!", "bi", "pink");
}

function onActionClientside(m) {
  this.onAddMessage(m[0], m[1], m[2]);
}

function onAddMessage(msg, style, color) {
  this.msgs.insert(0, {msg, style, color, timevar2 + 5});
  this.onDisplayMessages();
}

function onDisplayMessages() {
  hideimgs(200, 230);
  for (temp.i: this.msgs) {
    temp.p = {screenwidth / 2, screenheight - 45 - (temp.c * 18)};
    temp.n = showtext(200 + temp.c, p[0], p[1], "", i[1] @ "c", i[0]);
    temp.n.layer = 4;
    temp.n.zoom = 0.6;
    temp.c++;   
  }
   
  setTimer(1);
}

function onTimeout() {
  if (this.msgs == null) return;
 
  temp.list = this.msgs;
  this.msgs = null;
  for (temp.i: temp.list) {
    if (timevar2 > i[3]) continue;
    this.msgs.add(i);
  }
  this.onDisplayMessages();
  setTimer(0.5); 
}

I didn't finish the color part, but here's the basic. It'll display the message in the middle of the screen (at the bottom). ^^


All times are GMT +2. The time now is 09:42 AM.

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