is cloning posiible

in my game i wanted to make the bullet clone like as you shoot it. it will clone befor i disappears?
i checked the manual/recipe book in the search thingy but no sign of cloning i found duplicate but those were forr name duplicaions not what i was going for …

is it possible to clone/duplicate something like make another of them

Do you need the second bullet to do anything? Because if not you could just write it as part of the story and not part of the action.

If not, most things can be inserted into a room by “now the bullet is in the room” so you could have two bullets waiting in the wings then bring them both on set at the same time.

Am I understanding you here?

a bullet can’t be re-used thats why i made the bullet disappear. at first i was just gonna put the bullet in the room and change its name to burnt bullet [i couldnt think of a name for its effect like how bullets fall to the ground]

and it is part of the action the game needs weapoms cause it has zombies in it. im making it so you get more bullets for thee rifle

You can have multiple identical objects. Let’s say you have three. If you shoot one, make sure it is no longer available (send it to a dummy room or whatever). Then you have two left, etc.

I got stuck on this problem early in my learning process, but Inform 7 handles it. I was in the middle of increasingly complicated workarounds.

[url]https://intfiction.org/t/take-all-with-multiple-identical-things/8979/1]

The short answer to the orig question is you can’t clone stuff during the game, but you can after a fashion at boot time, by making a big pile of it then, like what gil was saying.

For instance, Sean was saying you may not need real bullets. Let’s see how far we can get without them.

Say the pistol can hold 6 shots. You don’t need to make 6 actual bullets. You just give the pistol a shot capacity, and also a number recording how many shots it has left. We’ll make ‘guns’ a type of thing, and the pistol a gun.

[code]A gun is a kind of thing.
A gun has a number called capacity.
The capacity of a gun is usually 6.
A gun has a number called shots remaining.

When play begins (this is the load all guns rule):
repeat with G running through guns:
now the shots remaining of G is the capacity of G;[/code]
Now if you make a new gun, by default it has 6 shots. An exception may be the rifle, which we’ll give 8:

The rifle is a gun in the warehouse. The capacity of a rifle is 8.

Then you make a shoot/fire command. And when you fire a gun, you reduce its shots remaining by 1. So far, no real bullet objects have been used.

But the player is likely to want to say something about the bullets. (eg ‘examine bullets’) So we make them a part of every gun. This is kind of a cloning technique, because with each gun you make, it will come with a ‘bullets’ part that the player can examine.

The shells are trickier. In this case, we do need to make a supply of shells. (See recipe book 10.3 in the docs for a couple of examples. I’ve borrowed from the ‘Pizza Prince’ one.)

Putting all of the above together, I’ve made a 1 room example with two weapons (player comes armed with pistol) and two targets (15 bottles and a crate) and a basic ‘shoot’ command. To change weapons, you have to be carrying the weapon and type ‘ready (weapon)’. X a weapon to check the remaining ammo. If you’re out of ammo or not carrying a weapon, you automatically ready the one you pick up.

Things I haven’t attended to - reloading. Variations on the word bullets (eg ‘bullet’). The fact the player may want to see how much ammo they have if they ‘x bullets’. But there’s a lot here you should be able to use:

(Without reloading supported, there can only be 14 shots fired in this demo, and I made 15 shell casings in total.)

[rant][code]Warehouse is a room.

A bottle is a kind of thing. 15 bottles are in warehouse.

A crate is a fixed in place thing in warehouse.

A spent shell is a kind of thing. 15 spent shells are in bullet limbo.

A gun is a kind of thing.
A gun has a number called capacity.
The capacity of a gun is usually 6.
A gun has a number called shots remaining.

When play begins (this is the load all guns rule):
repeat with G running through guns:
now the shots remaining of G is the capacity of G;

The pistol is a gun. The player carries the pistol.

The rifle is a gun in the warehouse. The capacity of the rifle is 8.

The player has a thing called the readied weapon.
The readied weapon of the player is the pistol.

ammunition is a kind of thing. an ammunition is plural-named.

