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 06-02-2009, 07:16 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
Deleting 'player.' objects

So, I'm storing items as

HTML Code:
  player.items.(id).(flag) = value;
Now, I'm wanting to delete the items from the player.items list
HTML Code:
  player.items.(@ temp.id).clearvars();
  player.items.(@ temp.id).clearemptyvars();
  player.items.(@ temp.id) = "";
Works fine, it clears all the sub flags of the object. Yay! However...

However, when I'm reading the objects var names, it's still showing the item ID in the list
HTML Code:
  player.items.getdynamicvarnames();
I thought using this
HTML Code:
  player.items.(@ temp.id) = "";
Would fix this, but it's not. Any ideas? thanks
Reply With Quote
  #2  
Old 06-02-2009, 07:36 PM
salesman salesman is offline
Finger lickin' good.
salesman's Avatar
Join Date: Nov 2008
Location: Colorado
Posts: 1,865
salesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud of
I actually had a similar problem yesterday but Tig helped me out.

Try setting it to "" first, and then doing clearemptyvars();
PHP Code:
player.items.(@ temp.id) = "";
player.items.clearemptyvars(); 
Also, I think in your case you should make sure the .clearemptyvars() is being called on the player.items object not the player.items.(@ temp.id) object.
Reply With Quote
  #3  
Old 06-02-2009, 07:45 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
Works a charm- you rock! Thanks =D
Reply With Quote
  #4  
Old 06-02-2009, 11:45 PM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
You can also do:

player.items.(@ temp.id) = new TStaticVar();
player.items.(@ temp.id).destroy();

Deletes the variable and all it's sub variables right there on the spot. You might have to do the player.items.(@ temp.id) = new TStaticVar(); before you add any subvariables to it though (which I always find is a good idea anyways if you are ever wanting to delete a mass of subvariables ever like so.
__________________
Do it with a DON!
Reply With Quote
  #5  
Old 06-03-2009, 06:44 AM
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
I find the whole idea of Graal having subvariables like this.blah.blah2 without this.blah being an object is ridiculous and I avoid it at all cost.
__________________
Reply With Quote
  #6  
Old 06-03-2009, 06:49 AM
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
Quote:
Originally Posted by Inverness View Post
I find the whole idea of Graal having subvariables like this.blah.blah2 without this.blah being an object is ridiculous and I avoid it at all cost.
I also think it is rather odd, but I do not avoid it as you do. I wish Graal fully supported objects (similar to Java's implementation). Inheritance would be very useful.
__________________
Reply With Quote
  #7  
Old 06-03-2009, 05:51 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
Great help the lot of you, thanks guys!
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 02:16 AM.


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