How do I set the room description?

imamy
Hi,

What's the script to allow me to set the room description? I'm creating exits randomly and I want to pair up these exits with a description. Thanks.

Amy

HegemonKhan
I'm not too sure on this (too lazy to start up quest to check it: make a description in GUI~Editor mode and then switch to Code View mode, to see how it's done in~as code), but hopefully this stuff helps:

http://quest5.net/wiki/Description
http://quest5.net/wiki/Exit_element

so it looks like (I think ~ guessing):

<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>


and there's toggle buttons in the GUI~Editor for room descriptions, look at the Game Object's Tabs and elsewhere maybe (like the room object's Tabs).

I'm not sure if you can put a "room description" for an EXIT, but you can use it's "look" attribute.

---------------------

as for doing this in the GUI~Editor, it should be self-explanatory: just find the text box or area to write your stuff into.

imamy
HegemonKhan wrote:
I'm not sure if you can put a "room description" for an EXIT, but you can use it's "look" attribute.


I want to add room description to a room. Since the exits are created randomly, I need to create random description to show that the room has an exit when the player looks around the room. I'm learning how to code and I'm not sure how to look up this type of information. Description is too ordinary a term and pulls up every post in my search. I'm hoping someone can help me narrow down the search and show me how I can manipulate room description.

Perhaps "look" is what I'm looking for. How do I set that?

Thanks.

*** Edit ***

I'll try giving an example.

Like room description without an East exit:

The room is barren. The doorway leads to the kitchen.

After adding an East exit:

The room is barren. The doorway leads to the kitchen. A bird sits by the window, crooning an enchanting melody.

I hope you can help me with this. Thanks.

HegemonKhan
forgive me, I'm still not quite clear what you want done, could you give an example scenario of what you want, and~or explain what you want with or what you're trying to do with, and what are, your random exits, what do you mean by random exits?

Also, are you working with (able to work with) the code? Or, are you using the GUI~Editor mode with the friendly buttons and etc that you can click on and choose? Do you want to be helped with in-code or in with the GUI~Editor?

---------------------

to "manipulate" the room description ("description") or the look~lookat verb ("look~lookat"), then you just need to change them to being "script" types (do a script or whatever it is called, instead of a "string" type of print a message or whatever it is called). then you got to add in a conditional ("If"), and etc scripts to do~get what you want done.

--------------------

use the wiki pages for searching, not the forum's threads-posts, here's useful pages, along with the search bar in the upper right for searching for whatever or anything else on the wiki:

http://quest5.net/wiki/Main_Page
http://quest5.net/wiki/Tutorial
http://quest5.net/wiki/How_to
http://quest5.net/wiki/Category:All_Fun ... t_Commands (page 1, range: A-S)
http://quest5.net/w/index.php?title=Cat ... h#mw-pages (page 2, range: S-Z)

and these will probably be useful too:

http://quest5.net/wiki/GetExitByName
http://quest5.net/wiki/GetExitByLink
http://quest5.net/wiki/AllExits
http://quest5.net/wiki/Contains
http://quest5.net/wiki/FormatExitList
http://quest5.net/wiki/ScopeExitsForRoom
http://quest5.net/wiki/ScopeExits
http://quest5.net/wiki/Description

if you want a dynamic description for your room object, which mentions about EXITS, then you'll need to use a script type for it:

while I'm not too familar with exits yet, hopefully this might work, or you'll need to do something like this...

(this is for non-random exits, though)

<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>


or if you want to be able to see into another room from your current room, then just use the "lookat" (or "look"~whatever it is) script attribute on the EXIT "object", instead.

--------------

If you're trying to do this through the GUI~Editor, then you just need to click on the pull down box, choosing "script", for the "lookat~look" or "description" scripts either for the exit object or the room object.

---------------

hopefully, someone else can help you with this stuff, as I've not yet become familar with working with this type of stuff yet.

imamy
I can use the GUI. I'm checking for alternatives. I don't have any code now. I started coding and then didn't like the obstacles that came up... deleted the code... started again... deleted... made a test program... so now I decided it's probably easier if I figure out what is available and then see what I prefer to manipulate and go from there.

Random: Is this dynamic? I was going to make a game where replaying the game would generate a different set of exits connecting the same set of rooms and these exits will only be generated at the start.

For each exit I make, I want to give it a room description because I want to get away from "north", "south", "up", "down" because in many rooms, the exits are going to go in a similar direction although each direction will lead to a different room and the current compass setup won't work for me. For example, "down a ladder" takes you to Room A and "down the stairs" takes you to Room B. But the room description will show only the description of an exit and won't show the exits. It will say something like: "A ladder made of wood and metal leads downwards." for Room A and "The stairs look slippery." for Room B. If the game decides to put the ladder exit in, the ladder will show up in the room description. And if the game decides to put the stairs exit in, then the stairs will show up in the room description. If the game decides to put both in, then both descriptions will show up.

jaynabonne
Here is one way to do it.

There is no built-in description for an exit. But you can easily create one yourself and then use it in your script. In order to apply this to all of your rooms, the easiest approach is to create a base type. Then you can inherit this type in all the rooms. Here is the base type:

  <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>


In each room that has these special exits, you will need to inherit from BaseRoom:

    <inherit name="BaseRoom" />


Since you are overriding the normal description script, I added a hook for a "realdescription" attribute in the room. You'd put the standard description string there.

If an exit has a "description" attribute, it will be output. If not, then... not. You will need to manually add a "description" string attribute to each exit. It's not a standard Quest GUI attribute. You can also mark an exit as "scenery", and it won't show up in the normal room description.

Now... here is the challenge: how does the player know what to type in order to traverse an exit? You can set the alias for the exit to things like "down the stairs" and "down the ladder". And then they'll be able to type things like "go down the ladder" and "go down the stairs". And if you type "down" or "go down", it will ask you which one you want to go down, if they are both in the same room.

However, the player will not be able to type things like "go down ladder" or even "go ladder". We're getting into the realm of "guess the verb" where only specific commands work, and it's not clear what those commands are, especially adding in words like "the". So you could leave it out, but then it's the opposite problem.

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".

imamy
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".


Thank you very much :)

