Breadcrumbs
Carrot
04 Jul 2013, 00:26I am trying to create a use script on a piece of chalk that will allow me to mark several different rooms with an increasing number.
So far I have this, which isn't working
I have gotten as far as the first if statement so far, and obviously got it wrong
.
Somehow I need to set an attribute to rooms that are "markable". It just so happens that all rooms that I have deemed markable, inherit the name "BaseRoom" - jaynabonne will know why that is
.
There are 2 if statements that need to be returned before the room can be marked
[list=1][*]is the room markable? and[/*:m][*]has it already been marked?[/*:m][/list:o]
Presuming the answer to 1 is true and 2 false, we can mark the room.
I am envisaging this will be done by creating an object "a chalk mark", but also numbering that object so that when the room description is displayed, it will also say "a number "n" has been scratched on the floor in chalk". This number will be taken from a counter associated with the chalk.
This number once marked, cannot be used again so the counter on the chalk is increased by 1.
The important thing is that when the chalks counter increase - the numbers already scribed do not.
HELP
So far I have this, which isn't working
<object name="chalk">
<inherit name="editor_object" />
<look>A lump of chalk, it could come in handy if you need to mark something.</look>
<take />
<drop type="boolean">false</drop>
<dropmsg>You feel this is too useful an item to leave behind, you might need to mark something with it.</dropmsg>
<use type="script">
if ((GetBoolean(game.pov.parent, "BaseRoom"))) {
msg ("You leave a mark upon the stone floor.")
}
else {
msg ("You see no reason to mark anything here.")
}
</use>
</object>
I have gotten as far as the first if statement so far, and obviously got it wrong

Somehow I need to set an attribute to rooms that are "markable". It just so happens that all rooms that I have deemed markable, inherit the name "BaseRoom" - jaynabonne will know why that is

There are 2 if statements that need to be returned before the room can be marked
[list=1][*]is the room markable? and[/*:m][*]has it already been marked?[/*:m][/list:o]
Presuming the answer to 1 is true and 2 false, we can mark the room.
I am envisaging this will be done by creating an object "a chalk mark", but also numbering that object so that when the room description is displayed, it will also say "a number "n" has been scratched on the floor in chalk". This number will be taken from a counter associated with the chalk.
This number once marked, cannot be used again so the counter on the chalk is increased by 1.
The important thing is that when the chalks counter increase - the numbers already scribed do not.
HELP
HegemonKhan
04 Jul 2013, 00:52just the concepts of what you're asking for, you'll have to do the scripting yourself though, as I'm doing this in quasi code:
global attribute: marked_count=1
<useon room>
if (game.pov.parent.markable=true) {
if (game.pov.parent.marked=false) {
game.pov.parent.marking=global_attribute.marked_count
msg ("You make the mark " + game.pov.parent.marking)
set global_attribute.marked_count = global_attribute.marked_count + 1
set game.pov.parent.marked=true
} else {
msg ("The room is already marked " + game.pov.parent.marking)
}
} else {
msg ("You can't make any markings in this room.")
}
<useon room>
<look~lookat room>
if (this.marked=true) {
this.description_marked = msg ("The room has the marking " + this.marking)
} else {
this.description_normal = msg ("this is an ordinary room")
}
</look~lookat room>
Carrot
04 Jul 2013, 08:23OK.
But what do I actually put in the code for each room (or preferably in a global code for "BaseRoom") that marks the room as markable.
That's where I am falling over at the moment, I am just not sure how to set that attribute (and I know it will be something stupidly simple) - I am no programmer, and certainly not an XML one - but I am trying to learn.
But what do I actually put in the code for each room (or preferably in a global code for "BaseRoom") that marks the room as markable.
That's where I am falling over at the moment, I am just not sure how to set that attribute (and I know it will be something stupidly simple) - I am no programmer, and certainly not an XML one - but I am trying to learn.

jaynabonne
04 Jul 2013, 08:53For the first part, the magic you're looking for is the DoesInherit function:
For marking, that's up to you. You could have an attribute which is the marked number. Put an int "marked" attribute in the BaseRoom type, and default it to 0, which would mean unmarked. Also, create an attribute in the chalk of type int with a name like "count" and value of 0. Then when you go to mark a room (use chalk), just do something like:
You can check for a room being marked by its marked attribute being non-zero.
if (DoesInherit(game.pov.parent, "BaseRoom")) {
// the current room is markable.
} else {
// it's not
}
For marking, that's up to you. You could have an attribute which is the marked number. Put an int "marked" attribute in the BaseRoom type, and default it to 0, which would mean unmarked. Also, create an attribute in the chalk of type int with a name like "count" and value of 0. Then when you go to mark a room (use chalk), just do something like:
chalk.count = chalk.count + 1
game.pov.parent.marked = chalk. count
You can check for a room being marked by its marked attribute being non-zero.
Carrot
04 Jul 2013, 09:33Cheers, I'll play around with that and see where I get.
Is there meant to be a space between chalk. count in that last line?
Is there meant to be a space between chalk. count in that last line?

jaynabonne
04 Jul 2013, 09:36No. Sorry about that. 

Carrot
04 Jul 2013, 23:34I'm almost there - I will demonstrate shortly, but I have one further question for the time being:
I am trying to automate the value of my chalk mark, and was hoping that I could somehow use the alias to show this so I didn't have to type LOOK AT CHALKMARK each time.
this is my current object:
But all I see in the room description is "chalkmark". The LOOK AT script works perfectly though.
Any ideas?
I am trying to automate the value of my chalk mark, and was hoping that I could somehow use the alias to show this so I didn't have to type LOOK AT CHALKMARK each time.
this is my current object:
<object name="chalkmark">
<inherit name="editor_object" />
<alias type="script">
msg ("The number " + game.pov.parent.marked + " has been scratched on to the wall in chalk.")
</alias>
<displayverbs type="stringlist">
<value>Look at</value>
</displayverbs>
<scenery type="boolean">false</scenery>
<visible />
<look type="script">
msg ("The number " + game.pov.parent.marked + " has been scratched on to the wall in chalk.")
</look>
</object>
But all I see in the room description is "chalkmark". The LOOK AT script works perfectly though.
Any ideas?

jaynabonne
04 Jul 2013, 23:43The BaseRoom type has a description script, where it shows the exits. My initial thought was that you could just add a marked attribute to the room (with value) and then in that script, print out the value with appropriate description, rather than have an actual object. That way it's an automatic part of the look command. You could probably do both (have an object *and* dump out the chalkmark value when someone does "look").
Just a thought
Just a thought

Carrot
05 Jul 2013, 10:13Well I kind-of wanted it to be a non-takable object, but I have gone with your suggestion for now, and it seems to be working.
I would appreciate your (and any other peoples) views on this.
I would appreciate your (and any other peoples) views on this.

jaynabonne
05 Jul 2013, 20:13I find it an interesting puzzle. You have to be able to recognize different orientations of the same room. It helps to map it out.
Two things:
1) In the first room, it says the passage leads south, but you can only go east (besides up).
2) "peice of chalk" should be "piece of chalk".
I liked the variations in rooms, including the "very long passage." I think you have a winner.

Two things:
1) In the first room, it says the passage leads south, but you can only go east (besides up).
2) "peice of chalk" should be "piece of chalk".
I liked the variations in rooms, including the "very long passage." I think you have a winner.
Carrot
05 Jul 2013, 21:51I'm glad you like it.
I forgot to change the description of the entrance room when I changed the exit - will sort that out.
Will sort the spelling mistake too.
Currently working on using the HasExit(n) script to automate the room descriptions.
Also thinking that I can use the script that works out the orientation, and put it against the standard cardinal points and use that to have a player hold a compass that will tell them which direction they are facing
Lots to do.
I forgot to change the description of the entrance room when I changed the exit - will sort that out.
Will sort the spelling mistake too.
Currently working on using the HasExit(n) script to automate the room descriptions.
Also thinking that I can use the script that works out the orientation, and put it against the standard cardinal points and use that to have a player hold a compass that will tell them which direction they are facing

Lots to do.