Attention |
Topic was automatically imported from the old Question2Answer platform. | |

Asked By |
C:\Flavius |

Well this is my code:

```
var t = 1;
var us = [72];
us[0] = t;
for i in range (72):
if (i==0):
does stuff that changes the value of t
else:
does stuff that changes the value of t.
us[i] = t;
```

t is a number that will get multiplied and used for math. As it is only being multiplied and other simple arithmetic, it is always an integer number, and will never be a float or double because it is not getting divided.

us is an array of values of t that have already been used for math. I use this array to not make the computer repeat calculations that it’s already done.

The program checks every value of us and compares it with t. If it’s already been used, it skips math and changes the value of t, checks again until a value hasn’t been used before and does math with it.

I thought this should save values of t in the us array starting by index 1, but for some reason when I execute the program it says that index 1 is invalid. Or that is what I understand by “Invalid set index ‘1’ (on base: Array) with value of type int”

I really don’t understand what’s the problem. I have read the code about 12 times, line by line and I can’t find logic errors.

This is the first time I use godot so I don’t know the syntax very well, so I suppose my error is caused by writting something wrong.

If you want I could post the original code but it is strange and tedious to explain and understand, because it has a lot of loops. I hope only the information posted here is enough, if not, tell me.

I think I have an idea of what may be causing this, but I will stop programming for today. It has been a productive day, I’ve done some good things and I’m satisfied. Hope you all had a good day too!

Thank you in advance!