Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   phones! (https://forums.graalonline.com/forums/showthread.php?t=80384)

[email protected] 07-06-2008 09:43 AM

phones!
 
so i am re-making payphones on Era, it all works fine [kinda]. The two phones connect to each other, but the text on the phone i am calling doesn't change, i've debugged it and it changes all the flags to what they need to be [even changes the 'c'] yet the text refuses to change.

HTML Code:

function onCreated() {
  this.setImg("phone_booth-1.gif");
  this.setShape(1, 32, 64);
  this.drawunderplayer(); 
 
  this.phonestatus = "idle";
  this.linebusy = this.incomingcall = this.callingphone = false;
  this.updateChat();
}

public function updateChat() {
  temp.c = "";
  if (!this.number) c = "Awaiting Registration";
  elseif (this.number) c = this.number;
  if (this.linebusy) c = this.dialnum SPC "Busy";
  if (this.callingphone) c = "Calling" SPC this.dialnum;
  if (this.incomingcall) c = "Caller" SPC this.dialnum;

  this.chat = "(Eracom:" SPC c @ ")";
}

function onPlayerChats() {
  if (player.chat == "reset") this.onCreated();
}

function onActionGrab() {
  if (!this.number) {
    if (!player.chat.starts(":")) return false; 
    if (player.clientr.staff < 3) return false;

    temp.chat = player.chat.substring(1);
    temp.tok = chat.tokenize();
   
    DB_PayPhones.trigger("AddPhone", this.name, tok[0], chat.substring(tok[0].length() + 1));
    return true;
  } 
 
  if (this.incomingcall) {
    this.acceptCall();
    return true;
  }
 
  if (player.chat == null) return false;
  if (player.chat == this.number) return false;
 
  if (player.chat in DB_PayPhones.numbers) {
    temp.npc = DB_PayPhones.("p_" @ player.chat);
    this.cphone = findNPC(npc[0]);
 
    this.dialnum = player.chat;
   
    switch(this.cphone.getStatus()) {
      case "idle": this.sendCall(); break;
      case "busy": this.linebusy = true; break;
    }
   
    this.owner = player;
    this.updateChat();
  }
}

public function getStatus() {
  return this.phonestatus;
}

public function sendCall() {
  this.cphone.trigger("IncomingCall", this.name);
  this.phonestatus = "busy";
  this.callingphone = true;


public function onIncomingCall(temp.npc) {
  this.phonestatus = "busy";
  this.incomingcall = true;
  this.cphone = findNPC(npc);

  this.updateChat();
  //This is the problem... I've tried everything
}

public function acceptCall() {
  this.owner = player;
  this.cPhone.trigger("StartCall", "");
  this.chat = "(Call Established)" SPC this.cPhone;
  //However, once I grab it this part works....
}

public function onStartCall() {
  this.chat = "Call's created between" SPC this.cPhone;
}
 
public function assignNumber(temp.num, temp.desc) {
  this.number = num;
  this.description = desc;
  this.updateChat();
}

function onActionStaffStick() {
  this.DestroyPhone();
}

public function DestroyPhone() {
  DB_PayPhones.trigger("DestroyPhone", this.number, this.description);
  this.destroy();
}

//#CLIENTSIDE
function onCreated() {
  setshape2(2, 3, {
    22, 22,
    22, 22,
    22, 22
  });
}


Chompy 07-06-2008 10:29 AM

So in updateChat it doesn't set the chat of the phone/npc?

( this.chat = "(Eracom:" SPC c @ ")"; )
But it sets the variable c correctly and all?

Hmm, tried message()?

Skyld 07-06-2008 10:30 AM

You mean you broke the system I made on Era already?

TSAdmin 07-06-2008 10:40 AM

Quote:

Originally Posted by Skyld (Post 1401132)
You mean you broke the system I made on Era already?

No, he didn't. I've added tid-bits to your payphone class, and those are currently re-released, but there are a few bugs in it (although minor, can sometimes be rather annoying) that prompted Andy to check it out, and as he did, he found another bug (Again, chat related), and he decided he wished to just create a new version and see how it fared :P

[email protected] 07-06-2008 12:22 PM

Quote:

Originally Posted by Chompy (Post 1401131)
So in updateChat it doesn't set the chat of the phone/npc?

( this.chat = "(Eracom:" SPC c @ ")"; )
But it sets the variable c correctly and all?

Hmm, tried message()?

correct, not work ^^ [c is set]


the one on Era uses a timeout when really there isn't a point... i also wanted to try it


All times are GMT +2. The time now is 06:31 PM.

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