I mentioned my string parsing thing earlier, and I need someone else to look at a couple lines I wrote and tell me if I'm going insane. I've been at this for 5 hours and it seems so simple.
extends Control
var rope := "B{:D}e{D:}nis :{:O}DDDDDD"
var count = 0
var array1 : Array
var array2 : Array
func _process(delta: float) -> void:
if Input.is_action_just_pressed("jump"):
var inta = 0
var int1 = 0
for i in rope.length():
if rope[i] == "{":
int1 = rope.findn("{", inta)
inta = rope.find("}", inta)
array1.push_back(int1)
array2.push_back(rope.substr(int1, inta))
print(array1)
print(array2)
the expected result is two arrays, one containing the integer in the string that holds each opening curly bracket, and the other contains the substrings included in those curly brackets. After the second substring, it repeats. I get:
[{:D}, {D:}, {D:}]
The expected result in array2 is:
[{:D}, {D:}, {:O}]
Obviously I'm not experienced, so any other advice would be great. It should be relatively obvious I never took a class on this, what I have so far is a result of many months studying the docs and experimenting.
I don't know how this forum handles copy pasting gdscript either, i tried.