Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: KingOfVC on Apr 28, 2016, 09:24 AM

Title: hi
Post by: KingOfVC on Apr 28, 2016, 09:24 AM
how to remove created GUI element?
Title: Re: hi
Post by: maxorator on Apr 28, 2016, 10:09 AM
By removing all references to it.
Title: Re: hi
Post by: KAKAN on Apr 28, 2016, 10:51 AM
Quote from: maxorator on Apr 28, 2016, 10:09 AMBy removing all references to it.
He wants to function to do it. Like: GUIElement.remove() or something
Title: Re: hi
Post by: KingOfVC on Apr 28, 2016, 12:45 PM
Quote from: maxorator on Apr 28, 2016, 10:09 AMBy removing all references to it.

I tried, label = null but it gave that error. So how do I remove the references?
Title: Re: hi
Post by: rww on Apr 28, 2016, 12:52 PM
Maybe something like that?

function onWindowClose(window) {
if (this.window == window) {
shutdown();
}
}

from test server (inventory.nut)
Title: Re: hi
Post by: ThunderStorm on Apr 28, 2016, 01:00 PM
Quote from: rww on Apr 28, 2016, 12:52 PMMaybe something like that?

function onWindowClose(window) {
if (this.window == window) {
shutdown();
}
}

from test server (inventory.nut)
no.

We would like to close the GUI when InputReturn(element) is called.
Title: Re: hi
Post by: DizzasTeR on Apr 28, 2016, 01:15 PM
myWindow <- GUIWindow( ... )

// Later when you dont need it

myWindow = null

I guess it works pretty much the same for every element.
Title: Re: hi
Post by: KAKAN on Apr 28, 2016, 01:19 PM
Quote from: Doom_Kill3R on Apr 28, 2016, 01:15 PMmyWindow <- GUIWindow( ... )

// Later when you dont need it

myWindow = null

I guess it works pretty much the same for every element.
Quote from: KingOfVC on Apr 28, 2016, 12:45 PM
Quote from: maxorator on Apr 28, 2016, 10:09 AMBy removing all references to it.

I tried, label = null but it gave that error. So how do I remove the references?
Title: Re: hi
Post by: KingOfVC on Apr 28, 2016, 02:19 PM
Quote from: Doom_Kill3R on Apr 28, 2016, 01:15 PMmyWindow <- GUIWindow( ... )

// Later when you dont need it

myWindow = null

I guess it works pretty much the same for every element.

The error I get is: trying to set 'class'
Title: Re: hi
Post by: maxorator on Apr 28, 2016, 09:03 PM
Quote from: KingOfVC on Apr 28, 2016, 02:19 PM
Quote from: Doom_Kill3R on Apr 28, 2016, 01:15 PMmyWindow <- GUIWindow( ... )

// Later when you dont need it

myWindow = null

I guess it works pretty much the same for every element.

The error I get is: trying to set 'class'
What exactly are you doing? That error doesn't make sense.
Title: Re: hi
Post by: EK.IceFlake on Apr 29, 2016, 03:03 AM
Try this
getroottable().rawset(myWindow, null);
Title: Re: hi
Post by: karan20000000000 on Apr 29, 2016, 04:19 AM
Quote from: karan20000000000 on Apr 26, 2016, 08:34 PMThe GUIEntity class seems to be lacking .Delete() method. I tried setting the instance variable to null and it gave an error saying 'trying to set class'. (@maxorator)
I guess you didn't notice it :[.
Quote from: maxorator on Apr 28, 2016, 09:03 PM...
What exactly are you doing? That error doesn't make sense.
This is what I did: I made a label through /exe command for client script. The label showed up properly right where I wanted it to be. But, when I tried to remove it by setting that instance = null, this error popped up. However when I made a function to do this,
function GUILabel::Delete()
{
  return this = null;
}
then nothing came up, neither any error nor did the label disappear. Similar was the case when I tried getroottable().rawset.... by CrystalBlue.
The third time, I directly initialised the label through the script and set it to null under onplayershoot. When I did it, the same error came up, i.e., trying to set 'class'.

Title: Re: hi
Post by: ysc3839 on Apr 29, 2016, 05:13 AM
Quote from: Doom_Kill3R on Apr 28, 2016, 01:15 PMmyWindow <- GUIWindow( ... )

// Later when you dont need it

myWindow = null

I guess it works pretty much the same for every element.
Try myWindow <- null;
Title: Re: hi
Post by: karan20000000000 on Apr 29, 2016, 05:45 AM
Quote from: ysc3839 on Apr 29, 2016, 05:13 AM...
Try myWindow <- null;
Worked :]
Thanks.

But, could you please explain why the other methods weren't working?
Title: Re: hi
Post by: DizzasTeR on Apr 29, 2016, 06:51 AM
How come that worked for you but the correct way doesn't? I simply set the variable to null and all the GUI elements corresponding to it are removed automatically.

P.S: @karan20000000000, I've guessed what you're up to, I'd tell you to leave that to me :D
Title: Re: hi
Post by: ysc3839 on Apr 29, 2016, 10:32 AM
Quote from: karan20000000000 on Apr 29, 2016, 05:45 AM
Quote from: ysc3839 on Apr 29, 2016, 05:13 AM...
Try myWindow <- null;
Worked :]
Thanks.

But, could you please explain why the other methods weren't working?
I think Squirrel treat the "=" as an operator. But the class doesn't have an "=" operator.