|
Nemireck Beginner
Joined: 15 Feb 2009 Posts: 10
|
Posted: Mon Sep 13, 2021 5:34 pm
Disabling Classes within a parent Class |
Example:
Parent Class "Demon" has 55 "room Classes" within it; "demon1 -> demon55"
Using #t- Demon I can disable "Demon", obviously, but it leaves whatever "demonX" class enabled within it. I would like to ensure all of the room Classes are disabled at the same time as "Demon" is disabled.
Is there a way to disable the demon1-55 classes with a single command, or am I stuck making an alias or trigger with 55 "#t- demonX" lines? |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4689 Location: Pensacola, FL, USA
|
Posted: Tue Sep 14, 2021 3:11 am |
Everything in a given class is disabled when the class is disabled.
This includes nested classes.
Your request is the default behavior. |
|
_________________ Discord: Shalimarwildcat |
|
|
|
Nemireck Beginner
Joined: 15 Feb 2009 Posts: 10
|
Posted: Wed Sep 15, 2021 3:53 am |
No, that's not 100% accurate.
The enabled classes within a disabled parent class remain in enabled status, they just don't function because the parent is disabled.
So for an example of what my script is doing:
When I "StartDemon," the script starts running by enabling "Demon" and "demon1" (which is a sub-class within parent class "Demon) and begins running in sequence by room (demon1-demon55). When it reaches "demon55" it disables "Demon" and "demon55."
If I'm in room "demon35" and I disable the parent class "Demon" for whatever reason, then "demon35" remains enabled until I disable it as well (it just doesn't execute because "Demon" is disabled). If I were to "StartDemon" later on without disabling "demon35" first, the result is that the script starts running with "demon1" and "demon35" both enabled, which causes both classes to fire off their shared triggers, causing mayhem.
Not a big deal if I'm at the computer manually shutting everything down, it's just a couple of commands. But if I wanted to to ensure the "demonX" rooms were all disabled automatically (say... whenever I login), I'm currently of the belief that I would need to make an alias to do something like:
#t- Demon
#t- demon1
#t- demon2
#t- demon3
etc.
I am wondering if there is another, easier way to disable an entire class folder with one command (or two) instead. |
|
|
|
hpoonis2010 Adept
Joined: 18 Jun 2019 Posts: 279
|
Posted: Wed Sep 15, 2021 6:12 am |
What shalimar wrote is correct: if the class is disabled, everything in the class is disabled. The fact that the items do NOT appear disabled in the package editor is immaterial.
Test it yourself. Disable a class with an alias in it then try using that alias. Although the alias itself not disabled it will not function due to the parent being disabled.
If you insist upon scripting #T- demon1, demon2, etc then just use something like
#LOOP 1, 55{
#T- demon%i
} |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4689 Location: Pensacola, FL, USA
|
Posted: Wed Sep 15, 2021 11:23 am |
Sounds like you need a placeholder variable.
That way you can ensure that when you start your script, it either knows to pick up where you left off, or it knows to reset everything to the beginning.
Or you can make use of the onConnect #EVENT to reset everything after a crash/reboot.
#EVENT onConnect {#LOOP 1,55 {#T- %concat("demon", %i)}} |
|
_________________ Discord: Shalimarwildcat |
|
|
|
Nemireck Beginner
Joined: 15 Feb 2009 Posts: 10
|
Posted: Wed Sep 15, 2021 11:54 am |
hpoonis2010 wrote: |
What shalimar wrote is correct: if the class is disabled, everything in the class is disabled. The fact that the items do NOT appear disabled in the package editor is immaterial.
Test it yourself. Disable a class with an alias in it then try using that alias. Although the alias itself not disabled it will not function due to the parent being disabled.
If you insist upon scripting #T- demon1, demon2, etc then just use something like
#LOOP 1, 55{
#T- demon%i
} |
While what you're stating is true, it doesn't solve the problem I'm describing... But, you've actually solved my dilemma anyway.
This is perfect for my needs, and I'm going to play around with what shalimar has suggested as well because it looks helpful too.
Thank you both! |
|
|
|
|
|