Can You Copy and Paste Identical Rooms/Objects?

TextStories
I understand the name of the room or object (This really only pertains to objects in my case or at the moment anyway...) has to be different, even if by a single letter or number, while the alias can be what ever or even exactly the same. But is there a way to simply copy and paste (Or what ever the terminology is...) of an object to multiple rooms?

For instance, I want “grass” to be in most if not all of my outdoor areas and I want the player to be able to see it when looked at. So far I have to create a completely new object and copy and past my descriptions in each one, while checking or unchecking the appropriate boxes for the desired effects. It would be far easier and beneficial to simply copy the grass object it self and then paste it where ever I like.

Now whether the game would automatically name it “grass”, “grass1”, “grass2” etc., doesn't matter to me since I can go back and do that on my own, although it would be helpful. But what I am really after is to simply copy the object and place it in any outdoor room I want, with out the hassle of recreating it from scratch each time. (Or the same could be said for a vase on a table for an indoor room.) Is there a way to do that?

I have not gotten far enough in the tutorial to see it if it is there in plain site and for that I appologize. I know you guys get bogged down with some of the simpliest of questions with equally simple answers that are clearly taught or shown else where... or perhaps I had over looked it, but I have done a search and have not found what I am looking for, although there was a thread for copying duplicates to “another” game. I just want it in this one game at the moment. Thank you for your time and patience.

The Pixie
If you go into the code view (if you are offline), you can copy a section of the code, and then pste it in as many times as you like. Create a backup first! You have to get an entire XML element (start tag and end tag), and paste it in at an appropriate place.

For what you want, another approach may be better:
viewtopic.php?f=18&t=3154&hilit=environment

