Is it possible to use the cycling link macro to generate random words? Instead of using just three words it will select a random word every time you click the word to cycle.
And basically I just used the "either ()" function such as:
[quote][[<<print either("It's chasing me","It has to stop","I can't cry","It's burning","It's staring at me","I want to hurt it","It's on me","It knows","I lose it","It's crawling","Its mouth","It's strangling me","Silently","Endlessly","It's still here","I can't hurt it","I am not worth it","It aches","Its eye","Its nail","It's falling","It craves for more","It's flaying me","It's going deeper","My mind","It's crumbling","I hate it","It hisses","It's on the ground","My hair", "It's melting", "It's seeping in me","I can't scream","I can't flee","I can't look at it","It's laughing at me", "Fiercely","I can't move","I can't breathe","Or maybe it's not","Maybe I like it","I can't help it","Maybe I deserve it","Maybe I was born this way","Maybe it's my fate","It's not the first time","It's growing in me","It's sucking my skin","It's ravaging me","It's angry","It's slippery")>>|window1]]
Basically the link is linking to the same passage - window1.
I was looking more toward the cycling link selecting a random word out of the list each time it is clicked. For example you have 50 words in one cycling link and it chooses at random a word from those 50 words every time you click it. Thank you for the example though Galejade I greatly appreciate any feedback I can get.
Thank You InsertCoin25
Example Code:<<cyclinglink print either ("grass" "a flower" "a cloud" "the road")>> ---- Would this work or is the code completely wrong? In theory this should print either of these four words at random. But, my theory may be wrong:).
And each time you click on the link the previous option becomes invisible/disabled and the next visible/enabled until the last item in the list is shown and will either go back to the first item or stop if the <b>end</b> or <b>out</b> option was used.
It would only take two small changes to a copy of the existing macro's code to make the selection of the next text to show random: (note: this code can result in the same item shown multiple times in a row, it is random after all)
u = (u + 1); becomes: u = (u + randomIntFromInterval(1,m));
add function: function randomIntFromInterval(min,max) { return Math.floor(Math.random()*(max-min+1)+min); }
But there is a problem with what to do about the end and out features of the cyclinglink macro, because the items are shown in a random order there is not really a last item in the sequence so how does the code know when to stop showing another item from the list?
This may help out. There will be 3 or 4 different cycling links and these cycling links will be words that form a sentence. After the user has formed a sentence there will be another link that is used to execute and check to see if the sentence is valid. So a crude illustration:
Link 1 (Word) Link 2 (Word) Link 3 (Word) Link 4 (Word) Link 5 (Checks Sentence)
Thank you greyelf for the examples and code. I am wondering if you can put the end and out of the cycling link in the link that executes and checks the sentence?
Try the following code: (note: Using TWEE notation. Lines starting with a double colon :: indicate a new passage with a related title, a title ending with [script] indicates Script Passage.
:: StoryInit <<set $final_1 to "">> <<set $final_2 to "">> <<set $final_3 to "">>
:: Start Click on the links: \ <<randomlink $final_1 "Aaaa" "Bbbb" "Cccc" "Dddd" "Eeee">> \ <<randomlink $final_2 "Aaaa" "Bbbb" "Cccc" "Dddd" "Eeee">> \ <<randomlink $final_3 "Aaaa" "Bbbb" "Cccc" "Dddd" "Eeee">> To check what was selected go to the [[Next Passage]]
:: Next Passage Final options were: 1: <<print $final_1>> 2: <<print $final_2>> 3: <<print $final_3>> The back link rewinds history. so forgets what was selected: <<back>> The return link remembers what was selected: <<return>>
Awesome...thank you for the code. I will try when I get home. Is it possible to have the link check the sentence in the same passage instead of a new passage? Thank you again greyelf.
Each usage of the randomlink only knows about the variable it is setting so can't check the others.
There is no link macro that I know of that knows how to check a set of variables for predetermined values and that only proceeds to the next passage if those values are correct. To build such a macro would require combining the expression evaluation functionality of the <<if>> macro with the standard link code, adding a dash of notification to let the end-user know why the link does not seem to be working when the related variables don't contain the correct values.
It would take me awhile to build such a macro, it make be worth your while asking Leon or TheMadExile for help.
Ouch!!! That is exactly what I needed. Thank you greyelf for the help that you provided up until this point. Well Leon or TheMadExile if you are reading this post is there anyway this could be achieved or worked on? Thank you again for the help greyelf, I do greatly appreciate this.
Comments
http://gamejolt.com/games/other/rose-window/37018/
And basically I just used the "either ()" function such as:
[quote][[<<print either("It's chasing me","It has to stop","I can't cry","It's burning","It's staring at me","I want to hurt it","It's on me","It knows","I lose it","It's crawling","Its mouth","It's strangling me","Silently","Endlessly","It's still here","I can't hurt it","I am not worth it","It aches","Its eye","Its nail","It's falling","It craves for more","It's flaying me","It's going deeper","My mind","It's crumbling","I hate it","It hisses","It's on the ground","My hair", "It's melting", "It's seeping in me","I can't scream","I can't flee","I can't look at it","It's laughing at me", "Fiercely","I can't move","I can't breathe","Or maybe it's not","Maybe I like it","I can't help it","Maybe I deserve it","Maybe I was born this way","Maybe it's my fate","It's not the first time","It's growing in me","It's sucking my skin","It's ravaging me","It's angry","It's slippery")>>|window1]]
Basically the link is linking to the same passage - window1.
Thank You
InsertCoin25
Example Code:<<cyclinglink print either ("grass" "a flower" "a cloud" "the road")>> ---- Would this work or is the code completely wrong? In theory this should print either of these four words at random. But, my theory may be wrong:).
Link 1 (Word) Link 2 (Word) Link 3 (Word) Link 4 (Word) Link 5 (Checks Sentence)
Thank you greyelf for the examples and code. I am wondering if you can put the end and out of the cycling link in the link that executes and checks the sentence?
Thank You
InsertCoin25
(note: Using TWEE notation. Lines starting with a double colon :: indicate a new passage with a related title, a title ending with [script] indicates Script Passage. I modified a copy of Leon's cyclinglink macro, all the hard work and good parts are his, any bad parts are mine.
InsertCoin25
There is no link macro that I know of that knows how to check a set of variables for predetermined values and that only proceeds to the next passage if those values are correct. To build such a macro would require combining the expression evaluation functionality of the <<if>> macro with the standard link code, adding a dash of notification to let the end-user know why the link does not seem to be working when the related variables don't contain the correct values.
It would take me awhile to build such a macro, it make be worth your while asking Leon or TheMadExile for help.
Thank You
InsertCoin25