Welcome, Guest. Please login or register.
Kingdoms of Ahln
Pages: [1]
  Print  
Author Topic: Latest work - 11/09/08  (Read 510 times)
Justin
Administrator
Citizen
*****
Posts: 189



View Profile
« on: November 10, 2008, 12:01:02 am »

I really shouldn't be working on this (far too many other things to do), but I just couldn't help myself.

The other four senses, TASTE, SMELL, FEEL, and LISTEN have been added. Any object (including rooms) can have a message for any or all of these. To test this out, visit the central fountain.

Portals have been added. These can be accessed with ENTER, JUMP, CLIMB, or CRAWL. Messages can be set to show to the exit room, entrance room, and the player using the portal. Four such portals have been added as examples: the ladder on the Main Street Bridge, the mirror in the Small Clothing Shop, the tunnel in the warehouse, and the barrier Before a Large Hole. Of these, only the mirror uses the default portal messages.

Admin commands for portals and sensory information will be added soonish.

Changes have also been made to the way reactions are matched and executed. Before, whatever reaction happened to match first (not in any particular order) was executed and that was it. Now, every matching reaction is executed. Additionally, all tests are checked prior to executing any reactions.

One other, small thing has been added: the ability to turn echo on and off for player connections. This is how asking for passwords is generally handled.
Logged
Justin
Administrator
Citizen
*****
Posts: 189



View Profile
« Reply #1 on: November 11, 2008, 03:02:50 am »

Another new addition: a new way to define emotes which should be a bit quicker/easier/less error-prone.

Old way:

Code:
def smile(event, player, room)
        if event[:object]
                at = room.find(event[:object])
                if at.nil?
                        player.output("Smiling at nothing?")
                        return
                elsif at == player
                        event[:to_player] = "You smile happily at yourself."
                        event[:to_other] = "#{player.name} smiles at #{player.pronoun(:reflexive)} sillily."
                else
                        event[:target] = at
                        event[:to_player] = "You smile at #{at.name} kindly."
                        event[:to_target] = "#{player.name} smiles at you kindly."
                        event[:to_other] = "#{player.name} smiles at #{at.name} kindly."
                end
        else
                event[:to_player] = "You smile happily."
                event[:to_other] = "#{player.name} smiles happily."
        end

        room.out_event(event)
end

New way:

Code:
def smile(event, player, room)
        make_emote event, player, room do
                self_target do
                        to_player "You smile happily at yourself."
                        to_other "#{player.name} smiles at #{player.pronoun(:reflexive)} sillily."
                end
                target do
                        to_player "You smile at #{event.target.name} kindly."
                        to_target "#{player.name} smiles at you kindly."
                        to_other "#{player.name} smiles at #{event.target.name} kindly."
                end
                no_target do
                        to_player "You smile happily."
                        to_other "#{player.name} smiles happily."
                end
        end
end

Besides the nifty syntax, the only other change is that event.target should be used wherever at or object were being used before.
All the current emotes have been converted to this new method.
« Last Edit: November 11, 2008, 03:04:34 am by Justin » Logged
Justin
Administrator
Citizen
*****
Posts: 189



View Profile
« Reply #2 on: November 11, 2008, 06:17:11 pm »

I guess I'll just keep updating this thread for a little bit.

Newly added is the after method for creating future events. This can be used in reaction scripts or anywhere, really.

Let's say there was a mobile who throws a rock down a well. We'd like there to be a splashing sound three seconds later:

Code:
after 3 do
  room.output "After a moment, a faint splash echoes up from the well."
end

"emote smiles hopefully and tosses a small rock down the well."

Note that the counter starts immediately. These can also be nested.

Another small but helpful change is that player and room will be available as variables in reactions like they are in the event modules, rather than having to look them up.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.15 | SMF © 2006-2009, Simple Machines
Terra97 design by Bloc