Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Future Improvements (https://forums.graalonline.com/forums/forumdisplay.php?f=10)
-   -   Local GUI controls (https://forums.graalonline.com/forums/showthread.php?t=82812)

DustyPorViva 11-18-2008 07:54 AM

Local GUI controls
 
I think it would be nice to have a way to create GUI controls locally to an NPC... similar to this.vars.

Since GUI's are pretty much global, it wouldn't be hard for a script from one person to overwrite the script of another, simply because they named their window, "Window". This way, controls will only be accessible by the same NPC, and eliminate any interference from outside scripts, or cause any interference.

I'm not sure how it would be done, but I still think it would be a nice addition.

Inverness 11-18-2008 03:08 PM

Methinks you could use an md5 hash to insure a unique name for the gui control, then just use your object variables to point to it.
PHP Code:

temp.controlname md5(timevar2);
new 
GuiWindowCtrl(temp.controlname) {
  
thiso.windowctrl this;
  
// blah
}
this.windowctrl.visible true


xXziroXx 11-18-2008 03:58 PM

Quote:

Originally Posted by Inverness (Post 1443168)
Methinks you could use an md5 hash to insure a unique name for the gui control, then just use your object variables to point to it.

It's easy to find out names of all controls though, so it still doesn't really achieve the same effect that Dusty's suggestion would.

Inverness 11-18-2008 05:45 PM

Quote:

Originally Posted by xXziroXx (Post 1443176)
It's easy to find out names of all controls though, so it still doesn't really achieve the same effect that Dusty's suggestion would.

Dusty's suggestion is a way to avoid name conflicts and use local variables instead, which is what I provided.

My suggestion eliminates unintentional overwriting of GUI controls based on name conflict.

xXziroXx 11-18-2008 08:05 PM

Quote:

Originally Posted by Inverness (Post 1443191)
Dusty's suggestion is a way to avoid name conflicts and use local variables instead

Quote:

Originally Posted by DustyPorViva (Post 1443149)
I think it would be nice to have a way to create GUI controls locally to an NPC... similar to this.vars.

... controls will only be accessible by the same NPC, and eliminate any interference from outside scripts, or cause any interference...

:\

Inverness 11-18-2008 08:45 PM

Quote:

Originally Posted by xXziroXx (Post 1443229)
:\

Quote:

Originally Posted by DustyPorViva
Since GUI's are pretty much global, it wouldn't be hard for a script from one person to overwrite the script of another, simply because they named their window, "Window".

I think it's obvious hes talking about unintentional actions.

DustyPorViva 11-18-2008 11:19 PM

Quote:

Originally Posted by Inverness (Post 1443168)
Methinks you could use an md5 hash to insure a unique name for the gui control, then just use your object variables to point to it.
PHP Code:

temp.controlname md5(timevar2);
new 
GuiWindowCtrl(temp.controlname) {
  
thiso.windowctrl this;
  
// blah
}
this.windowctrl.visible true


I also think it would be more efficient if the data never has to leave the weapon, don't you?

Inverness 11-18-2008 11:32 PM

Quote:

Originally Posted by DustyPorViva (Post 1443284)
I also think it would be more efficient if the data never has to leave the weapon, don't you?

The way I provided is less efficient than the normal way because you're generating a hash, setting a global variable, then setting a local variable rather than simply setting a global variable like you would normally.


All times are GMT +2. The time now is 10:53 AM.

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