I keep on getting an error message and am not sure how to fix it. I have pasted below my code as well as some background information.
Thank you in advance to all those that are willing to help
Some Background
- The code as it stands right now asks the user for their name.
- I have already figured out how to make it so that the username cannot include spaces or special characters
- I am using Harlowe 3.1.0 in Twine 2
- Passage 2 below is giving me issues
What I Am Trying To Accomplish
- I am having difficulty in making it so that the user cannot only put 2 letters --> I keep on getting the following error message: "I canât find a â3rdâ data name in an array"
- I havenât delved into it yet, but Iâd also like to make it so that you cannot have three of the same letters in a row. So if the user provides ânathanfffâ itâll make them retype the name just like if they write âhhhâ
And now, onto the code:
1st passage in relevant sequence (titled: âUser Nameâ)
Before we begin, what is your ''//first name//''?
<input type="text" data-varname="userName">
<span style="font-size: 4vw;">(link-goto: "Done", "Story Choice")</span><span style="color:#838383;font-size: 1.75vw;"> <-- Click this when you finished writing your name!</span>
<script>processInputElements();</script>
2nd passage in relevant sequence (titled: âStory Choiceâ) --> this is the passage giving me issues
(if: (text:(a: 0,1,2,3,4,5,6,7,8,9, "!","@","#","$","%","^","&","*","(",")","-","_","+","=","{","[","}","]",":",";",'"',"'","<",".",">",",","?","/", "~", "`")) contains any of (text: $userName))[(align: "=><=")[Click "OK" to return to the previous page(alert:"Please provide a valid name")(undo:)]](else-if: (" ") contains any of (text: $userName))[(align: "=><=")[Click "OK" to return to the previous page(alert: "Please provide your first name only")(undo:)]](else-if: $userName's 3rd is " ")[(align: "=><=")[Click "OK" to return to the previous page(alert: "Please provide a name with at least 3 letters")(undo:)]](else:)[(align: "<==")[It's nice to meet you (upperfirst: $userName)!]
(set: $a to (shuffled: "story", "story2", "story3"))
Select question:
(set: $story to "this does not matter")
(dropdown: bind $story, $a's 1st, $a's 2nd, $a's 3rd)
{
(link: "Go!")[
(if: $story is "story")[(go-to: "story1")]
(else-if: $story is "story2")[(go-to: "story2")]
(else-if: $story is "story3")[(go-to: "story3")]
]
}
]
Note to reader: youâre an expect Harlowe Twine programmer so you probably already know this --> the second passage in this sequence opens up three new passages (âstory1â, âstory2â, and âstory3â). I did not pase those passages here as they werenât giving me any sort of issues!