Skip to content

select_counter not working as expected #36

@MikeTaylor

Description

@MikeTaylor

Craig Macfarlane reports:

--

Hi Mike,

Thanks for replying to my comment on ScottKit. Sorry that I’ve taken so long to reply but I was unaware that you had replied – I didn’t see any email alerting me to a response, so I must have some settings wrong or I need to check my spam filter (although your posts are getting through, e.g. etch-a-sketch, which is what prompted me to go back and check the comments section on ScottKit today).

I’ve attached a short script to test counter1. It performs as follows: At start of game displays “-1-1” despite setting counter1 to 5. Entering a direction (e.g. “w”) causes counter1 to count down but “-1 -1” is interspersed with actual counter1 values:

5 4
-1 -1
4 3
-1 -1
3 2
-1 -1
2 1
-1 -1
1 0
-1 -1
0 -1
-1 -1 ad infinitum.

If I comment out both ‘select_counter 1’ commands (i.e. use default counter) then it works normally. At start of game displays “54”. Entering a direction (e.g. “w”) causes counter to count down:

5 4
4 3
3 2
2 1
1 0
0 -1
-1 -1 ad infinitum.

--

And here is the source file:

# Global configuration
# ----------------------------------------------------------------------------
ident 210170
version 1
wordlen 4
maxload 6
start Room1
treasury Room1

# Welcome message and set counter 1
# ----------------------------------------------------------------------------
occur when !flag 1
	print "Test non-default counter 1"
	select_counter 1
	set_counter 5
	set_flag 1

# Room1
# ----------------------------------------------------------------------------
room Room1 "Room."
occur when at Room1
select_counter 1
print_counter #[for troubleshooting – yields value of 0]
dec_counter
print_counter #[for troubleshooting – yields value of -1]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions