Author Topic: Day/Night script  (Read 12090 times)

0 Members and 1 Guest are viewing this topic.

Offline Kvetch

  • Administrator
  • Hero Member
  • *****
  • Posts: 729
    • View Profile
    • Email
Day/Night script
« on: September 03, 2016, 10:42:40 am »
Ever since the night description code was put into the mud, I've been interested in having other things be day/night - like smell and listen - and sometimes even touch.  A couple years ago Parnassus came up with something that didn't quite work, but it is the basis for what I've started using which is this:
if %time.hour% > 6 && %time.hour% <21
  return 0
  halt
else

This checks to see if the hour is between 6am and 9pm (daylight hours for the mud).  If it is, it will use whatever I have put into the listen/smell room description.  If it isn't - that's where the else comes in.

if %cmd.mudcommand%==listen
%send% %actor% - whatever it is you want them to hear at night that isn't there during the day.
halt
elseif %cmd.mudcommand%==smell
%send% %actor% - whatever it is you want them to smell at night that isn't there during the day
halt
else
return 0 - in case the player is trying to do something other than listen or smell, like move or look at things or... stuff like that.
end

Obviously if you do this for more than one room, you'll have to add a check in for the room vnum (which, strangely %room.vnum% doesn't seem to work, but %actor.room.vnum% does).

So, in the end my current script looks like this:

if %time.hour% > 6 && %time.hour% <21
  return 0
  halt
else
  if %cmd.mudcommand%==listen
    if %actor.room.vnum% == 47108
      %send% %actor% You hear some horses whiney from the barn.
      halt
    elseif %actor.room.vnum%== 47113
      %send% %actor% You hear horses whineying a complaint from the barn.
      halt
    end
  elseif %cmd.mudcommand%==smell
    if %actor.room.vnum%==47108
      %send% %actor% There is a strong scent of manure coming from the barn.
      halt
    elseif %actor.room.vnum%==47113
      %send% %actor% The smell of fresh manure assaults you from the pasture to the south.
      halt
    else
      return 0
    end
  else
    return 0
  end
else
  return 0
end

Offline Parnassus

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Day/Night script
« Reply #1 on: September 08, 2016, 04:33:31 pm »
Butbutbut....it was SUPPOSED to work!  I dunno why it doesn't work *sniff*.  In fact, we tweaked it and tweaked it on the buildport and it really seemed to me that it was working but when I tried it in the game, well, it just didn't work *sob*.

Offline Kvetch

  • Administrator
  • Hero Member
  • *****
  • Posts: 729
    • View Profile
    • Email
Re: Day/Night script
« Reply #2 on: September 09, 2016, 07:33:51 pm »
Still love you, Parn and I'm redoing the haunted house again.  Could use your amazing ideas and scripting skills on that again.

FYI: I had tried to use that %actor.room.vnum% on some global time loading scripts and realized it wouldn't work since there's not a command that anyone would do - so there would be no %actor% in that case.  So.. it became %self.vnum% for that.  These %actor.room.vnum%'s could probably be changed to %self.vnum% and have it work too.