I'm currently working on a new game, and wanted to use an operator predicate that looks through a text, and see if it contains a certain string. Is there anyone that could help me make a script like this?
I currently have this script, but it doesn't work (and no, I'm not using the list contains _ predicate.)
This can detect if the text contains something.
Yep, that works. Thank you!
np!
Welcome back pax! (Ik offtopic)
First, when reporting the result, you should report true or false, not a string saying if it was found or not.
Second, you might want to put the INP variable in the second slot of the split by block. And then just check if the length of the result (input variable) is greater than 1.
Thanks!
though, I only have this account on the forums.
Hm, I'll try that too.
why? what happened?
I... accidentally deleted the account.
It's somehow still here on the forums, probably because I was on a different computer at the time.
So, I use a new account for projects.
Whenever your code contains a PRIMITIVE block, there is a library that contains a block interfacing to the primitive code. In this case, the library called "Strings, Multi-line input" contains the block
The virtue of using the library TEXT CONTAINS block rather than the PRIMITIVE block is that the former does a more complete job:
Your version doesn't honor the case sensitivity setting.
Also, the PRIMITIVE block is not documented for users and is not guaranteed to keep working the same way forever. Indeed, if you look closely at the pictures above, the block that's called PRIMITIVE in Snap! 9.0 is called EXTENSION in the development version, in which I made the script pictures. There's a different block called PRIMITIVE with a different purpose and interface.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.