Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 02-18-2009, 09:27 PM
[email protected] sid.gottlieb@googlemail.com is offline
Banned
Join Date: Mar 2008
Posts: 861
sid.gottlieb@googlemail.com will become famous soon enough
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).
Reply With Quote
Reply


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


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