The Dawn Of Time
The Official Forums for the Dawn Of Time Mud Codebase
 
Log in Register FAQ Memberlist Search The Dawn Of Time Forum Index Goto the Official Dawn Website

Atmosphere/temperature OLC option

 
Post new topic   Reply to topic    The Dawn Of Time Forum Index » Coding
View previous topic :: View next topic  
Author Message
Pixie



Joined: 16 Jan 2016
Posts: 56
Location: Pacific Northwest

PostPosted: Sun Jan 24, 2016 8:17 pm    Post subject: Atmosphere/temperature OLC option Reply with quote

What I would like to do is add an option to the OLC room editor for for "atmosphere."

For an on the fly example:

Without "atmosphere" set:

Code:
An Inn
  This is a description of an inn. It's super inn-like. There
is a great deal of inn-related paraphernalia here.
[Exits: east]


Enter "atmosphere Relatively warm, haze of smoke in the air." into the OLC editor, and it now looks like:

Code:
An Inn
[Relatively warm, haze of smoke in the air.]
  This is a description of an inn. It's super inn-like. There
is a great deal of inn-related paraphernalia here.
[Exits: east]


How would I go about handling this?




Last edited by Pixie on Tue Dec 27, 2016 4:20 pm; edited 1 time in total
Back to top
View user's profile Send private message AIM Address
Daos



Joined: 29 Jan 2003
Posts: 1213
Location: United States

PostPosted: Mon Jan 25, 2016 8:01 am    Post subject: Re: Addition to redit OLC Reply with quote

Pixie wrote:
What I would like to do is add an option to the OLC room editor for for "atmosphere."

For an on the fly example:

Without "atmosphere" set:

Code:
An Inn
  This is a description of an inn. It's super inn-like. There
is a great deal of inn-related paraphernalia here.
[Exits: east]


Enter "atmosphere Relatively warm, haze of smoke in the air." into the OLC editor, and it now looks like:

Code:
An Inn
[Relatively warm, haze of smoke in the air.]
  This is a description of an inn. It's super inn-like. There
is a great deal of inn-related paraphernalia here.
[Exits: east]


How would I go about handling this?


Me personally, I would do this two ways. Either incorporate the 'atmosphere' into the room description itself as part of the description or simply make use of room echos. In REDIT OLC, you can use the 'addecho' command to add a timed based echo that will send a message based on time of day with a trigger %.

eg. addecho 19 22 10 The wind blows silently.

Result:


Between 7pm and 10pm, there is a 10% chance the room will see the message of 'The wind blows silently.'

This is also available in AEDIT as an area echo.



_________________
- Daos

http://www.dawnoftime.org
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Trell



Joined: 28 Jun 2013
Posts: 49

PostPosted: Fri Jan 29, 2016 4:59 am    Post subject: What to do Reply with quote

Daos is right, it would probably be easier to do in echoes or the room description, but if you're intent on it, these are the steps you'd have to take:

1. add a new char *atmosphere variable to room_index_data in structs.h
2. add lines to new_room_index() and free_room_index() for it in recycle.cpp.. you can just use description as an example there.
3. add a line to save atmosphere in fwrite_room(), wherever that is
4. add a line to load atmosphere in load_rooms_NAFF()
5. add lines in redit.h for the atmosphere command, use other things here as an example
6. write the new redit_atmosphere command in redit.cpp. You can use redit_name() or redit_desc() as examples depending on if you want it to use the editor or just be entered on the command line.
7. modify redit_show() to add a line showing atmosphere wherever you'd want it to be in the show screen when editing.
8. This is the most complicated... in do_look() in act_info.cpp, you need to add the display of the atmosphere variable to wherever you'd want it to show up. There's a section in there just for looking in the room, but it can be hard to find if you aren't familiar with code.

That should be all you need to do, which is not as easy as using the description or echoes.


Back to top
View user's profile Send private message
Pixie



Joined: 16 Jan 2016
Posts: 56
Location: Pacific Northwest

PostPosted: Fri Jan 29, 2016 11:36 pm    Post subject: Reply with quote

I think I'll use the room echoes. I thought the echoes had to be area-wide until you pointed out the option is also in redit.

Thanks, guys!


Back to top
View user's profile Send private message AIM Address
Pixie



Joined: 16 Jan 2016
Posts: 56
Location: Pacific Northwest

PostPosted: Tue Dec 27, 2016 2:41 pm    Post subject: Reply with quote

Ended up going for a system that uses an ed desc. If you have "@atmosphere" set as an ed desc in the room, it should display it at the top of the room display.

ed add @atmosphere within the olc editor, basically, which is a lot less fiddly than expanding OLC.

I am having a hard time figuring out what should be used to pick up on the existence of an ed desc, however.

I found this in do_look for lockers:

Code:
      if(lockers->room_has_lockers(ch->in_room)){      
         ch->printlnf("     `=\x8d%s",
            mxp_create_send(ch,"look lockers",
               FORMATF("""A candlelit alcove off the eastern wall houses iron-braced locker%s.",
               //ch->in_room->lockers->quantity,
               ch->in_room->lockers->quantity==1?"":"s")));
      }


... And I think I need the same logic, just instead of checking for lockers it checks for an ed desc called @atmosphere.

Would it be like this?

Code:
            if (obj->extra_descr == @atmosphere)


Back to top
View user's profile Send private message AIM Address
Daos



Joined: 29 Jan 2003
Posts: 1213
Location: United States

PostPosted: Fri Jan 06, 2017 11:41 am    Post subject: Reply with quote

Hiya,

I think you are making this a tad more complicated than it has to be. If you want to make use of extended room descriptions, all you need to do in REDIT is input ED ADD <keyword> - in which your case would be atmosphere. You can leave a hint in the actual room description in a different color text (typically dark grey) to let the player know they can check the atmosphere. There really is nothing in the hard code you need to add or change to achieve what your general objectives are.

Good Luck!



_________________
- Daos

http://www.dawnoftime.org
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    The Dawn Of Time Forum Index » Coding All times are GMT + 13 Hours
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


Powered by phpBB © 2001-2005 phpBB Group
Theme created by Vjacheslav Trushkin