The Power of Text Strings [ 🟨 5/10]

Quick edits

Welcome to The Guide!

Today, we’ll be focusing on the block saving powers of text strings!

Text strings are extremely underrated and not very well known. They are technical, but once you begin to understand them, I’m sure you can think of all sorts of things they can be useful for!

In this guide, I will give all of my knowledge of what text strings are, how they work, and how you can use them in your games! Strap yourselves in, and let’s dive into the technical side of text strings!

What are text strings?

Text strings are great ways to store lots of information into a single text block! This can be useful for storing strings of text (obviously), but are also surprisingly efficient at storing numbers! Here are some examples of systems that utilize text strings:
How to Track Every Player and Find Their Distance [ 🟥 8/10]
Memory Efficient Trigger Keyboard 🤯 (Only takes 1% memory)


How do text strings work?

Text strings can be tricky at times, and aren’t always the solution. Although they can be used to hold information that’s always changing, they’re best used with storing constant information that never changes.

Here’s the equation that finds the first letter of the substring we’re trying to get:

B = (S * L) - (L - 1)

Confusing? Let me break it down for you. B is the beginning, or the starting letter, of the substring we’re trying to get. S is the actual substring we’re trying to get. L is the length [1] of each substring. Still don’t quite make sense? Let’s use an example from Fleet’s guide from above. His string was:

abcdefghijklmnopqrstuvwxyz

If we use the equation from above, we can pick out a few different things.

B = y
S = x
L = 1
y = (x * 1) - (1 - 1)

Is it starting to make sense? I hope so! Let’s plug in a number for x and see what happens!

x = 7

(7 * 1) - (1 - 1) = 7

But, we can obviously simplify! We can remove all of that complicated math, because our answer will just end up being 7 anyways!

Now what do we do with this? We can now easily get the number from the text string using another simple equation.

A = in text "insert text string here" get substring from (letter number v) (B) to (letter number v) (B + (L - 1))

We use our B and our L - 1 from earlier to find our A (answer) and finally get the desired text string. Let’s plug in our 7 from earlier and see what we get.

B = 7
L = 1
in text "abcdefghijklmnopqrstuvwxyz" get substring from (letter number v) (7) to (letter number v) (7 + (1 - 1)) = g

However, we can simplify! Since we know we’re only trying to get substrings that are only 1 character long, we can just get the letter number!

in text "abcdefghijklmnopqrstuvwxyz" get (letter number v) (7) = g

And there you have it! We can now find any data we want from a text string! As long as you follow these equations, you should have a pretty good idea on how you can use text strings to save block code!


A more complex example

I’ve recently found that you can also use text strings for… numbers? How does that work?
A while ago, the user TorontoBulls1 showed me a great way to convert text into numbers!

I wanted to make a system for my game that would purchase an item, but it wouldn’t grant an actual item. Instead, it would increase a counter that sets a property. I came up with a few systems that I could use to tackle this issue.

  1. Use trigger block code to broadcast messages to vending machines. +2165 memory.

  2. Use a large line of checkers to check a property to see how much cash I owed and how much cash I had. +2080 memory.

  3. Use a text string with block code in a trigger to find out how much cash I owed and use a system I already built into my game that takes away a players cash. +540 memory.

I decided that I would try to test out #3. I wasn’t sure if it would work, since there were numbers that were 1 character long, and others that were 2 characters long. To test this out, I went into another map, trying to convert a text string of 001 to see if it was equal to 1. The test was successful, and I went to implement it into my map! Here is the block code I used:

You can see all of the equations from earlier. Let’s use our equations to figure out how this works. We’ll use the number 11 for our S.

B = y
S = 11
L = 2
y = (11 * 2) - (2 - 1) = 21

A = y
B = 21
L = 2
y = in text "02050710151822283042552036" get substring from (letter number v) (21) to (letter number v) (21 + (2 - 1)) = "55"

Now, we can simplify our equations.

y = (11 * 2) - 1 = 21

A = in text "02050710151822283042552036" get substring from (letter number v) (21) to (letter number v) (21 + 1) = "55"

They’re simple changes, but every block counts in Gimkit’s block code!

We got the string 55! Now we can convert it into a number, and take away that amount of cash!


I hope you learned some things about text strings today, and go on to use them in some interesting ways! I’m sure theres some great memory and / or block saving ideas in your head already! Happy building Gimkitters!

How difficult is this guide? Do not vote a high rating for fun.
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
0 voters
How good was this guide?
  • Amazing!
  • Good!
  • Okay.
  • Needs improvement.
  • Bad.
  • Terrible.
  • Worst. Guide. Ever.
0 voters
Select the tags that fit this guide and should be added.
0 voters

  1. You found the easter egg! :egg: What should you do? Reply telling me how much you love (or hate) this guide, provide some helpful feedback, and put an egg emoji at the end of your reply! ↩︎

10 Likes

I did not understand any of this…

I am reading it right now, and all I see is chaos :skull::skull::skull:

2 Likes

deadly block code :skull:

1 Like

Neat lil gif, but this guide is COMPLEX.
I’ll just look at it then understand it.

1 Like

I’ve been wanting to know how to do this for ages…!
Thanks for creating a genuinely useful, clear, concise, and helpful guide!
I’m bookmarking this, yay!
(I’m trying to build a bookmark library of all the useful guides for reference)

Fulcrum, u online?
I do have some question.
Now, I understand text strings. u dont have to teach me what they are.
I also know what the extraction is.

GET SUBSTRING FROM (abcdefghijklmnopqrstuvwxyz) start : 3 (letter c) to 20 (letter t) 
> "cdefghijklmnopqrst"

yeah, but i dont get some of the equation.
Like:

yeah, could you explain this?

imean, isnt technically y=x?
imean, if L is always 0, then what is the point of this giant equation.

Anyways, awesome concept. Great Job Fulcrum
egg

ok,
where do you get the in text get substring block???

Yes, it is! This was just an example of how the equation works. That’s why I said that you can easily simplify this:

This is because we’re only reading a single character. That equation is necessary if you’re trying to get more than 1 character.

1 Like

In the text section. The colors of the blocks are a good hint of where the blocks are located.

i read the more complicated one.
Now, can u explain:

  1. Since B is the first letter, why is the equation solving for b?

ok, so this is the text.
The substring is

7
So… Do we find 7 in the text?

why?

I think we find the 7th letter in the string.

1 Like

ik, i looked through it a week ago when my friend had the same problem (coincidence how u made a guide for it after that.)
Thanks!

B isn’t the first letter of the string, it’s the first letter of the substring we’re trying to get.

Yes. I think you missed a couple of things in the guide.

It’s just an explanation of how it works, and I just plugged in numbers to show how it works. That’s why I was constantly saying, simplify it.

1 Like

so the seventh letter…
Ok!

i saw in the more complex one, it is (L-1)

anyways, so basically, this is just a formula for substrings right?

Ty!

Yep! You’ve got it!

I HAVE BEEN LINKED!!!
Great guide, text strings are amazing and have great potential.

Amazing. This is the guide that helped me make a Gimkit game where you can code a game.

I needed this. Thanks!

1 Like

Not to be annoying, but you can reduce this number by a whole five percent by using an item granter instead of a trigger! A whole five percent! I mean, that’s basically the meaning of life.
Also, good guide.
:egg:

The system I’m using is pseudo items, so using item granters would be pointless.