Class: Room

Inherits:
Object
  • Object
show all
Defined in:
models.rb

Class Method Summary (collapse)

Class Method Details

+ (Int) count_objects(value)

Counts objects.

Examples:

Using object count in script.

if Room::count_objects "hog" > 2
  put "attack"
end

Parameters:

  • value (String)

    oject name.

Returns:

  • (Int)

    count of found objects in room.



219
220
221
# File 'models.rb', line 219

def self.count_objects(value)
  self.objects.scan(value).length
end

+ (string) description

Room description.

Examples:

Using room description in script.

echo Room::description
=> Well-worn paths lead through a grove of trees to a gate in The Crossing's
   western wall.  Now and again you hear birds ...

Returns:

  • (string)

    room description



173
174
175
176
# File 'models.rb', line 173

def self.description
  $_api_socket.puts "GET ROOM_DESC\n"
  $_api_socket.gets('\0').chomp('\0').to_s
end

+ (string) exits

Room exits.

Examples:

Using room exits in script.

echo Room::exits
=> Obvious paths: northwest.

Returns:

  • (string)

    room exits



206
207
208
209
# File 'models.rb', line 206

def self.exits
  $_api_socket.puts "GET ROOM_EXITS\n"
  $_api_socket.gets('\0').chomp('\0').to_s
end

+ (Array) monsters_bold

Note:

set MonsterBold echo Room::monsters_bold

> [“a ship's rat”]

Monsters bold.

Examples:

Using monsters bold in script.

Returns:

  • (Array)

    list of bold monsters in room



230
231
232
233
# File 'models.rb', line 230

def self.monsters_bold
  $_api_socket.puts "GET ROOM_MONSTERS_BOLD\n"
  $_api_socket.gets('\0').chomp('\0').to_s.split("\n")
end

+ (string) objects

Room objects.

Examples:

Using room objects in script.

echo Room::objects
=> You also see a musk hog.

Returns:

  • (string)

    room objects



184
185
186
187
# File 'models.rb', line 184

def self.objects
  $_api_socket.puts "GET ROOM_OBJECTS\n"
  $_api_socket.gets('\0').chomp('\0').to_s
end

+ (string) players

Room players.

Examples:

Using room players in script.

echo Room::players
=> ""

Returns:

  • (string)

    room players



195
196
197
198
# File 'models.rb', line 195

def self.players
  $_api_socket.puts "GET ROOM_PLAYERS\n"
  $_api_socket.gets('\0').chomp('\0').to_s
end

+ (string) title

Room title.

Examples:

Using room title in script.

echo Room::title
=> [Mycthengelde, Flatlands]

Returns:

  • (string)

    room title



161
162
163
164
# File 'models.rb', line 161

def self.title
  $_api_socket.puts "GET ROOM_TITLE\n"
  $_api_socket.gets('\0').chomp('\0').to_s
end