Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 07-06-2008, 09:43 AM
[email protected] sid.gottlieb@googlemail.com is offline
Banned
Join Date: Mar 2008
Posts: 861
sid.gottlieb@googlemail.com will become famous soon enough
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
  });
}
Reply With Quote
  #2  
Old 07-06-2008, 10:29 AM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
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()?
__________________
Reply With Quote
  #3  
Old 07-06-2008, 10:30 AM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
You mean you broke the system I made on Era already?
Reply With Quote
  #4  
Old 07-06-2008, 10:40 AM
TSAdmin TSAdmin is offline
Forum Moderator
TSAdmin's Avatar
Join Date: Aug 2006
Location: Australia
Posts: 1,980
TSAdmin has much to be proud ofTSAdmin has much to be proud ofTSAdmin has much to be proud ofTSAdmin has much to be proud ofTSAdmin has much to be proud ofTSAdmin has much to be proud of
Quote:
Originally Posted by Skyld View Post
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
__________________
TSAdmin (Forum Moderator)
Welcome to the Official GraalOnline Forums! Where sharing an opinion may be seen as a declaration of war!
------------------------
· User Agreement · Code of Conduct · Forum Rules ·
· Graal Support · Administrative Contacts ·
Reply With Quote
  #5  
Old 07-06-2008, 12:22 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
Quote:
Originally Posted by Chompy View Post
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
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 07:42 PM.


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