
-----------------------------------
Xarsha
Wed Apr 01, 2015 3:19 pm

What does 'Substring range bounds must be int type' mean?
-----------------------------------
I recently started using Turing, and I like it. I started making a Choose Your Own Adventure-type thing, but I have a bug. Here's my code:

if Spell1 = "detail a" | Spell1 = "detail b" | Spell1 = "detail c" | Spell1 = "detail d" then
    loop
        exit when Spell1 (Spell1 = "a" | Spell1 = "b" | Spell1 = "c" | Spell1 = "d" )


When I hit run, it tells me I have two errors, but only highlights the d and the quotation marks surrounding it. The error text says "Substring range bounds must be int type." What does this mean? What am I doing wrong? I tried deleting the '| Spell1 = "d"', but when I hit run, it highlighted the c and its quotation marks and gave the same error explanation. What can I do to fix this? I'm using Turing 4.1.1.

-----------------------------------
Insectoid
Wed Apr 01, 2015 4:18 pm

RE:What does \'Substring range bounds must be int type\' mean?
-----------------------------------
A substring is a small piece of a larger string. For example,
[code]
var a : string := "abc123"
put a(3,5) %this will print '123'; it reads from character 3 to character 5 in a[/code]

The (3,5) is the range of the substring. Those numbers have to be integers. That's what your error code means.

In your case, on line 2 you are asking for a substring of spell1, but your range bounds are just a big true/false statement.

-----------------------------------
Xarsha
Wed Apr 01, 2015 5:46 pm

Re: What does 'Substring range bounds must be int type' mean?
-----------------------------------
Rambling: I've edited my code a bit. Image of revised code is attached. I wasn't sure what code was relevant, so I included everything that could possibly be relevant. However, the problem remains.

I'm afraid I don't quite understand what you mean. What exactly do I have to do to fix this? Is there some fundamental thing I'm misunderstanding, or did I just make a small, specific error?

-----------------------------------
Xarsha
Wed Apr 01, 2015 6:59 pm

Re: What does 'Substring range bounds must be int type' mean?
-----------------------------------
Never mind! I have fixed the problem. I was not supposed to be using brackets. Thanks for your help!
