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-01-2006, 03:24 AM
KuJi KuJi is offline
Banned
Join Date: Apr 2004
Location: Staten Island, New York
Posts: 2,202
KuJi will become famous soon enough
Send a message via ICQ to KuJi Send a message via AIM to KuJi Send a message via MSN to KuJi Send a message via Yahoo to KuJi
Destroying an object in GS2?

I have been messing around w/ stuff, and was wondering how to clear this entire object.

hotel.room = "Rooms";
hotel.suite = "Suites";
hotel.master = "Master Suites";

Just some of the names, after that it contains
hotel.room.#.account
hotel.suite.#.account
hotel.master.#.account

and there could be like 500, and it only resets when you reconnect. How to destroy entire object?

I've tried: hotel.destroy();
Reply With Quote
  #2  
Old 06-01-2006, 03:53 AM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
I guess one way would be to do:

PHP Code:
hotel = new TStaticVar();
hotel.foo "bar";
hotel.destroy(); 
__________________
Scito hoc super omnia.
Haec vita est tua una sola.
Dum vita superest, utere maxime quoque puncto, momento, et hora quae habes.
Tempus neminem non manet.
Noli manere tempus.
Carpe Diem

Seize the Day.
Reply With Quote
  #3  
Old 06-01-2006, 04:45 AM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
or if it's not destroying because it has sub-members (which I don't really see why it would affect it, but just incase)

you could always try:

PHP Code:
for(temp.roomnumhotel.room.getvarnames()) {
  
hotel.room.(@temp.roomnum).destroy();
}
hotel.room.destroy(); 
likewise for the other types of rooms.
I don't think this will make much difference though. If you aren't declaring it as a TStaticVar(), then that is why it's not working, but if you are, try this anyway :P
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #4  
Old 06-01-2006, 05:59 AM
KuJi KuJi is offline
Banned
Join Date: Apr 2004
Location: Staten Island, New York
Posts: 2,202
KuJi will become famous soon enough
Send a message via ICQ to KuJi Send a message via AIM to KuJi Send a message via MSN to KuJi Send a message via Yahoo to KuJi
Quote:
Originally Posted by ApothiX
or if it's not destroying because it has sub-members (which I don't really see why it would affect it, but just incase)

you could always try:

PHP Code:
for(temp.roomnumhotel.room.getvarnames()) {
  
hotel.room.(@temp.roomnum).destroy();
}
hotel.room.destroy(); 
likewise for the other types of rooms.
I don't think this will make much difference though. If you aren't declaring it as a TStaticVar(), then that is why it's not working, but if you are, try this anyway :P
Hmm, I wasn't declaring it as such. Thanks both of you for help, first one helped more tho .

Still thanks
Reply With Quote
  #5  
Old 06-01-2006, 08:42 PM
Loriel Loriel is offline
Somewhat rusty
Loriel's Avatar
Join Date: Mar 2001
Posts: 5,059
Loriel is a name known to allLoriel is a name known to allLoriel is a name known to allLoriel is a name known to all
hotel = 0; looks like it should work?
Reply With Quote
  #6  
Old 06-01-2006, 08:44 PM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
Quote:
Originally Posted by Loriel
hotel = 0; looks like it should work?
It should. But probably only if 'hotel' is declared as an actual object (ie: a TStaticVar).
__________________
Scito hoc super omnia.
Haec vita est tua una sola.
Dum vita superest, utere maxime quoque puncto, momento, et hora quae habes.
Tempus neminem non manet.
Noli manere tempus.
Carpe Diem

Seize the Day.
Reply With Quote
  #7  
Old 06-01-2006, 11:32 PM
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
Quote:
Originally Posted by napo_p2p
It should. But probably only if 'hotel' is declared as an actual object (ie: a TStaticVar).
You should probably declare it as an object before using it as an object anyway.
__________________
Skyld
Reply With Quote
  #8  
Old 06-02-2006, 01:39 AM
KuJi KuJi is offline
Banned
Join Date: Apr 2004
Location: Staten Island, New York
Posts: 2,202
KuJi will become famous soon enough
Send a message via ICQ to KuJi Send a message via AIM to KuJi Send a message via MSN to KuJi Send a message via Yahoo to KuJi
I already got it working via declaring as object and then destroying.

Another Question:
With Tree Views, is it possible to get it so when I rightclick a guipopupmenu pops up w/ a list of options? Also, is there a way to detect if it is the last element of the tree?

First Element
Second Element
Third Element
Last Element <-- Needa Find

How to check for such?
Reply With Quote
  #9  
Old 06-02-2006, 10:45 AM
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
I would say hotel = ""; would be enough
(if it's a normal variable then it and all its subvars will be deleted, if it's a TStaticVar then it will be deleted after a few moments if no other variable is linking to it anymore)

