<your_room_name type="object">
<inherit name="editor_room" />
<description type="string">your_room_description</description>
// or you can do the description as a Script type (see below)
<description type="script">
whatever scripts you want
</description>
</your_room_name>
HegemonKhan wrote:
I'm not sure if you can put a "room description" for an EXIT, but you can use it's "look" attribute.
<your_room_name type="object">
<description type=script">
foreach (exit_x,ScopeExitsForRoom (player.parent)) {
if (exit_x = null) {
msg ("your_default_message_for_room_having_no_exits")
} else {
switch (exit_x) {
case ("name_of_exit_1") {
msg ("blah_1")
}
case ("name of exit_2") {
msg ("blah_2")
}
// case etc etc etc
}
}
}
</description>
</your_room_name>
<type name="BaseRoom">
<description type="script">
if (HasString(this, "realdescription")) {
OutputTextNoBr(this.realdescription)
}
foreach (exit,ScopeExitsForRoom (this)) {
if (HasString(exit, "description")) {
OutputTextNoBr(" " + exit.description)
}
}
</description>
</type>
<inherit name="BaseRoom" />
jaynabonne wrote:
My point is this: by having descriptions which are separate from the exit aliases and by showing the descriptions alone, and yet since Quest bases exit navigation on the alias, you're setting the player up by not showing them what they need to type. That can be very frustrating for the player in the long run. I'd be tempted to show the player both. Include the above code to dump out the descriptions, but don't mark the exits as scenery, so that at least Quest will dump out 'You can go down the stairs and down the ladder".
<object name="talking_wise_owl">
<inherit name="editor_object" />
<verb name="chat">
random_integer = GetRandomInt (1,3)
switch (random_integer) {
case (1) {
msg ("Your random integer is ONE.")
}
case (2) {
msg ("Your random integer is TWO.")
}
case (3) {
msg ("Your random integer is THREE.")
}
}
</verb>
</object>
<object name="talking_wise_owl">
<inherit name="editor_object" />
<verb name="chat">
random_integer = ToString (GetRandomInt (1,3))
switch (random_integer) {
case ("1") {
msg ("Your random integer is ONE.")
}
case ("2") {
msg ("Your random integer is TWO.")
}
case ("3") {
msg ("Your random integer is TWO.")
}
}
</verb>
</object>
HegemonKhan wrote:
though if I may, I'm still curious in attempting to understand what you want (hehe), and maybe I may be able to then offer you some useful assistance (or maybe not, we'll see, lol).
do you want a "hub~center" room that all the other rooms are connected to (via exits), but the game randomly chooses what room you go to from the "hub-center" room?
do you want the actual exits to change, as in this exit goes: "from room_A to room_B", but now when you go back through the same exit (which should be: from room_B to room_A) is now: "from room_B to room_C" ??
or do you mean something something else by random exits ??
HegemonKhan wrote:
--------------
If I understand Jaynne's code, I think it does the same thing as mine, but much much better (it allows you to easily put in your description for the room itself and for what exits that room has too ~ If I understand Jaynne's code anyways, lol). I think you just got to add in a "autodescription" String attribute for each room (unfortunately, since this is your customized message, I don't think any other way but to do it for each room, as each room will have a different unique description right?), and then a description for each exit too. Then, just add the Inherited Attribute (scroll down to the bottom to find the BaseRoom that you created in~with the Object Type ~ "Type" type attribute ~ BaseRoom), BaseRoom, to each of your rooms.
Though, this may be incorrect, so let or ask Jaynne to accurately help with getting his own code and system into your game.
HegemonKhan wrote:
p.s.
(from your post) ~ ya, sorry, I meant random with my wrong use of "dynamic" in my post.
p.s.s.
also, feel free to ask, as I~we will be glad to help you do something (like our codings) in~through~with the GUI, just let I~us know if you need the help! (actually the format~structure~syntax of the GUI and via-in Code are quite different, it's not easy to match up the GUI with it's coding equivalent and vice-versa)
HegemonKhan wrote:if you just want random travel between rooms (any room can randomly lead to any other room*), then I think I can construct a command and~or verb for you (in code, as it is easier for me, and I'll help you with adding it correctly ~ ie to the right places in your game code). this would completely negate the need~use of exits however. Though, I'm sure I can find an alternative if you need some of the exits' possible attribute features (such as descriptions or whatever ~ I can't recall what options~features exits have off the top of my head, lol).
*I think I can also make it so that the randomization will apply only to the remaining unvisited rooms too, so you can actually visit all of them, lol.
left pane~side, the "tree of stuff":
(this is what it looks like upon a new game creation; it's default list)
Objects
-> game
->-> Verbs
->-> Commands
-> room
->-> player
Functions
Timers
Walkthrough
Advanced (click on the tiny box with a "+" in it, to reveal the things seen below)
-> Included Libraries
->-> English.aslx
->-> Core.aslx
-> Templates
-> Dynamic Templates
-> Object Types
-> Javascript
V
...
V
Filter -> Show Library Objects (reveals all the "default, built-in" stuff within the Core.aslx code, as light grey text)
<object name="HK">
<alive type="boolean">false</alive>
<dead type="boolean">false</dead>
<undead type="boolean">false</undead>
<walking type="boolean">false</walking>
<running type="boolean">false</running>
<crawling type="boolean">false</crawling>
<climbing type="boolean">false</climbing>
<sitting type="boolean">false</sitting>
<jumping type="boolean">false</jumping>
<falling type="boolean">false</falling>
<swimming type="boolean">false</swimming>
<flying type="boolean">false</flying>
<floating type="boolean">false</floating>
<resting type="boolean">false</resting>
<sleeping type="boolean">false</sleeping>
<drowning type="boolean">false</drowning>
<casting type="boolean">false</casting>
<sneaking type="boolean">false</sneaking>
<stealing type="boolean">false</stealing>
<talking type="boolean">false</talking>
<speaking type="boolean">false</speaking>
<singing type="boolean">false</singing>
<dancing type="boolean">false</dancing>
<working type="boolean">false</working>
<playing type="boolean">false</playing>
<digging type="boolean">false</digging>
<lying type="boolean">false</lying>
<flirting type="boolean">false</flirting>
<taunting type="boolean">false</taunting>
<detected type="boolean">false</detected>
<undetected type="boolean">false</undetected>
<noticed type="boolean">false</noticed>
<unnoticed type="boolean">false</unnoticed>
<defending type="boolean">false</defending>
<escaping type="boolean">false</escaping>
<escaped type="boolean">false</escaped>
<hostile type="boolean">false</hostile>
<following type="boolean">false</following>
<tired type="boolean">false</tired>
<sleepy type="boolean">false</sleepy>
<hungry type="boolean">false</hungry>
<thirsty type="boolean">false</thirsty>
<poisoned type="boolean">false</poisoned>
<petrified type="boolean">false</petrified>
<diseased type="boolean">false</diseased>
<confused type="boolean">false</confused>
<silenced type="boolean">false</silenced>
<paralyzed type="boolean">false</paralyzed>
<stunned type="boolean">false</stunned>
<asleep type="boolean">false</asleep>
<blinded type="boolean">false</blinded>
<crippled type="boolean">false</crippled>
<disabled type="boolean">false</disabled>
<injured type="boolean">false</injured>
<intoxicated type="boolean">false</intoxicated>
<drugged type="boolean">false</drugged>
<scared type="boolean">false</scared>
<cursed type="boolean">false</cursed>
<married type="boolean">false</married>
<pregnant type="boolean">false</pregnant>
<status_effected type="boolean">false</status_effected>
<magic_effected type="boolean">false</magic_effected>
<bipedal type="boolean">false</bipedal>
<quadripedal type="boolean">false</quadripedal>
<life_point type="string">"LP:" + current_life_point + " / " + maximum_life_point</life_point>
<mana_point type="string">"MP:" + current_mana_point + " / " + maximum_mana_point</mana_point>
<current_life_point type="int">0</current_life_point>
<maximum_life_point type="int">0</maximum_life_point>
<current_mana_point type="int">0</current_mana_point>
<maximum_mana_point type="int">0</maximum_mana_point>
<strength type="int">0</strength>
<endurance type="int">0</endurance>
<dexterity type="int">0</dexterity>
<agility type="int">0</agility>
<speed type="int">0</speed>
<piety type="int">0</piety>
<intelligence type="int">0</intelligence>
<spirituality type="int">0</spirituality>
<mentality type="int">0</mentality>
<luck type="int">0</luck>
<perception type="int">0</perception>
<personality type="int">0</personality>
<leadership type="int">0</leadership>
<charisma type="int">0</charisma>
<alignment type="int">0</alignment>
<reputation type="int">0</reputation>
<experience type="int">0</experience>
<cash type="int">0</cash>
<hostility type="int">0</hostility>
<precision type="int">0</precision>
<fatigue type="int">0</fatigue>
<stamina type="int">0</stamina>
<encumbrance type="int">0</encumbrance>
<level type="int">0</level>
<age type="int">0</age>
<recovery_time type="int">0</recovery_time>
<reaction_time type="int">0</reaction_time>
<creativity type="int">0</creativity>
<accuracy type="int">0</accuracy>
<morale type="int">0</morale>
<morality type="int">0</morality>
<body_weight type="int">0</body_weight>
<body_height type="int">0</body_height>
<carry_weight type="int">0</carry_weight>
<alias type="string"></alias>
<gender type="string"></gender>
<species type="string"></species>
<race type="string"></race>
<class type="string"></class>
<specialization type="string"></specialization>
</object>
<object name="Amy">
<alive type="boolean">false</alive>
<dead type="boolean">false</dead>
<undead type="boolean">false</undead>
<walking type="boolean">false</walking>
<running type="boolean">false</running>
<crawling type="boolean">false</crawling>
<climbing type="boolean">false</climbing>
<sitting type="boolean">false</sitting>
<jumping type="boolean">false</jumping>
<falling type="boolean">false</falling>
<swimming type="boolean">false</swimming>
<flying type="boolean">false</flying>
<floating type="boolean">false</floating>
<resting type="boolean">false</resting>
<sleeping type="boolean">false</sleeping>
<drowning type="boolean">false</drowning>
<casting type="boolean">false</casting>
<sneaking type="boolean">false</sneaking>
<stealing type="boolean">false</stealing>
<talking type="boolean">false</talking>
<speaking type="boolean">false</speaking>
<singing type="boolean">false</singing>
<dancing type="boolean">false</dancing>
<working type="boolean">false</working>
<playing type="boolean">false</playing>
<digging type="boolean">false</digging>
<lying type="boolean">false</lying>
<flirting type="boolean">false</flirting>
<taunting type="boolean">false</taunting>
<detected type="boolean">false</detected>
<undetected type="boolean">false</undetected>
<noticed type="boolean">false</noticed>
<unnoticed type="boolean">false</unnoticed>
<defending type="boolean">false</defending>
<escaping type="boolean">false</escaping>
<escaped type="boolean">false</escaped>
<hostile type="boolean">false</hostile>
<following type="boolean">false</following>
<tired type="boolean">false</tired>
<sleepy type="boolean">false</sleepy>
<hungry type="boolean">false</hungry>
<thirsty type="boolean">false</thirsty>
<poisoned type="boolean">false</poisoned>
<petrified type="boolean">false</petrified>
<diseased type="boolean">false</diseased>
<confused type="boolean">false</confused>
<silenced type="boolean">false</silenced>
<paralyzed type="boolean">false</paralyzed>
<stunned type="boolean">false</stunned>
<asleep type="boolean">false</asleep>
<blinded type="boolean">false</blinded>
<crippled type="boolean">false</crippled>
<disabled type="boolean">false</disabled>
<injured type="boolean">false</injured>
<intoxicated type="boolean">false</intoxicated>
<drugged type="boolean">false</drugged>
<scared type="boolean">false</scared>
<cursed type="boolean">false</cursed>
<married type="boolean">false</married>
<pregnant type="boolean">false</pregnant>
<status_effected type="boolean">false</status_effected>
<magic_effected type="boolean">false</magic_effected>
<bipedal type="boolean">false</bipedal>
<quadripedal type="boolean">false</quadripedal>
<life_point type="string">"LP:" + current_life_point + " / " + maximum_life_point</life_point>
<mana_point type="string">"MP:" + current_mana_point + " / " + maximum_mana_point</mana_point>
<current_life_point type="int">0</current_life_point>
<maximum_life_point type="int">0</maximum_life_point>
<current_mana_point type="int">0</current_mana_point>
<maximum_mana_point type="int">0</maximum_mana_point>
<strength type="int">0</strength>
<endurance type="int">0</endurance>
<dexterity type="int">0</dexterity>
<agility type="int">0</agility>
<speed type="int">0</speed>
<piety type="int">0</piety>
<intelligence type="int">0</intelligence>
<spirituality type="int">0</spirituality>
<mentality type="int">0</mentality>
<luck type="int">0</luck>
<perception type="int">0</perception>
<personality type="int">0</personality>
<leadership type="int">0</leadership>
<charisma type="int">0</charisma>
<alignment type="int">0</alignment>
<reputation type="int">0</reputation>
<experience type="int">0</experience>
<cash type="int">0</cash>
<hostility type="int">0</hostility>
<precision type="int">0</precision>
<fatigue type="int">0</fatigue>
<stamina type="int">0</stamina>
<encumbrance type="int">0</encumbrance>
<level type="int">0</level>
<age type="int">0</age>
<recovery_time type="int">0</recovery_time>
<reaction_time type="int">0</reaction_time>
<creativity type="int">0</creativity>
<accuracy type="int">0</accuracy>
<morale type="int">0</morale>
<morality type="int">0</morality>
<body_weight type="int">0</body_weight>
<body_height type="int">0</body_height>
<carry_weight type="int">0</carry_weight>
<alias type="string"></alias>
<gender type="string"></gender>
<species type="string"></species>
<race type="string"></race>
<class type="string"></class>
<specialization type="string"></specialization>
</object>
<object name="orc">
<alive type="boolean">false</alive>
<dead type="boolean">false</dead>
<undead type="boolean">false</undead>
<walking type="boolean">false</walking>
<running type="boolean">false</running>
<crawling type="boolean">false</crawling>
<climbing type="boolean">false</climbing>
<sitting type="boolean">false</sitting>
<jumping type="boolean">false</jumping>
<falling type="boolean">false</falling>
<swimming type="boolean">false</swimming>
<flying type="boolean">false</flying>
<floating type="boolean">false</floating>
<resting type="boolean">false</resting>
<sleeping type="boolean">false</sleeping>
<drowning type="boolean">false</drowning>
<casting type="boolean">false</casting>
<sneaking type="boolean">false</sneaking>
<stealing type="boolean">false</stealing>
<talking type="boolean">false</talking>
<speaking type="boolean">false</speaking>
<singing type="boolean">false</singing>
<dancing type="boolean">false</dancing>
<working type="boolean">false</working>
<playing type="boolean">false</playing>
<digging type="boolean">false</digging>
<lying type="boolean">false</lying>
<flirting type="boolean">false</flirting>
<taunting type="boolean">false</taunting>
<detected type="boolean">false</detected>
<undetected type="boolean">false</undetected>
<noticed type="boolean">false</noticed>
<unnoticed type="boolean">false</unnoticed>
<defending type="boolean">false</defending>
<escaping type="boolean">false</escaping>
<escaped type="boolean">false</escaped>
<hostile type="boolean">false</hostile>
<following type="boolean">false</following>
<tired type="boolean">false</tired>
<sleepy type="boolean">false</sleepy>
<hungry type="boolean">false</hungry>
<thirsty type="boolean">false</thirsty>
<poisoned type="boolean">false</poisoned>
<petrified type="boolean">false</petrified>
<diseased type="boolean">false</diseased>
<confused type="boolean">false</confused>
<silenced type="boolean">false</silenced>
<paralyzed type="boolean">false</paralyzed>
<stunned type="boolean">false</stunned>
<asleep type="boolean">false</asleep>
<blinded type="boolean">false</blinded>
<crippled type="boolean">false</crippled>
<disabled type="boolean">false</disabled>
<injured type="boolean">false</injured>
<intoxicated type="boolean">false</intoxicated>
<drugged type="boolean">false</drugged>
<scared type="boolean">false</scared>
<cursed type="boolean">false</cursed>
<married type="boolean">false</married>
<pregnant type="boolean">false</pregnant>
<status_effected type="boolean">false</status_effected>
<magic_effected type="boolean">false</magic_effected>
<bipedal type="boolean">false</bipedal>
<quadripedal type="boolean">false</quadripedal>
<life_point type="string">"LP:" + current_life_point + " / " + maximum_life_point</life_point>
<mana_point type="string">"MP:" + current_mana_point + " / " + maximum_mana_point</mana_point>
<current_life_point type="int">0</current_life_point>
<maximum_life_point type="int">0</maximum_life_point>
<current_mana_point type="int">0</current_mana_point>
<maximum_mana_point type="int">0</maximum_mana_point>
<strength type="int">0</strength>
<endurance type="int">0</endurance>
<dexterity type="int">0</dexterity>
<agility type="int">0</agility>
<speed type="int">0</speed>
<piety type="int">0</piety>
<intelligence type="int">0</intelligence>
<spirituality type="int">0</spirituality>
<mentality type="int">0</mentality>
<luck type="int">0</luck>
<perception type="int">0</perception>
<personality type="int">0</personality>
<leadership type="int">0</leadership>
<charisma type="int">0</charisma>
<alignment type="int">0</alignment>
<reputation type="int">0</reputation>
<experience type="int">0</experience>
<cash type="int">0</cash>
<hostility type="int">0</hostility>
<precision type="int">0</precision>
<fatigue type="int">0</fatigue>
<stamina type="int">0</stamina>
<encumbrance type="int">0</encumbrance>
<level type="int">0</level>
<age type="int">0</age>
<recovery_time type="int">0</recovery_time>
<reaction_time type="int">0</reaction_time>
<creativity type="int">0</creativity>
<accuracy type="int">0</accuracy>
<morale type="int">0</morale>
<morality type="int">0</morality>
<body_weight type="int">0</body_weight>
<body_height type="int">0</body_height>
<carry_weight type="int">0</carry_weight>
<alias type="string"></alias>
<gender type="string"></gender>
<species type="string"></species>
<race type="string"></race>
<class type="string"></class>
<specialization type="string"></specialization>
</object>
<object name="HK">
<inherit name="character_type" />
</object>
<object name="Amy">
<inherit name="character_type" />
</object>
<object name="orc">
<inherit name="character_type" />
</object>
<type name="character_type">
<alive type="boolean">false</alive>
<dead type="boolean">false</dead>
<undead type="boolean">false</undead>
<walking type="boolean">false</walking>
<running type="boolean">false</running>
<crawling type="boolean">false</crawling>
<climbing type="boolean">false</climbing>
<sitting type="boolean">false</sitting>
<jumping type="boolean">false</jumping>
<falling type="boolean">false</falling>
<swimming type="boolean">false</swimming>
<flying type="boolean">false</flying>
<floating type="boolean">false</floating>
<resting type="boolean">false</resting>
<sleeping type="boolean">false</sleeping>
<drowning type="boolean">false</drowning>
<casting type="boolean">false</casting>
<sneaking type="boolean">false</sneaking>
<stealing type="boolean">false</stealing>
<talking type="boolean">false</talking>
<speaking type="boolean">false</speaking>
<singing type="boolean">false</singing>
<dancing type="boolean">false</dancing>
<working type="boolean">false</working>
<playing type="boolean">false</playing>
<digging type="boolean">false</digging>
<lying type="boolean">false</lying>
<flirting type="boolean">false</flirting>
<taunting type="boolean">false</taunting>
<detected type="boolean">false</detected>
<undetected type="boolean">false</undetected>
<noticed type="boolean">false</noticed>
<unnoticed type="boolean">false</unnoticed>
<defending type="boolean">false</defending>
<escaping type="boolean">false</escaping>
<escaped type="boolean">false</escaped>
<hostile type="boolean">false</hostile>
<following type="boolean">false</following>
<tired type="boolean">false</tired>
<sleepy type="boolean">false</sleepy>
<hungry type="boolean">false</hungry>
<thirsty type="boolean">false</thirsty>
<poisoned type="boolean">false</poisoned>
<petrified type="boolean">false</petrified>
<diseased type="boolean">false</diseased>
<confused type="boolean">false</confused>
<silenced type="boolean">false</silenced>
<paralyzed type="boolean">false</paralyzed>
<stunned type="boolean">false</stunned>
<asleep type="boolean">false</asleep>
<blinded type="boolean">false</blinded>
<crippled type="boolean">false</crippled>
<disabled type="boolean">false</disabled>
<injured type="boolean">false</injured>
<intoxicated type="boolean">false</intoxicated>
<drugged type="boolean">false</drugged>
<scared type="boolean">false</scared>
<cursed type="boolean">false</cursed>
<married type="boolean">false</married>
<pregnant type="boolean">false</pregnant>
<status_effected type="boolean">false</status_effected>
<magic_effected type="boolean">false</magic_effected>
<bipedal type="boolean">false</bipedal>
<quadripedal type="boolean">false</quadripedal>
<life_point type="string">"LP:" + current_life_point + " / " + maximum_life_point</life_point>
<mana_point type="string">"MP:" + current_mana_point + " / " + maximum_mana_point</mana_point>
<current_life_point type="int">0</current_life_point>
<maximum_life_point type="int">0</maximum_life_point>
<current_mana_point type="int">0</current_mana_point>
<maximum_mana_point type="int">0</maximum_mana_point>
<strength type="int">0</strength>
<endurance type="int">0</endurance>
<dexterity type="int">0</dexterity>
<agility type="int">0</agility>
<speed type="int">0</speed>
<piety type="int">0</piety>
<intelligence type="int">0</intelligence>
<spirituality type="int">0</spirituality>
<mentality type="int">0</mentality>
<luck type="int">0</luck>
<perception type="int">0</perception>
<personality type="int">0</personality>
<leadership type="int">0</leadership>
<charisma type="int">0</charisma>
<alignment type="int">0</alignment>
<reputation type="int">0</reputation>
<experience type="int">0</experience>
<cash type="int">0</cash>
<hostility type="int">0</hostility>
<precision type="int">0</precision>
<fatigue type="int">0</fatigue>
<stamina type="int">0</stamina>
<encumbrance type="int">0</encumbrance>
<level type="int">0</level>
<age type="int">0</age>
<recovery_time type="int">0</recovery_time>
<reaction_time type="int">0</reaction_time>
<creativity type="int">0</creativity>
<accuracy type="int">0</accuracy>
<morale type="int">0</morale>
<morality type="int">0</morality>
<body_weight type="int">0</body_weight>
<body_height type="int">0</body_height>
<carry_weight type="int">0</carry_weight>
<alias type="string"></alias>
<gender type="string"></gender>
<species type="string"></species>
<race type="string"></race>
<class type="string"></class>
<specialization type="string"></specialization>
</type>
<type name="equipment_type">
<use type="boolean">true</use>
<give type="boolean">true</give>
<drop type="boolean">true</drop>
<take type="boolean">true</take>
<weight type="int">0</weight>
<equipable type="boolean">true</equipable>
<unequipable type="boolean">true</unequipable>
<equipped type="boolean">false</equipped>
<equipable_layer type="int"></equipable_layer>
<equipable_slots type="list"></equipable_slots>
<inventoryverbs type="listextend">Equip;Unequip</inventoryverbs>
</type>
<type name="weapon_type">
<inherit name="equipment_type" />
<durability type="int">0</durability>
<attack_rating type="int">0</attack_rating>
<physical_damage type="int">0</physical_damage>
<fire_damage type="int">0</fire_damage>
<water_damage type="int">0</water_damage>
<earth_damage type="int">0</earth_damage>
<air_damage type="int">0</air_damage>
<dark_damage type="int">0</dark_damage>
<light_damage type="int">0</light_damage>
<unholy_damage type="int">0</unholy_damage>
<holy_damage type="int">0</holy_damage>
</type>
<type name="armor_type">
<inherit name="equipment_type" />
<durability type="int">0</durability>
<armor_class type="int">0</armor_class>
<physical_resistance type="int">0</physical_resistance>
<fire_resistance type="int">0</fire_resistance>
<water_resistance type="int">0</water_resistance>
<earth_resistance type="int">0</earth_resistance>
<air_resistance type="int">0</air_resistance>
<dark_resistance type="int">0</dark_resistance>
<light_resistance type="int">0</light_resistance>
<unholy_resistance type="int">0</unholy_resistance>
<holy_resistance type="int">0</holy_resistance>
</type>
<type name="clothing">
<inherit name="equipment_type" />
// etc attributes that I'm still brainstorming~thinking about, lol
</type>
<asl version="540">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Testing Game Stuff">
<gameid>d83ba5bb-2e3c-4f31-80c9-3e88a2dc082c</gameid>
<version>1.0</version>
<firstpublished>2013</firstpublished>
<start type="script">
function_1
on ready {
function_2
}
on ready {
function_3
}
</start>
</game>
<object name="room_name_1">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>
</object>
<object name="room_name_2">
<inherit name="editor_room" />
</object>
<object name="room_name_3">
<inherit name="editor_room" />
</object>
<object name="room_name_4">
<inherit name="editor_room" />
</object>
<object name="room_name_5">
<inherit name="editor_room" />
</object>
<object name="global_events_object">
<inherit name="editor_object" />
<parent>null</parent>
</object>
<function name="function_1">
global_events_object.room_object_list = NewObjectList()
foreach (object_x, AllObjects()) {
if (DoesInherit (object_x, "editor_room")) {
list add (global_events_object.room_object_list, object_x)
}
}
</function>
<function name="function_2">
if (ListCount (global_events_object.room_object_list) > 0) {
function_4 = ObjectListItem (global_events_object.room_object_list, GetRandomInt (0, ListCount (global_events_object.room_object_list) - 1))
list remove (global_events_object.room_object_list, function_4)
function_2
} else {
function_1
}
</function>
<function name="function_3">
x = 0
create exit (function_5, "exit", room_1, function_4)
create exit (function_5, "exit", room_1, room_2)
create exit (function_5, "exit", function_4, room_1)
list remove (global_events_object.room_object_list, room_1)
for (xxx, 0, ListCount (global_events_object.room_object_list) - 1) {
room_xxx = ObjectListItem (global_events_object.room_object_list, xxx)
create exit (function_5, "exit", room_xxx, function_6)
list remove (global_events_object.room_object_list, room_xxx)
}
</function>
<function name="function_4" type="string">
room_x = "room_"+GetString (ListCount (global_events_object.room_object_list))
return (room_x)
</function>
<function name="function_5" type="string">
x = x + 1
exit_x = "exit_"+GetString (x)
return (exit_x)
</function>
<function name="function_6" type="string">
room_x = "room_"+GetString (ListCount (global_events_object.room_object_list) - ListCount (global_events_object.room_object_list) + 2)
return (room_x)
</function>
</asl>
<!--Saved by Quest 5.4.4896.9778-->
<asl version="540">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="HegemonKhan's Example">
<gameid>b3dc064f-5c97-4289-8cc1-6eb1e9515723</gameid>
<version>1.0</version>
<firstpublished>2013</firstpublished>
<menufont>Georgia, serif</menufont>
</game>
<object name="room">
<inherit name="editor_room" />
</object>
<object name="room_name_1">
<inherit name="editor_room" />
<beforeenter type="script">
set (global_events_object, "room_object_list", NewObjectList())
function_1
on ready {
function_2
}
on ready {
function_3
}
</beforeenter>
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>
</object>
<object name="room_name_2">
<inherit name="editor_room" />
</object>
<object name="room_name_3">
<inherit name="editor_room" />
</object>
<object name="room_name_4">
<inherit name="editor_room" />
</object>
<object name="room_name_5">
<inherit name="editor_room" />
</object>
<object name="global_events_object">
<inherit name="editor_room" />
</object>
<function name="function_1">
foreach (object_x, AllObjects()) {
if (DoesInherit (object_x, "editor_room")) {
list add (global_events_object.room_object_list, object_x)
}
}
</function>
<function name="function_2"><![CDATA[
if (ListCount (global_events_object.room_object_list) > 0) {
function_4 = ObjectListItem (global_events_object.room_object_list, GetRandomInt (0, ListCount (global_events_object.room_object_list) - 1))
list remove (global_events_object.room_object_list, function_4)
function_2
}
else {
function_1
}
]]></function>
<function name="function_3">
x = 0
create exit (function_5(), "exit", room_1, function_4)
create exit (function_5(), "exit", room_1, room_2)
create exit (function_5(), "exit", function_4, room_1)
list remove (global_events_object.room_object_list, room_1)
for (xxx, 0, ListCount (global_events_object.room_object_list) - 1) {
room_xxx = ObjectListItem (global_events_object.room_object_list, xxx)
create exit (function_5, "exit", room_xxx, function_6)
list remove (global_events_object.room_object_list, room_xxx)
}
</function>
<function name="function_4" type="string">
room_x = "room_"+GetString (ListCount (global_events_object.room_object_list))
return (room_x)
</function>
<function name="function_5" type="string">
x = x + 1
exit_x = "exit_"+GetString (x)
return (exit_x)
</function>
<function name="function_6" type="string">
room_x = "room_"+GetString (ListCount (global_events_object.room_object_list) - ListCount (global_events_object.room_object_list) + 2)
return (room_x)
</function>
</asl>
jaynabonne wrote:I think before anyone can write the code, we need more definition.
For example:
1) How many exits can exist from room to room? Is it random? (e.g. 1-3)
2) Can you have an exit from a room back to itself? If not, then a check needs to be done to prevent that.
3) Which directions can be used for connections? N, S, E, W, NW, SE, Up, Down etc?
4) Do the random connections need to make logical sense? For example, if I go west twice and then north, can I end up back in the original room? If not, then you need to actually map out a room topology, not just assign random exits.
5) Are you generating new rooms, or just linking up existing rooms?
Creating "dungeon" topologies that make sense is not trivial. At least, let's get definition about what you want.
jaynabonne wrote:unless you mean perhaps a 3x3x3 cube (a hypercube given the wrap around exits? )...
Do you know roughly how many rooms you'll have? (I apologize if you've mentioned that already.)
+---+---+---+---+
| C | | H | E |
+---+---+---+---+
| | A | | |
+---+---+---+---+
| | B | | F |
+---+---+---+---+
| G | | D | |
+---+---+---+---+
<!--Saved by Quest 5.4.4873.16527-->
<asl version="540">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="imamyroomtest">
<gameid>45c9de1b-bcf4-4d7f-820d-80de6f7a670b</gameid>
<version>1.0</version>
<firstpublished>2013</firstpublished>
<dimsx type="int">3</dimsx>
<dimsy type="int">3</dimsy>
<dimsz type="int">3</dimsz>
<rooms type="stringlist">
<value>room1</value>
<value>room2</value>
<value>room3</value>
<value>room4</value>
<value>room5</value>
<value>room6</value>
<value>room7</value>
<value>room8</value>
<value>room9</value>
<value>room10</value>
</rooms>
<start type="script">
LayoutRooms
// Assign player to random room.
roomname = game.rooms[GetRandomInt(0, ListCount(game.rooms)-1)]
player.parent = GetObject(roomname)
</start>
</game>
<exit name="exit0-10" alias="north">
<inherit name="northdirection" />
</exit>
<exit name="exit-1-10" alias="northwest">
<inherit name="northwestdirection" />
</exit>
<exit name="exit-100" alias="west">
<inherit name="westdirection" />
</exit>
<exit name="exit-110" alias="southwest">
<inherit name="southwestdirection" />
</exit>
<exit name="exit010" alias="south">
<inherit name="southdirection" />
</exit>
<exit name="exit110" alias="southeast">
<inherit name="southeastdirection" />
</exit>
<exit name="exit100" alias="east">
<inherit name="eastdirection" />
</exit>
<exit name="exit1-10" alias="northeast">
<inherit name="northeastdirection" />
</exit>
<exit name="exit00-1" alias="up">
<inherit name="updirection" />
</exit>
<exit name="exit0-1-1" alias="up to the north" />
<exit name="exit-1-1-1" alias="up to the northwest" />
<exit name="exit-10-1" alias="up to the west" />
<exit name="exit-11-1" alias="up to the southwest" />
<exit name="exit01-1" alias="up to the south" />
<exit name="exit11-1" alias="up to the southeast" />
<exit name="exit10-1" alias="up to the east" />
<exit name="exit1-1-1" alias="up to the northeast" />
<exit name="exit001" alias="down">
<inherit name="downdirection" />
</exit>
<exit name="exit0-11" alias="down to the north" />
<exit name="exit-1-11" alias="down to the northwest" />
<exit name="exit-101" alias="down to the west" />
<exit name="exit-111" alias="down to the southwest" />
<exit name="exit011" alias="down to the south" />
<exit name="exit111" alias="down to the southeast" />
<exit name="exit101" alias="down to the east" />
<exit name="exit1-11" alias="down to the northeast" />
<object name="room1">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>
</object>
<object name="room2">
<inherit name="editor_room" />
</object>
<object name="room3">
<inherit name="editor_room" />
</object>
<object name="room4">
<inherit name="editor_room" />
</object>
<object name="room5">
<inherit name="editor_room" />
</object>
<object name="room6">
<inherit name="editor_room" />
</object>
<object name="room7">
<inherit name="editor_room" />
</object>
<object name="room8">
<inherit name="editor_room" />
</object>
<object name="room9">
<inherit name="editor_room" />
</object>
<object name="room10">
<inherit name="editor_room" />
</object>
<function name="CoordsToIndex" parameters="x, y, z" type="int">
return (x + game.dimsx*(y + game.dimsy*z))
</function>
<function name="LayoutRooms">
<![CDATA[
// Create a list to hold the assigned room indices.
assigned = NewList()
// Layout the first room.
room = game.rooms[0]
currentroom = GetObject(room)
currentroom.x = GetRandomInt(0, game.dimsx-1)
currentroom.y = GetRandomInt(0, game.dimsy-1)
currentroom.z = GetRandomInt(0, game.dimsz-1)
// Mark this room's slot.
list add (assigned, CoordsToIndex(currentroom.x, currentroom.y, currentroom.z))
// Layout the remaining rooms from here.
for (i, 1, ListCount(game.rooms)-1) {
room = game.rooms[i]
newroom = GetObject(room)
positioned = false
while (not positioned) {
// Select a random room top start from.
room = game.rooms[GetRandomInt(0, i-1)]
sourceroom = GetObject(room)
// Select a random direction from this room.
dirgood = false
while (not dirgood) {
dirx = GetRandomInt(-1, 1)
diry = GetRandomInt(-1, 1)
dirz = GetRandomInt(-1, 1)
dirgood = dirx <> 0 or diry <> 0 or dirz <> 0
}
//msg ("dir: " + dirx + ", " + diry + ", " + dirz)
// See if we can position the room here.
newroom.x = (sourceroom.x + dirx + game.dimsx) % game.dimsx
newroom.y = (sourceroom.y + diry + game.dimsy) % game.dimsy
newroom.z = (sourceroom.z + dirz + game.dimsz) % game.dimsz
index = CoordsToIndex(newroom.x, newroom.y, newroom.z)
positioned = not index in assigned
}
// Remember this position is used.
list add (assigned, index)
// Create and assign the exits.
exitname = "exit" + dirx + diry + dirz
oppname = "exit" + -dirx + -diry + -dirz
//msg("exitname = " + exitname + ", oppname = " + oppname)
newexit = clone(GetObject(exitname))
oppexit = clone(GetObject(oppname))
newexit.parent = sourceroom
newexit.to = newroom
oppexit.parent = newroom
oppexit.to = sourceroom
//msg ("pos: " + newroom.x + ", " + newroom.y + ", " + newroom.z)
currentroom = newroom
}
]]></function>
</asl>
jaynabonne wrote:Well, here is a first attempt:
What this *doesn't* do is create all the exits possible given the room layout. So if you start in room A, tunnel south to room B and then north east to room C, you will not end up with an exit as well from A to C, even though they're right next to each other. I don't think that's a big deal, but that can be changed if it's a problem. (There could be a final phase where it runs through all rooms and hooks up all adjacent rooms instead of generating exits based solely on the tunneling directions.)
I think this is basically working. There could be bugs. See how it works for you!
Edit: Updated the script to fix a minor issue.