HegemonKhan
yes, you can literally copy and paste (though as you know, you'll need to change the Object's NAME Attribute, as it must be unique, no NAME Attribute can be the same, as it's the ID for the quest engine to differentiate all things, such as Objects, within quest:

<asl version="550">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="XXX">
<gameid>XXX</gameid>
<version>1.0</version>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>
</object>
</asl>


let's say that we want to copy and paste our 'player' Player Object to multiple rooms, as we want to have the user to be able to pick which character to start the game with (thus starting at a different location), for example, there's 5 characters (human, dwarf, elf, gnome, or halfling) to pick 1 hero from, whom you'll use to play through the game with, who'll have their own unique start location, interactions, events, ending, and etc within the game world's story~plot. Anyways, here's the relevant coding that you're asking about doing~using:

as can be seen below, I'm literally copying and pasting, lol:

(altering code, is creating the initial settings for~of all that is your game, you're creating your game, so you can copy and paste, delete, alter, and etc all you want, as this is your game creation, via code. You're not in the middle of playing the game, lol)

(I'm literally copy and pasting 'room' and 'player', hehe)

(I'll space the stuff, which actually can be done without causing code issues btw, so it's more easy for you to read~understand)

<asl version="550">

<include ref="English.aslx" />
<include ref="Core.aslx" />

<game name="XXX">
<gameid>XXX</gameid>
<version>1.0</version>
</game>

<object name="room">

<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 name="player2">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>

</object>

<object name="room3">

<inherit name="editor_room" />

<object name="player3">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>

</object>

<object name="room4">

<inherit name="editor_room" />

<object name="player4">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>

</object>

</asl>

Silver
Thinking out loud here so no idea if this would work...

You could set up a flag that changes from being outside or inside.

Then you could set up a command (which applies to the whole game) that runs an if script based on the flag.

Would that work?

If grass is everywhere outside it might. If only in some places it wouldn't (although people might not try to look at the grass in places where there isn't any).

TextStories
Thanks Pixie, I had actually came across that thread in my search, but dismissed it after looking at a couple of posts thinking it was not what I was looking for. I guess I will have to go back and check. And yes this morning as I was logging in, I figured it could be as simple as copying the “code” it self and pasting it in the right place, provided I changed the “name”. However, I was looking for something more convenient, not just for me, but others as well while in the regular mode, as in not the code view.

Thank you Khan, I will try that. And Silver I was thinking the same thing about making it a script or as you said a flag with a true or false something or other, but that is just getting way too technical for my mind. :lol:

The Pixie
TextStories wrote:And Silver I was thinking the same thing about making it a script or as you said a flag with a true or false something or other, but that is just getting way too technical for my mind. :lol:

You probably do not need the flag. Set up an "EXAMINE GRASS" command, and then just hope that if the player is inside, he will not type "EXAMINE GRASS".

Something like this?
<!--Saved by Quest 5.5.5328.26617-->
<asl version="550">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="grass">
<gameid>cb16669f-30ed-423c-914b-b4aec624995a</gameid>
<version>1.0</version>
<firstpublished>2014</firstpublished>
</game>
<object name="room">
<inherit name="editor_room" />
<alias>The Garden</alias>
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>
<object name="teapot">
<inherit name="editor_object" />
<alias>Teapot</alias>
<take />
</object>
<exit alias="west" to="house">
<inherit name="westdirection" />
</exit>
</object>
<command name="LookAtGrass">
<script>
msg ("The grass is green and lush")
</script>
<pattern type="string">(x|examine|look at|look) (grass|lawn)</pattern>
</command>
<object name="house">
<inherit name="editor_room" />
<alias>The House</alias>
<exit alias="east" to="room">
<inherit name="eastdirection" />
</exit>
</object>
</asl>

Silver
You might need to make some commands to cover a few bases. For instance, this would be weird:

>examine grass
The grass is green and lush

>take grass
I cant see that (grass)

As it's a command and not a scenery object it won't give any default answers to wrong verbs, it doesn't even know the grass exists.

TextStories
Well I would not want to have to rely on the player not typing grass if inside, just make it where if they had it would simply tell them there is no grass or that they do not see it. I assume there is a way to make a condition of inside or outdoors, but then again, maybe not every step out side you come across grass either. Right now, copying the code works just fine for me. :D

However, speaking of code and I may be able to find this elsewhere, but just a quick question regarding it... when I look at code view it is set up a certain way. I am not speaking of the code and all the symbols that go with it, more of the placement of the code. Like I see with scripts for instance and this wont be accurate, but I hope I get my meaning across-

---------------------{
------------------{
--------------{
-----------{
-------{

(The dashes are merely there to keep the brackets in place for this forum post.)

If I do not type the code exactly to those specifications where the brackets are in "mid air" or in the middle of the note pad as it were, it wont work? Or does the game itself reshuffle it all to the right places and I just need to worry that I have that many brackets as in-

{
{
{
{
{

Just curious. Thank you.

Silver
I did a little experiment earlier. I knew you could click and drag an object from one parent to another (offline editor). I thought maybe you would be able to either right click and have an option to copy the object attributes into the clipboard (that could be pasted elsewhere), or drag then right click to copy rather than move the object. Neither worked. Not sure if Alex would spend a whole wedge of time coding this to cater for the terminally lazy. :D

HegemonKhan
@textstories:

yes, the proper indenting ('nesting') is VITAL, as it tells containment layers (what's inside~outside of what: parent-child relationship), AND the ORDER~SEQUENCE of the SCRIPTING code lines~blocks.

Imagine an outline, what if you messed up it's indenting ??? :

properly indented outline:

I. Earth
A. Continents
1. Europe
a. Germany
1) berlin
b. France
2. Asia
a. China
b. Japan
3. Africa
a. Egypt
b. Libya
4. North America
5. South America
6. Australia
7. Antarctica
B. Oceans
1. Pacific
2. Atlantic
3. Indian
4. Arctic
5. Antarctic


an improper indented outline:

I. Earth
A. Continents
1. Europe
a. Germany
1) berlin
b. France
2. Asia
a. China
b. Japan
3. Africa
a. Egypt
b. Libya
4. North America
5. South America
6. Australia
7. Antarctica
B. Oceans
1. Pacific
2. Atlantic
3. Indian
4. Arctic
5. Antarctic


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

the indenting amount doesn't matter (1 space, 2 spaces ~ I use, 1 tab, etc), so long as it's systematic~universal, and you keep the proper nesting (indenting in-relation to the entire code, all of the other code lines~blocks)

I used to use my arrows ' -> ' (1 arrow = 2 spaces of indenting) for indenting in my old posts, but Jay pointed out what a bad habit this was, as it prevents people from being able to copy and paste, as they'd (or I myself, lol) have to delete those arrows. I've been trying to break this habit, using what this site already allows for, which works perfectly, the code tagging for~within posts.

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

@silver:

no, no one is going to try to code that, not when you already got a better method: copy and paste its code (and alter too, which your 'folder-file-like' copying of the object idea wouldn't be able to do).

there is for scripting though this:

CloneObject (look up on the quest doc resource site)

but this is for copying during game play (the running of the scripts).

TextStories
Yea I had tried that first Silver, hoping I could do it. When I could not, that is when I came here.

And that sucks you have to have nesting a certain way. Seems overly complicated. Good thing I have Quest. :lol:

jaynabonne
Just to be clear, *indentation* (the amount of spaces, tabs, etc you use) is irrelevant for XML. Proper nesting (where an element is contained within another) is. You could have all your XML on one line, or you could have it all flush left - it doesn't matter. As long as your elements are properly positioned such that things are contained at the appropriate level, you can ignore the look of the indentation. In fact, Quest will adjust the indentation when you save and reload the game anyway.

That's a world apart from a language like Python, where white space is *critical*. :)

Silver
I'm just thinking of ui functionality in other applications. Not everyone thinks in code. I can see what issues it might cause duplicating parent room objects in this way but not scenery children.

The Pixie
An alternative way to copy something (offline anyway) is to select it, then Copy from the Edit menu, then select where you want it to go, then Paste from the Edit menu. It will copy children too, and add numbers to the names to keep them unique.

I must admit I had not noticed this until just now. I am guessing it is not that well know?

Silver
Ah so it does do it as long as you know where to click. :)

TextStories
Sweet! :lol: It works perfectly, even naming it a different number for you. And an even quicker way is to highlight the object in question, then pressing Ctrl C and click on the room you want it in and then press Ctrl V. Works perfectly every time! Thank you! :D

Edit: You can do the same for a room and when you paste it again, it not only makes a whole new area, but brings everything that was inside the original with it, but very conveniently renames it all to fit the game! That is wonderful!

Silver
I could have sworn I tried ctrl c ctrl v :?

TextStories
At first I thought it was not working every time, only some of the time, since I had copied one object and placed it in a room that was already "open/-" and it showed that it "popped" up. But I wanted to test it properly in the game, in case some how the code it self got distorted while copying and pasting from one room to the next. So I began making new rooms just because and began the copying and pasting process. I found that when you do this the new room stays "closed/+", until you click on the plus sign and then it will show you all the items you had pasted into it. (I had like grass2, grass3, grass4, grass5, etc. because I thought I had not done it right the first time... :lol: ) I guess another way to describe it is parent/child. When you normally create a room and create a new object from scratch, the room and all that follows will automatically be shown.

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

Support

Forums