I appreciate you building a script for me to apply.

I wasn't looking to change the exit's alias. Although re reading what I posted, I can see now how my words came out... and I'm kicking myself for having so much trouble describing the issue. I wasn't able to research this prior to posting my request and I am now just realizing how confusing I made my point. I hope you and HegemonKhan can forgive me for this as you both did quite a bit to help me.

The way I'm doing it now is that I build all the exits for every room from the first room object (where the player object is). After that is all done, I move the player object to the room where the adventure begins. I realized that because I created the exits after the game launched, that the descriptions had to be different each time the game started because the exits would be different. I can solve this by scripting each room but I was hoping there was a simpler way to change the room description (by building the descriptions from one place in the same way I built the exits in the first room). This could make it easier for me because then I wouldn't have to visit each room object to update its description.

The more I look at HegemonKhan's code, the more I think that this might be what I might have been looking for all along and I just don't recognize it because my coding ability at this point is poor and I am still trying to figure out how to apply it to the GUI.

I'm relying mainly on the GUI and the scripts it provides and working within the GUI's limitations. I have a small success with building a function to print out descriptions of exits but no luck in figuring out how to set a description to the room from outside of the room objects so I can avoid using variables excessively.

Thank you again for your help. I have much to think about.

HegemonKhan
laughs, I have a hard time too trying to say what I want to say or to ask about, as I too am still a noob with a lot of this stuff.

my own apologizes for trying to help with something that I'm not accutely familiar with myself, causing even more confusion, and not actually providing the help that I wanted to provide.

I like to try to help out others (just because that is a personal value of mine, and as well as that it further helps me with code learning too), but I need to try to stay out of things that I don't know what I'm talking about, as it just causes more confusion for the person I'm trying to help.

Never blame yourself for my thick-headed-slowness at understanding things, hehe. The apologies are mine for any and all of misunderstandings on my part. What you wrote was perfectly clear and concise, I'm just a dunce ;)

