RCRPG/Unicon: Difference between revisions
m
Fixed syntax highlighting.
(words out of order) |
m (Fixed syntax highlighting.) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 1:
{{collection|RCRPG}}
The following program implements the RCRPG game in Unicon.
Line 18 ⟶ 19:
The main program follows:
<
record urinfo(here,carrying,using) # about your character
Line 37 ⟶ 38:
(\Alias_Setup)() # optional
repeat Describe() & DoCommand()
end</
The following implement the navigation procedures:
<
if *item = 0 then push(item, \?[&null,"sledge","ladder","gold"]) # randomize
return roominfo(x,y,z,\name|"",item)
Line 67 ⟶ 68:
put(UR.here.items,"broken hammer")
write("You broke your sledge hammer and left it on the ground.")
write(if \Abracadabra then "There is a hint of magic in the air."
else "Hope you found another.")
}
}
Line 91 ⟶ 94:
"west" : UR.here.w
}
end</
The following are the command processing and non-navigational commands:
<
/Aliases := table()
if Aliases[Command[2]] := Command[3] then
Line 235 ⟶ 238:
else write("I see no ",item)
else write("What do you want me to take?")
end </
The following are miscellaneous supprt procedures:
<
/c := ", "
every (s := "") ||:= !X || c
Line 246 ⟶ 249:
procedure index(L, x) #: generate indices for x
every if x === L[i := 1 to *L] then suspend i
end</
The following are minor embellishments that are silently linked. If they are left out, the remaining code should be able to continue on unaffected.
<
static uses
initial uses := 3
Line 258 ⟶ 261:
}
else if uses = 0 then write("... No. Nothing happens.")
else if uses = -1 then write("... You
else write("... Thankfully nothing else happens.")
end
Line 267 ⟶ 270:
Aliases[a[1]] := a
every Aliases[!["hocus","pocus","shazzam","walla","xyzzy"]] := "abracadabra"
end</
|