Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
Moo
Apprentice


Joined: 10 Apr 2009
Posts: 145

PostPosted: Tue Jun 02, 2009 3:23 pm   

Room scripts for multiple rooms
 
Is there a way to use the same room scripts for multiple rooms? (No, not zone scripts..)
If there isn't, I have a proposal..
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Tue Jun 02, 2009 10:31 pm   
 
Copy and paste works. A perhaps more elegant solution would be to move the script to a different location and use the room-script section to populate variables and do something that triggers the script.

I do the latter, and I put whatever scripts I can't jimmy directly into the mapper in a separate mapping package. If I ever get occasion to share my map, I can then easily share the extra scripting that goes along with it.
_________________
EDIT: I didn't like my old signature
Reply with quote
wrym
Magician


Joined: 06 Jul 2007
Posts: 349
Location: The big palace, My own lil world

PostPosted: Tue Jun 02, 2009 10:49 pm   
 
The new class that were implemented for room scripts enable tying several together, i searched the forums but couldn't find the post that talked about it.

However from the release notes....

3.06 17-Apr-08 (BETA) wrote:
# Added "key=keywords" option to #class command
# Class keywords will now properly match multiple classes with the same key (however, classes can still only have a single keyword value)
_________________
"To the engineer, all matter in the universe can be placed into one of two categories: (1) things that need to be fixed, and (2) things that will need to be fixed after you've had a few minutes to play with them" - Scott Adams, The Dilbert Principle
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Wed Jun 03, 2009 4:30 pm   
 
The class key is intended to be able to allow this. Currently, only a single keyword value can be entered into the key, but eventually Zugg hopes to change that. So, it is on the future feature list.
Reply with quote
Moo
Apprentice


Joined: 10 Apr 2009
Posts: 145

PostPosted: Wed Jun 03, 2009 5:00 pm   
 
Hmm.. I'm not sure this is quite what I was thinking of..
How do I associate a room with a particular class then?
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Wed Jun 03, 2009 11:08 pm   
 
When you enter a room, any class with the "RoomXXX" keyword (where XXX is the room ID number that you entered) is enabled, and the "Enable Script" for the class is executed. When you leave a room, the class with the "RoomXXX" keyword is disabled and the "Disable Script" for the class is executed.

As Rahab mentioned, future versions of CMUD will allow a class folder to have multiple keywords. But for now you will need a separate class to hold the script for each room.

The easiest way to have the same script for multiple rooms is to put the long script into a single alias, and then just call that alias in each Room Class "Enable Script" field. Then you don't have multiple copies of the same script that might make it hard to update.
Reply with quote
Moo
Apprentice


Joined: 10 Apr 2009
Posts: 145

PostPosted: Thu Jun 04, 2009 1:43 am   
 
Ok, this isn't really what I was thinking of then.. So I'll give my proposal..
As well as the RoomXXX keyword system...

Classes in the settings, like the present system..
Rooms can belong to one or more classes. Perhaps by putting the class's name(s) (or keywords) in the UserStr field for that room, or perhaps a new field..
This would be much more useful, I feel, especially if there was easy ways to manipulate that field in scripts.. Perhaps the field could be in the aa|bb|cc list format..
You could, for example:
Have a "Shop" class, then all you would need to do to designate a room as a shop, and assign the relevant scripts there, would be to type "shop" in a field.. You could even make a macro to set it quickly.
Have a "Dark" class, and set several rooms to be "dark" at once.. If it worked well, it would run the enable script when you entered the dark area, lighting your torch for example, and the disable script when you left the area, putting it out.. Lighting the torch in every room wouldn't be good.. This system could also be used for any other "areas" in your game.. Peaceful areas where you put away weapons, dangerous areas you cast protection spells before entering, etc etc..
Supporting more than one class per room would allow you to set a room to be both "shop" and "dark" at the same time, with the expected results.

This would be a lot simpler to use than the present system..
You would only need a single class in the editor for dark rooms, for example, even if you had 200 dark rooms split over many zones.
The connection between the scripts and the rooms would be done at the "room side", so you could easily see/change which classes a room belonged to, in the mapper. Also, the list would be easy to access in scripts too..
No room numbers involved.. Instead of a large number of RoomXXX classes in the settings, just a few meaningfully-named ones..

I hope everyone can see the advantages such a system would have.. And I wouldn't think it would be too hard to implement, as really all it would have to do is compare a list of classes in the room you leave to the one in the room you enter, and enable/disable any that have changed.

What do you think? Smile
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Thu Jun 04, 2009 2:14 pm   
 
That is exactly what you can do with the present system, once we get the ability to have multiple room ids in the key of a class. You create a Shop class, populate it with all the relevant shop scripts and triggers, add an enable or disable script if desired, and then you can just add the room id of every shop room to the key. You will be able to add to the key in scripts, as you suggest. The only difference from your suggestion is that it is the class that knows which rooms are associated, rather than the room that knows which classes are associated. And you can have the same room listed in as many classes as you need.
Reply with quote
Moo
Apprentice


Joined: 10 Apr 2009
Posts: 145

PostPosted: Thu Jun 04, 2009 4:09 pm   
 
And that difference is a big difference. Sad
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Thu Jun 04, 2009 5:27 pm   
 
There is another feature coming later that I think will work better for what Moo wants.

In the future, each Room will also have it's own Keyword field. When entering a room, any class that contains a matching keyword will also be enabled. So, for example, you would be able to add a "dark" keyword to each dark room and then create a class with the "dark" keyword. And it would work the way you want with no room numbers involved. But it all works within the existing keyword system. No need for additional fields or complexity.

But this feature is tied to the need to support multiple keywords, which CMUD can't do right now. So yes, you'll eventually be able to do this, but not in the next public release, sorry.
Reply with quote
Moo
Apprentice


Joined: 10 Apr 2009
Posts: 145

PostPosted: Thu Jun 04, 2009 6:10 pm   
 
Aha.. That sounds like exactly what I was describing.. Great Very Happy
Even a single keyword would be good..
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net