Also, my apologies for the coding stuff, I'll try to use the GUI when helping you in the future (if I can remember, lol), it's just a lot more effort to explain via~with the GUI, as coding is much faster and easier a method for giving an explanation. Trying to do a step by step guide using the GUI is not fun... it can take a good few hours at least, whereas copy and pasting code can take like only a few minutes if you know how to do its coding already. I have done a few posts using the GUI method in the past, but I've gotten lazy now, and been only providing coding in my posts, which is bad when I'm replying to new people who're still working with the GUI and don't know coding. Again, my apologies.

I'll let Jaynne help, as he's better with code, more familiar with the things you're asking about (exits, room descriptions, and etc), also this stuff that you want is a bit beyond my level as well, and he's much more clear and concise in his responses too.

---------------

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 ??

--------------

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.

--------------

Also, if you need help on how to do "randomization", there's many ways to do it, and I~we can gladly help you with this too.

for example, here's just one way to do it (in code, as I don't know how to do it in GUI ~ I'd have to look it up ~ it'd take a bit of time ~ I can do it, but you might have to wait a bit for me to look it up on how to do it):

http://quest5.net/wiki/GetRandomInt
http://quest5.net/wiki/Switch
http://quest5.net/wiki/Multiple_choices ... %22_script

<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>


or, if the above code doesn't work (not sure if it will due to a coding issue I'm unsure about at the moment):

<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>


this explains it via the GUI (and in code too):

http://quest5.net/wiki/Unlockdoor

and here's an explanation of how to use the "Switch" script (and how to use COMMANDS too = for~in the first link) in the GUI:

http://quest5.net/wiki/Hs-multiple
posting.php?mode=edit&f=10&p=25642

enjoy ;)

but, there's many other ways to do randomization too.

----------------------------------------------

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
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.

imamy
HegemonKhan, I'm happy whenever you help. No matter how confusing the whole thing gets, your answers opens my eyes to something outside of my scope and actually helps speed up my learning. I just worry I come off sounding idiotic and then people stop helping...

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 ??


There is a multitude of things I'm trying to make happen. I can use assistance on finding another way to tackle this idea in Quest.

There's no hub. The first room in my example from the other post is just a room containing the player. I am using that room to set up objects such as creating the exits, moving the objects to their proper rooms, and such. I don't know of any other way to initialize the objects at this time.

To prevent the replay from growing stale and until the puzzle is solved, I want to randomize the connections between the rooms. The goal remains the same, but the path to the goal changes slightly upon replay. The exits are generated only at the launch but once the adventure starts, the exits are static for the remainder of the story until it concludes.

Originally I was going to rely on the compass generated exits but I ran into difficulties (which I should have asked a question about but it didn't quite bother me enough at the time). I was trying to make exits go to different rooms even though the names sounded similar. However, when I played the game, I noticed that whenever I had 2 directions such as "down" and "down a ladder", the direction called "down" won whenever I typed in "down". It was like the other exit didn't even exist. That's how I started experimenting with creating 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.


LOL, I am not ready to work the code into the game. I am having trouble grasping the concept of a BaseRoom. Also, some of the basics seem to have gone over my head. The code makes sense when I read it but I'm not sure if that's what I've been looking for and how do I use it once I've inserted the code into my game? That's how I know I'm not ready. Since I don't "get" the basics, then I need to hold off on implementing until it doesn't feel like I'm just throwing a dart blindfolded while expecting a bullseye.

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)


Thanks :) I can use all the help I can get. I don't mind that they don't match up. I'm relying on the GUI now because that's all I can handle. But I know the day will come when I want something better and I can always pull up the posts and refer to them.

The oddest thing I notice about the way I learn is that once the question gets asked, the answer is so much easier to realize. It's like a weight taken off my shoulders and I can finally "see" what's in front of me.

I'm really grateful for helping me through this.

imamy
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.


Thanks. The connections are randomly generated but they still follow a logical pattern. Travel between rooms is only possible between adjacent rooms. I'm not sure of what you are proposing but I'll go for it if it's not too far from your original proposal. LOL, I didn't even think there was a way around using exits.

HegemonKhan
I'm working on finishing my response (and also getting some code that works for you too), so it's not that I'm not replying, I'm just "in the process" of replying, lol.

----------------------------

just quickly about jaynne's use of "baseroom" for now:

Conceptually:

An Object Type is like a basket, and you can put (add) all the "eggs" (Attributes) that you want into this basket. Then, instead of giving all your friends (Objects) each of those eggs, you instead give each of your friends this same single basket. It's a much faster and efficient way to distribute or to give the same bunch of attributes to a bunch of objects.

Would you rather be given a bag with your grocieries held in it, or just given your grocieries? hehe :mrgreen: Isn't that shopping cart convenient for putting all your grocieries into it, which you can then push it around and to your car, so you don't have to carry all the grocieries you can with your bare hands (having to make many trips) to your car? hehe :mrgreen:

How to physically do it:

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 Type (it's hidden under~within the "Advanced") -> Add->

your_newly_made_object_type -> Type (Tab, it's the only tab, lol) -> Inherited Types -> Add -> (will explain further down: yes you can have object types with object types inside of them, I'll give an example of it below)

your_newly_made_object_type -> Type (Tab, it's the only tab, lol) -> Attributes -> Add -> (no different then if this was an object)

To give the basket to each of your friends, you do this for each object:

Object_Name -> Attributes (Tab) -> Inherited Types -> Add -> (scroll down to the very bottom to find the new "Types" ~ Object Types that you just created) -> all the attributes that you added to the Object Type, are now also added to this object automatically.

for example:

this is not fun even with copy and paste (as well as it taking up a ton of more space too, lol):

<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>


imagine if I wasn't copy and pasting too... typing in each attribute individually for each object... carpel tunnel syndrone! I think you get the idea... lol, doing this via the GUI~Editor isn't any more fun either, lol. that's a lot of "#$!%" attributes to add!

now compare it to this instead (much much shorter!):

<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>


oh, and here's how~why you'd have object types within object types (not the best nor completed example, but it's just being used as example anyways, lol):

<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>

imamy
Holy Smokes!

This stuff is better. I found myself scrolling through pages of variables when I was working on exits. I'll see if I can make this work with the Online Version.

Don't worry about quick replies especially when other things are occupying your time as well. I like the details in your answer but I know that takes a while to put together too.

HegemonKhan
Help Me, Please Someone Who's Good With Coding!

this is my best attempt at trying to code for random exits for x_amount of rooms, I've no idea if this is even remotely close to working, as I can't get past the initial trouble shooting. Could someone take a look at this, and let me know if I'm even on the right track in my coding, and if yes, help me finish up the inital trouble-shooting. My mind is dead from trying to work on this code, I can't even think enough to figure out the initial trouble-shooting. Hopefully, you can make some sense of what I'm trying to do in this, and if not, ask me, so I can try to explain what I am trying to do with my code, so you can then help.

<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>

imamy
Thanks Hegemon, I'm going to see if I can figure this out. XD

Amy

imamy
Hey, I can't say I understood any of the code but I punched it into the Online Version.

I made 1 change to function 3:

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)

My result:

Error running script: Error compiling expression 'x + 1': Unknown object or variable 'x'
Error running script: Error compiling expression '"exit"': RootExpressionElement: Cannot convert type 'String' to expression result of 'Element'
You are in a room_name_1.

Stopped here because I didn't know what to initialize x to...

<!--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>


I'll keep studying it. Just thought you should see how the code looked from my end. I think I copied it precisely into the Online Version.

Thanks :) I think punching it in taught me a bit more about features I probably wouldn't have discovered in the Online Version.

Amy

jaynabonne
The code (as stated) does not work. Let me look at it...

jaynabonne
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.

imamy
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.


I got excited at seeing the code and couldn't help tinkering with it.

If it were something that I can apply to my game...

1) How many exits can exist from room to room? Is it random? (e.g. 1-3)
At least 1 exit, maximum of 3. This part doesn't have to be random but at the time when I was mulling over implementation, it looked easier to make the total of exits random.

