It looks like you're new here. If you want to get involved, click one of these buttons!
Hi,
So I've got one last major thing to build for my Starsceptre game and it's a cool Easter egg.
I'm looking to create a series of visual buttons and when each is clicked its value gets sent to a table or a string (not sure which I should do yet) and when you hit the submit button we assess your inputs against a predefined list of strings to see if one matches. Basically enter a code and see if you win something.
So say there are 6 buttons A,b,c,d,e,f,g plus a submit button
You could use any combination of those buttons and when you submit we check to see if it unlocks something.
So like you might enter a,a,c,f,g,a or any number of combos.
Should I use a blank table and add to each column (separated by a comma) or should I add to a string instead and assess 'aacfga' ?
I've not worked with strings yet, so I'm wondering What should I go for and am I on the right path?
I think it will be a 10 part string or table and we assess against that
Thanks
Major
Comments
Use a string. Then you can just compare one string to another.
Cheers, I'll see how I get on
Much appreciated!
@Majormorgan Checking the string length and appending to it is easy.
@Majormorgan After reading your question again, you can use a table along with what I showed you. You use a table of strings for your codes and compare your string against the table. In the code below, I just return match or no match, but you can do whatever your need.
thanks @dave1707 that code works a treat. I can't wait to share how it's used, although it's going to be a secret Easter egg that I'm going to see if anyone finds
- it is cool though! Thanks again
~~~
strlength=x
str=str..-v#
~~~
?
Thanks
Just found this by @Ignatz from another thread
Thanks
@Majormorgan Instead of putting it in another string, you can put it in the same string like below.
Awesome! Thank you @dave1707 !!!
Works like a dream!