Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 02-08-2008, 08:04 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
Callstack Problem

I'm trying to restrict functions in a player class using callstack, but when I try to do so, it returns

PHP Code:
temp.stack[0].scriptcallobject.name 
as the player's nick name when echoing, and not the weapon/class/npc it's being used from.

EG:
PHP Code:
<insert players nickuses the addItem function! 
echo's to NC instead of

PHP Code:
<insert name of weapon/class/npcuses the addItem function! 
The only way I can figure out how to avoid this was to move the function outside of the player class, but I really don't want to do that. Is there a way I can avoid this problem?
__________________
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 ·

Last edited by TSAdmin; 02-08-2008 at 08:22 AM..
Reply With Quote
  #2  
Old 02-08-2008, 03:51 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
I don't understand (as usual).

Are you trying to find what called addItem? If addItem is in the player class, and you want the players nick, something like ...

PHP Code:
public function addItemitemamm )
{
  echo( 
format"[percent]s ([percent]s) added themselves a weapon"this.nickthis.account ) );

Edit: forgive the [percent] -- cannot post percent symbols
__________________
Reply With Quote
  #3  
Old 02-08-2008, 05:36 PM
Dan Dan is offline
Daniel
Join Date: Oct 2007
Posts: 383
Dan is an unknown quantity at this point
Send a message via MSN to Dan
Maybe try findweapon(temp.stack[0].scriptcallobject).name
__________________
Reply With Quote
  #4  
Old 02-08-2008, 10:29 PM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
PHP Code:
public function getcallingobject() {
  
temp.callstack getcallstack();
  return 
temp.callstack[temp.callstack.size() - 3].scriptcallobject;

That function would return the object that calls the function that is calling getcallingobject().
__________________
Reply With Quote
  #5  
Old 02-24-2008, 04:33 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Not sure where the problem is, when its displaying the players name then its of course the player object which is calling the function. You can e.g. display the scriptcallobject.objecttype() to be sure it's the player, or the name of the function to know which function has called your function.

If it would be a weapon or npc then the name and objecttype() of the scriptcallobject wouldn't match the player.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 10:09 AM.


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