2) Can you have an exit from a room back to itself? If not, then a check needs to be done to prevent that.
It can have an exit back to the room itself.

3) Which directions can be used for connections? N, S, E, W, NW, SE, Up, Down etc?
I have something very tricky going on with the directions. N, S, E, W, NW, SE, Up, Down + diagonal directions upward and downward. Upper North will take you to the room that's above the room that's north of your current room. Lower East will take you to the room that's below the room that is east of your current room.

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.
The rooms are set up logically for the most part. Rooms may only have exits touching its boundaries. A room may have exits to N, S, E, W, NW, SE, Up, Down + diagonally. For the topology, I was thinking of along a rectangular shape (3x3 or 3x4). The illogical part is that when you reach the outermost room, then it wraps to the other side. In a 3 x 3, if you were in Room A1, going east will take you to A2, from there going east will take you to A3, and then going east again will take you back to A1.

5) Are you generating new rooms, or just linking up existing rooms?
Just linking up existing rooms.

jaynabonne
I'm still a bit unsure of the exact thing you'd like. For example, a 3x3 or 3x4 grid would not have up and downs as well, unless you mean perhaps a 3x3x3 cube (a hypercube given the wrap around exits? :) )...

Given what you've said, it might work to have a 3D array - corresponding to a 3D space - that the rooms get assigned to randomly (with perhaps more slots than rooms to keep it from being too regular), and then the exits would fall out naturally from the room layout.

Do you know roughly how many rooms you'll have? (I apologize if you've mentioned that already.)

imamy
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.)


Hey, yep, I meant it to be three dimensional XD.

Approximately 10 to 12 rooms.

My original plan was a 3x3x3 cube or the 3x3x4 (whatchamacallit), where a randomly generated path would connect 10 to 12 rooms. The unconnected rooms wouldn't go into play. The rooms should already be set up and I was going to match the room's random exits to their corresponding exit description so it would look more like the exits were laid out ahead of time instead of at game launch.

I liked Hegemon's idea of building a script to handle creating exits randomly. I didn't consider this a possibility until now since my programming skills aren't there yet. I am open to alternative ways of handling exits since the effect of what I want to achieve may be a bit unwieldy, a bit overly specific, and may possibly be easier to achieve in other ways. The main thing I liked is that there is something I can use to create the exits randomly. I guess if all the script did was create the exits and then let me know where the exits were, then I could use that info and assign the descriptions for the exits in some other way.

jaynabonne
Ok, that's starting to gel a bit. It should be possible to make a script for that. I'm not sure about some rooms being disconnected and not coming into play. Your initial starting room could be one of the disconnected and go nowhere - which would be no fun.

I was doodling a bit last night, seeing how things would look, and I had this sample (see below). I kept it 2D to be able to see the example better.

+---+---+---+---+
| C | | H | E |
+---+---+---+---+
| | A | | |
+---+---+---+---+
| | B | | F |
+---+---+---+---+
| G | | D | |
+---+---+---+---+


This is a 4x4 grid with 8 rooms (A-H) "randomly" assigned. The question is: what would the exits be? If we can figure that out, then we can extrapolate it to a 3D case. In this case, there is a room one step away from every other room, so all the rooms would be connected by simple exits:

A goes NW to C, NE to H, and S to B
B goes N to A, SW to G and SE to D
C goes SE to A
D goes NW to B, NE to F, and S to H
E goes W to H and E to C
etc.

However, the sparseness of it means that you wouldn't get that "wrap around" effect you were talking about, unless rooms happened to be in the right spots - like E and C in this case (and D and H vertically).

Would you want something like room B connects to F (though it jumps 2 squares) and F goes round to B?

Think about this example a bit to see if it fits what you had in mind (in a simplified 2D case).

The problem with a 3x3x3 block with 10-12 rooms is that over half the slots will be unfilled. If you randomly assign rooms to slots and then only connect immediately adjacent rooms, I wonder how degenerate it could be. :)

