Schizophrenia and Clanging

Hello, all:

There can be a condition of schizophrenia called ‘clanging’ – that is, the patient repeats words of the same sound. For example, if I said “Dope” and schizophrenic might say “dope soap nope rope cope”.

I would like to have a character that answers the player’s last word used with clanging.

It would seem to me that the code would be written like:

(1) repeat while running through the words of the sentence to find the last word;

(2) repeat while running through the letters of the last word to find the vowel; (easier said than done)

(3) have the NPC repeat the word then switch out the first and last letters a la 20.6 in Writing with Inform

I have no idea how to begin this. Usually I post the code but, as I wrote, I have no idea how to begin. Looking for a collaborator to solve this issue.

Thank you in advance!

2 Likes

It’s the rhyming that’s the hard part.

When you say the player’s last used word, does this mean it will be the last word of a successfully entered command, which will be a thing? Or only the last word of if the player says something? I think a first step may be thinking about which words will need to be rhymed. This may be almost everything in the game, or maybe this NPC is only around at a certain time, in which case it’s only things that will be in their part of the game, and at the end of certain types of commands.

You may benefit from creating a sort of dictionary with subgroups, and rhyme-triggering things in the game can be assigned to the subgroups. e.g. if player ends a line with a word from group 3, randomly pull four different rhymes from subgroup 3 for the NPC to say.

That’s my off-the-top-of-my-head, never-actually-tried-doing-rhymes before. Sorry, it’s pretty big and beyond my coding time at the moment. But re: step 1, you don’t have to ‘repeat through’ to get the number of words. You can say something like:

let N be the number of words in the player's command;
let LASTWORD be word number N in the player's command;

I will tag @aschultz as he has written more rhyming words code than anyone, though no guarantee he’ll materialise :slight_smile:

EDIT - Sorry, I realise I answered this more as if it’s in the I7 Authoring section. I didn’t notice the post was actually in the looking for collabs section.

-Wade

7 Likes

No, you gave me a start. Thank you for the push!

Inform supports regexes, which will help with this.

But I see this is tagged “Looking for Collaborators”. Are you looking for Inform help, or for a coauthor?

So far, constructing with the start that severedhand suggested. This code “acts” the way I want it to:

instead of asking Chopin about a topic:
	let N be the number of words in the player's command;
	let LASTWORD be word number N in the player's command;
	say "[LASTWORD][line break]";
	let FIRSTLETTER be character number 1 in LASTWORD;
	say "[FIRSTLETTER][line break]";
	let N be the number of characters in LASTWORD;
	let REDACTEDWORD be character number 2 in LASTWORD;
	say "[REDACTEDWORD]"

If I type “ASK CHOPIN ABOUT MUSIC” the reponse will be

MUSIC
M
U

But if I try to make the variable REDACTEDWORD the rest of the characters in the LASTWORD:

let REDACTEDWORD be character numbers 2 through N in LASTWORD;
	say "[REDACTEDWORD]"

It won’t compile. Is this a code error (I need to figure out the correct words to use) or a concept error (I’m on the wrong track with this strategy and need to try something else).

1 Like

I think you’re on the right track, but this syntax should work:

        replace character number 1 in LASTWORD with "";
	replace character number N in LASTWORD with "";

(Typing on phone so white space will be janky)

1 Like

Thank you, all, for the input! My coding journey has led me to this:

instead of asking Chopin about a topic:
	let N be the number of words in the player's command;
	let LASTWORD be word number N in the player's command;
	let REDACTEDWORD be LASTWORD;
	let N be the number of characters in LASTWORD;
	replace character number 1 in LASTWORD with "";
	if character number 1 of LASTWORD matches "<aeiou>":
		say "'[bold type][REDACTEDWORD][roman type] [lastword] b[lastword]d[lastword] f[lastword] g[lastword] h[lastword] k[lastword] l[lastword] m[lastword] n[lastword] p[lastword] r[lastword] s[lastword] t[lastword] v[lastword] w[lastword] z[lastword]... [one of]'Jestem w tym miejscu tak długo, że nie pamiętam nieba.'[or]'Jeśli wkrótce nie opuszczę tego miejsca, umrę.'[or]'Proszę, nie pomożesz mi? Umieram.'[or]'Trzymaj się z daleka od mężczyzny z toporem, a wychodząc zamknij drzwi.'[purely at random]";
	otherwise:
		now character number 1 in LASTWORD is "";
		if character number 1 of LASTWORD matches "<aeiou>":
			say "'[bold type][REDACTEDWORD][roman type] [lastword] b[lastword]d[lastword] f[lastword] g[lastword] h[lastword] k[lastword] l[lastword] m[lastword] n[lastword] p[lastword] r[lastword] s[lastword] t[lastword] v[lastword] w[lastword] z[lastword]... [one of]'Jestem w tym miejscu tak długo, że nie pamiętam nieba.'[or]'Jeśli wkrótce nie opuszczę tego miejsca, umrę.'[or]'Proszę, nie pomożesz mi? Umieram.'[or]'Trzymaj się z daleka od mężczyzny z toporem, a wychodząc zamknij drzwi.'[purely at random]";

Three questions:
(1) The line "if character number 1 of LASTWORD matches ‘’ does not compile. Can someone help me with the diction of this?

(2) I’d like to have efficient code. How can I check the first few letters of a word for a vowel and replace all of them with “” more efficiently?

(3) Speaking of efficient code, I’d like to just generate a random starting letter (consonant) instead of listing a long list of consonants that is static. Hopefully this makes sense.

Thank you!

Are you looking for Inform 7 coding help or do you want an actual collaborator/coder on your game? If it’s the former, I’d suggest moving this topic to the Authoring → Inform 7 section.

1 Like