Adding random to this

EDIT : wrong answer !

This is last piece of my gun code, player must be able to reload gun (more than once) hehehe

Could you please copy and paste here the whole error message displayed by the compiler?

Problem. In the line ‘Now a random clip carried by the player is nowhere’ , the text ‘clip carried by the player’ is given where a description of a collection of things or values was required. For instance, ‘rooms which contain something’, or ‘closed containers’ - note that there is no need to say ‘all’ or ‘every’ in this context, as that is understood already.

I was trying to match this phrase:

a/-- random (clip carried by the player - description of values)

I recognised:

clip carried by the player = a description

OK. Could you try : a random clip which is carried by the player ?

same problem.

Thank you for the test.

Strange, because I just tried this code and the complier accepts it without displaying any error (Inform 10.1.2 here):

Lab is a room.

A gun is a kind of thing.
A gun has a number called bullets.
A clip is a kind of thing.

Reloading is an action applying to one thing.  Understand "reload [something]" as reloading.

Check reloading:
	If the noun is not a gun, say "You can't reload that!" instead;
	If the player does not carry a clip, say "You don't have any ammo to hand." instead.

Check reloading:
	If the bullets of the noun is not zero, say “You don’t need to reload yet.” instead.
	
Carry out reloading:
	Say "You clear out the gun's chamber and slam in a fresh clip, topping it up.";
	Now the bullets of the noun is six; [Or whatever the capacity is meant to be]
 	Now a random clip carried by the player is nowhere;

but if I write : “A clip is a thing.” instead of “A clip is a kind of thing.”, my compiler displays the same error message. Perhaps the start of an explanation ?

ty, i started a new project with your code it works so i will try to adjust mine.

If you code : “a random [whatyouwant]”, whatyouwant should be an instance of its kind.

Lab is a room.

A gun is a kind of thing.
A gun has a number called bullets.
A clip is a kind of thing.

A colt 45 is a gun in the lab.
The bullets of the colt 45 is usually 0.
6 clips are in the lab.

Reloading is an action applying to one thing.  Understand "reload [something]" as reloading.

Check reloading:
	If the noun is not a gun, say "You can't reload that!" instead;
	If the player does not carry a clip, say "You don't have any ammo to hand." instead.

Check reloading:
	If the bullets of the noun is not zero, say “You don’t need to reload yet.” instead.
	
Carry out reloading:
	Say "You clear out the gun's chamber and slam in a fresh clip, topping it up.";
	Now the bullets of the noun is six; [Or whatever the capacity is meant to be]
 	Now a random clip carried by the player is nowhere;
Lab
You can see a colt 45 and six clips here.

>take all
colt 45: Taken.
clip: Taken.
clip: Taken.
clip: Taken.
clip: Taken.
clip: Taken.
clip: Taken.

>reload colt 45
You clear out the gun's chamber and slam in a fresh clip, topping it up.

>showme colt 45
colt 45 - gun
location: carried by yourself in Lab
unlit, inedible, portable, handled; singular-named, improper-named
description: none
initial appearance: none
bullets: 6
printed name: "colt 45"
printed plural name: "guns"
indefinite article: none
list grouping key: none

>
1 Like