For the tree view menu:
PHP Code:
function MyTreeView.onOpenMenu(nodepathnamedotname) {
  if (
node.nodes.size()<=0)
    
MyContextMenu.open(mousescreenx,mousescreeny);

Reply With Quote
  #10  
Old 06-03-2006, 01:20 AM
KuJi KuJi is offline
Banned
Join Date: Apr 2004
Location: Staten Island, New York
Posts: 2,202
KuJi will become famous soon enough
Send a message via ICQ to KuJi Send a message via AIM to KuJi Send a message via MSN to KuJi Send a message via Yahoo to KuJi
Quote:
Originally Posted by Stefan
I would say hotel = ""; would be enough
(if it's a normal variable then it and all its subvars will be deleted, if it's a TStaticVar then it will be deleted after a few moments if no other variable is linking to it anymore)

For the tree view menu:
PHP Code:
function MyTreeView.onOpenMenu(nodepathnamedotname) {
  if (
node.nodes.size()<=0)
    
MyContextMenu.open(mousescreenx,mousescreeny);

Maybe I am doing it wrong:
I call it through:
PHP Code:
thiso.catchevent(name"onOpenMenu""onTreeView"); 
And I dont recieve function . And when I put obj, in front of node.. I recieved on anything even if it wasnt the end category
PHP Code:
function onTreeView(nodepathnamedotname) {
  if (
node.nodes.size() <= 0)
    
player.chat "test";

Reply With Quote
  #11  
Old 06-03-2006, 01:26 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
Quote:
Originally Posted by KuJi
Maybe I am doing it wrong:
I call it through:
PHP Code:
thiso.catchevent(name"onOpenMenu""onTreeView"); 
I might be mistaken, but I thought catchevent requires an object?
PHP Code:
thiso.catchEvent(this"onOpenMenu""onTreeView"); 
__________________
Skyld
Reply With Quote
  #12  
Old 06-03-2006, 01:34 AM
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
You should try with TreeViewName.onOpenMenu first, if the name is not changing. Your code should work too, but may be the name is not good. First parameter will be obj then, node is second then.
Reply With Quote
  #13  
Old 06-03-2006, 01:39 AM
KuJi KuJi is offline
Banned
Join Date: Apr 2004
Location: Staten Island, New York
Posts: 2,202
KuJi will become famous soon enough
Send a message via ICQ to KuJi Send a message via AIM to KuJi Send a message via MSN to KuJi Send a message via Yahoo to KuJi
Quote:
Originally Posted by Stefan
You should try with TreeViewName.onOpenMenu first, if the name is not changing. Your code should work too, but may be the name is not good. First parameter will be obj then, node is second then.
What do you mean by that? Do I need to call it by an event or anything? When I check nodes size I keep getting 3
Reply With Quote
  #14  
Old 06-03-2006, 01:47 AM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Example:

PHP Code:
thiso.catchevent(this"onAction""onSlotPressed"); 

Then:

PHP Code:
function onSlotPressedobj ) {

__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #15  
Old 06-03-2006, 01:59 AM
KuJi KuJi is offline
Banned
Join Date: Apr 2004
Location: Staten Island, New York
Posts: 2,202
KuJi will become famous soon enough
Send a message via ICQ to KuJi Send a message via AIM to KuJi Send a message via MSN to KuJi Send a message via Yahoo to KuJi
Quote:
Originally Posted by xXziroXx
Example:

PHP Code:
thiso.catchevent(this"onAction""onSlotPressed"); 

Then:

PHP Code:
function onSlotPressedobj ) {

Uhh.. you don't use this.. or Stefan didn't use this in the RC. They used name which is the name of the object... so
Reply With Quote
  #16  
Old 06-03-2006, 02:12 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
Quote:
Originally Posted by KuJi
Uhh.. you don't use this.. or Stefan didn't use this in the RC. They used name which is the name of the object... so
PHP Code:
function onCreated()
{
  new 
GuiButtonCtrl("foo")
  {
    
// this. == button object
    
thiso.catchevent(this"onAction""onFoo");
  }
}

function 
foo(obj)
{
  
// obj. == button object

__________________
Skyld
Reply With Quote
  #17  
Old 06-03-2006, 02:26 AM
KuJi KuJi is offline
Banned
Join Date: Apr 2004
Location: Staten Island, New York
Posts: 2,202
KuJi will become famous soon enough
Send a message via ICQ to KuJi Send a message via AIM to KuJi Send a message via MSN to KuJi Send a message via Yahoo to KuJi
Quote:
Originally Posted by Skyld
PHP Code:
function onCreated()
{
  new 
GuiButtonCtrl("foo")
  {
    
// this. == button object
    
thiso.catchevent(this"onAction""onFoo");
  }
}

function 
foo(obj)
{
  
// obj. == button object

name was used in replace of this for the RC stuff tho.

*Edit* Alright, now how can I find out which is the category before the selected node? *Edit*

Last edited by KuJi; 06-03-2006 at 02:46 AM..
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 08:45 AM.


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