one ammunition (called its bullets) is a part of every gun.

Understand “ammo” as ammunition.

The description of pistol’s bullets is “These are small bullets.”

The description of rifle’s bullets is “These are big shells.”

Carry out examining a gun:
if shots remaining of the noun is 0:
say “It’s empty.”;
otherwise:
say “There [regarding the shots remaining of the noun][are] [shots remaining of the noun] shot[s] left.”;
rule succeeds;

Shooting at is an action applying to one thing.

Understand “shoot [something]” as shooting at.

Check shooting at:
unless the readied weapon of the player is a gun:
instead say “You haven’t readied a weapon.”;
if the shots remaining of the readied weapon of the player is 0:
instead say “Click - you’re out of ammo.”;
if the noun is not a bottle and the noun is not the crate:
instead say “No point shooting at that.”;
if the noun is a bottle and player carries the noun:
instead say “You can’t shoot a bottle you’re holding!”;

Carry out shooting at:
if the noun is a bottle:
now the noun is off-stage;
if the readied weapon of the player is a gun:
decrement shots remaining of the readied weapon of the player;
let EJECTED be a random spent shell in bullet limbo;
unless EJECTED is nothing:
now EJECTED is in the location;

Report shooting at:
if the noun is a bottle:
say "BLAM! The bottle explodes. ";
if the noun is the crate:
say "BLAOW! You put a hole in the crate. ";
say “A spent shell clatters to the floor.”;

readying is an action applying to one visible thing.

Understand “ready [thing]” as readying.

Check readying:
if noun is not a gun:
instead say “That’s not a firearm.”;
unless player carries noun:
instead say “You’re not holding it.”;

Carry out readying:
now the readied weapon of the player is the noun;

Report readying:
say “You ready the [noun].”;

Last carry out taking a gun:
if the readied weapon of the player is not a gun:
try readying the noun;
otherwise if the readied weapon of the player is a gun:
if shots remaining of the readied weapon of the player is 0:
try readying the noun;

Test me with “x pistol/x rifle/x pistol’s bullets/x rifle’s bullets/shoot bottle/look/get bottle/shoot bottle/drop bottle/shoot bottle/shoot crate/x pistol/shoot bottle/x pistol/shoot bottle/x pistol/shoot bottle/x pistol/shoot bottle/look/get rifle/shoot bottle/shoot bottle/shoot bottle/shoot bottle/look/x rifle/shoot bottle/shoot bottle/shoot bottle/shoot bottle/shoot bottle/look”.[/code][/rant]

Put the code in Inform and type ‘test me’ to run the demo.

-Wade

it wouldnt even run i got an error whats strange is it said it understanded the same thing

se it is the same on the not understanding and for the understanding at the botton so im confused

It sounds like it doesn’t recognize the “regarding” phrase. Since that’s defined by the “English Language” extension which is always included (just like the Standard Rules), this makes me suspect that you’re using an old version of Inform. The version of Inform is shown on the Results tab just underneath the title; the latest is 6M62.

You could try “[if the shots remaining of the noun is 1][is][otherwise][are][end if]” to replace the regarding phrase. (Or, if I’m right, you could download the latest version of Inform.)

Yeah, I made the example in Inform 6M62.

I’d never even used the ‘regarding…’ phrase myself before. I just happened to dig it up on the spot from the docs while trying to get Inform to describe the remaining shots in 1 line.

-Wade

Yeah, I get that error in 6L38. Inform version 6L38 allows you to say “[regarding the noun]” and other “regarding” phrases that refer to things, but I guess the capacity to use “regarding” phrases for numbers was only added in 6M62. (In this case you have “regarding shots remaining of the noun,” and “shots remaining of the noun” is a number.)

If you want to use this in 6L38, you can change that rule to this:

Carry out examining a gun: if shots remaining of the noun is 0: say "It's empty."; otherwise: say "There [if the shots remaining of the noun is 1]is[otherwise]are[end if] [shots remaining of the noun] shot[s] left."; rule succeeds;