Author Topic: Attempting to replace the escape menu.  (Read 1565 times)

Why won't this work?

function escapeMenu::OnWake(%this)
{
   $DelGui = "escapeMenu";

   if(!isObject(escapeMenu+))
   {
      exec("./escapeMenu+.gui");
   }
}

I don't understand this at all.

First of all. You aren't deleting the GUI as you never call .delete();

Second. Don't delete a default GUI!!! It's dumb and can mess up other mods.

Pretty sure if you stick this above your gui code it will work.
Code: [Select]
if(isObject(EscapeMenu))
FullDelete(EscapeMenu);

Pretty sure if you stick this above your gui code it will work.
Code: [Select]
if(isObject(EscapeMenu))
FullDelete(EscapeMenu);
Not helping my cause -_-

Whatever does fullDelete do anyways? Why not just call EscapeMenu.delete()?

Pretty sure if you stick this above your gui code it will work.
Code: [Select]
if(isObject(EscapeMenu))
FullDelete(EscapeMenu);

FullDelete() is not a default function, it was only included in mine and zeblote's unfinished GUI mod to delete the children of the group. Although now it appears that deleting the group also removes objects in them. Not sure why that is there.

Just do

EscapeMenu.deleteAll();
EscapeMenu.delete();

And then for your new gui, just have the same name (EscapeMenu) so you do not mess up other mods.

So when you have the same name, escapemenu.toggle(); still should work.

FullDelete() is not a default function, it was only included in mine and zeblote's unfinished GUI mod to delete the children of the group. Although now it appears that deleting the group also removes objects in them. Not sure why that is there.
oh lol, I guess it's worked for me because it was in my addons.

You shouldn't use the character + in the name of an object, and if you do you have to wrap it as a string like this: "escapeMenu+".whatever();

Although now it appears that deleting the group also removes objects in them. Not sure why that is there.

That has always been the case.

EscapeMenu.deleteAll();
EscapeMenu.delete();

... why?

... why?
If they want to replace it, they can use that. (Well not deleteAll();, not sure why I put that there)

It's still not working. I feel stupid.

if(isObject(EscapeMenu))
   EscapeMenu.delete();

function escapeMenu::OnWake(%this)
{
   $DelGui = "escapeMenu";

   if(!isObject(escapeMenuPlus))
   {
      exec("./escapeMenuPlus.gui");
   }
}
« Last Edit: February 17, 2014, 12:55:45 AM by Crispy_ »

1. Stop deleting default guis
2. How is it supposed to callback onWake when the object that would be calling it is deleted?
3. All you're doing is execing the new gui, you're not actually opening it or anything
4. Try something like this

Code: [Select]
exec("./escapeMenuPlus.gui");

function escapeMenu::Toggle(%this)
{
canvas.pushDialog(escapeMenuPlusGui);
}
« Last Edit: February 17, 2014, 01:33:50 AM by Headcrab Zombie »

2. How is it supposed to callback onWake when the object that would be calling it is deleted?

Because they're defined by name, and you're creating a new GUI with the exact same name?

Because they're defined by name, and you're creating a new GUI with the exact same name?
But he's not creating a GUI with the exact same name.

I'll make it the same name if it's needed.