RCRPG/PureBasic: Difference between revisions

Content added Content deleted
(→‎{{header|PureBasic}}: updated description)
(→‎{{header|PureBasic}}: Updated description and minor code change)
Line 1: Line 1:
=={{header|PureBasic}}==
=={{header|PureBasic}}==
This version is a more or less direct translation of the version done in Perl (See [[RCRPG/Perl]]) with some additional functionality added. Commands include attack, drop, take, equip, alias, name, inventory, and directions. An additional command 'ask' was implemented for providing hints to locate the randomly placed Prize Room.
This version is a more or less direct translation of the version done in Perl (See [[RCRPG/Perl]]) with some additional functionality added. Commands include attack, drop, take, equip, alias, name, inventory, and directions. The 'name' command can use a double-quoted string if spaces wanted to be included in the name (i.e. 'name "this room").

An additional command 'ask' was implemented for providing hints in finding the randomly placed Prize Room. The program also allows the stacking of commands if they are separated by a space (i.e. 'take all equip sledge a north n' will perform four actions).
<lang PureBasic>;Here is a description of all of the commands:
<lang PureBasic>;Here is a description of all of the commands:
;
;
Line 194: Line 196:
rooms()\items() = #itm_sledge
rooms()\items() = #itm_sledge


setLocation(prizeRoom, Random(10) - 5, Random(10) - 5, Random(5) + 2)
setLocation(prizeRoom, Random(6) - 3, Random(6) - 3, Random(5) + 2)
*locations(Str(prizeRoom\x) + "," + Str(prizeRoom\y) + "," + Str(prizeRoom\z)) = AddElement(rooms())
*locations(Str(prizeRoom\x) + "," + Str(prizeRoom\y) + "," + Str(prizeRoom\z)) = AddElement(rooms())
rooms()\name = "The Prize Room"
rooms()\name = "The Prize Room"