ash-r1 / VN.js

0 stars 0 forks source link

Already read detection #21

Open ash-r1 opened 3 years ago

ash-r1 commented 3 years ago

VN.js will detect if the sentence already read, as other Visual Novel engines are already doing it.

Basically, it might be controlled with the scenario's filename and the sentence.

For example, if we have a short script below:

#haruhi-1.vs
@haruhi.show smile
I'm Haruhi Suzumiya, from East Junior High.
First off, I'm not interested in ordinary people.
@haruhi.show smile2
But, if any of you are aliens, time-travelers, or espers, please come see me.

In this case, the already-read-sentence-detection system may save a hash like HASH(["haruhi-1", "I'm Haruhi Suzumiya, from East Junior High."])-ish.

It may work with almost all cases, including if the developer upgraded the game, modified/appended/deleted sentences.

But, let me think of an edge case, what if we have exact same sentence in the same file. The system misunderstand it's already read.

#haruhi-1.vs
@haruhi.show smile
I'm Haruhi Suzumiya, from East Junior High.
First off, I'm not interested in ordinary people.
@haruhi.show smile2
But, if any of you are aliens, time-travelers, or espers, please come see me.
@haruhi.show normal
# ** this is an edge case **
I'm Haruhi Suzumiya, from East Junior High.
First off, I'm not interested in ordinary people.

To solve this problem, the releasing system should manage the occurrences counter of each sentence in the file, use this counter in the hash.

So, let's append this counter into our hash, it may work fine:

HASH(["haruhi-1", "I'm Haruhi Suzumiya, from East Junior High.", occurence_counter]).

If I realize other edge cases, this spec can be improved. Please give me your advice.

ash-r1 commented 3 years ago

Ah, I totally forgot about the label feature...

ash-r1 commented 3 years ago

NOTE: 【プラグイン】文単位既読システム http://tempura9357.blog.fc2.com/blog-entry-57.html#more

It counts the number of being read sentences after the label.

It would be nice because it does not exhaust storage than my idea. But it doesn't work if the developer inserted sentences into the script.