Hi guys, i'm trying to make my godot project compatible with my old server.
The way data should be sent is: (packet.size, data1, data1.end, data2, data2.end), being paket.size, datacount.end obligatory in pure hex, and datacount in utf8_string, wich I got over with RawArrays.
However, in the future i'll need to send other types of data, like decimals, so I tried to write a function that would do it for me in a way that I wouldn't have to write long strings of data in arrays. I tried doing the strings first:
#writes str packet
func pkt_write_str(array, data):
array.append_array(data.to_utf8()) #writes bytes in the array
array.append(0) #data_count.end
#format and send packet
func pkt_send(array):
array.insert(0, array.size()+1) #+1 for the actual byte that
client.put_data(array) #packet.size takes
#sends packet on button release
func _on_Button_released():
var login = "login"
var user = get_node("log_strut/username").get_text()
var pasw = get_node("log_strut/password").get_text()
var loginpkt = RawArray([])
pkt_write_str(loginpkt,login)
pkt_write_str(loginpkt,user)
pkt_write_str(loginpkt,pasw)
pkt_send(loginpkt)
As it turns out, the function didn't write a byte to the array. Well, it did,
but it did not carry over to the next circle, neither to the next function.
Am I forgetting something? Is a work around possible in this case?