jaynabonne
One thing to keep in mind: if you do want complete freedom for exits (e.g. even things like "up to the northwest"), then you have 26 possible exits from each room. (A 1D space would have 3^1-1 exits, which is 2 [left, right]; a 2D space has 3^2-1 exits, which is 8 [the Quest compass]; and a 3D space has 3^3-1 = 26 exits [who knows? :)]).

How did you plan on the player navigating those exits?

imamy
LOL. How the player does get around is a work in progress. Much of my answer is limited by my understanding of how to tell an IF story and Quest is my first IF program.

The exits could have descriptive names. Such as staircase going up, ladder going down, or out the window. I would like to enable directions like N, S, E, W, NW, SE, Up, Down, for cases where it is obvious that is the direction the player is going. Instead of saying "climb the tree", a simple "up" would make a nice option, but I don't know how to make it so... yet :)

The ugly approach would be to say, to travel to adjacent rooms that are one level above, "go up north", "go up south", ...

I most definitely have my heart set to "appear" that a room could exit in 26 possible directions. The only rooms that wrap around would be the rooms that reside on the surface of the cube. So room B, such as the one in the diagram, will never connect to F. Setting up the rooms this way, is actually more to help me keep the story straight as each room in the cube serves a specific function.

jaynabonne
Well, here is a first attempt:

<!--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>


You need to set these things in the game object:
- rooms: a list of the rooms to be laid out. These are the names (as a string list) of the rooms.
- dimsx, dimsy, dimsz: The dimensions of the space to lay out inside. Currently, 3x3x3.

Then call LayoutRooms. In the example, it's in the start script. The start script also picks a random start room for the player.

The algorithm used is to basically randomly assign the first room and then for each room after that, position the next room in a random direction from one of the previously laid out rooms, creating both outgoing and incoming exits. This does mean that the early rooms in the list will have a greater chance of multiple exits and the final room will always have just a single exit (keep that in mind).

Directions are as follows:
- x = -1 : west
- x = 1 : east
- y = -1 : north
- y = 1 : south
- z = -1 : up
- z = 1 : down

An exit name is just a concatenation of all three dims, as "exitXYZ". For example, north is "exit0-10" and "up to the south" is "exit01-1".

There is a an exit defined for each possible direction (all 26 of them). These are prototype exits - the actual exits used are cloned from these. The exit names are critical (do not change!), but the aliases can be whatever you want.

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.

HegemonKhan
wow, awesome code, Jaynne! (HK will try to study this and make sense of it... as his attempt was far off, HK's got a long ways to go, and a lot of studying of Jaynne's code, hehe)

imamy
Thank you Jay! =)

I don't think it ever occurred to me to map it out with coordinates. It's beautiful. I get from HK's response that it works really well. And, I get this feeling I can actually make the 3 D dungeon as large as I want! Woot! An opportunity to really confuse the player! I mean... challenge the player.

Amy

imamy
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.


Thanks for the algorithm breakdown. I think as long as any room has 1 exit (ideally returning to the room it came from) is all I need. And I won't change the exit names. They are so logical, I'd probably be lost if I did change the names. (I read the code before I read your instructions, and that detail was the first Wow on my list. The second one was when I realized what dims stood for, as a result of seeing the pattern in the exit names). I'm still trying to figure out how you coded up and down. I can't find it.

I'm not quite sure what the last point is about. It sounds like Room A created exits to B and C but C doesn't return to A but B does return to A.

I don't forsee a bug stopping me from enjoying the script. If I run into any problems, I'll bring them up. And, since I have to adapt this to the online version, I'm sure a few version related surprises will crop up as well too.

Already you have me changing the direction of how I want to code the rooms. Before this, I was thinking of creating the rooms linearly, create 1 room, build exits, then create rooms from those exits. Now I'm thinking, how do I provide the room with coordinate attributes so that the game can just look up the room? This is going to be fun! I feel so much wiser already.

jaynabonne
You got what I was trying to say. One result of that is that you would never have the wraparound effect you were talking about, as rooms would never hook up. But I don't think that's a deal breaker, and I'm glad it's going to work for you. (fingers crossed)

This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums