For an approach to do an atoi on your own you can try this, but be aware when you scale your project, my example is a waitless loop, and depending on how many times you cast literally from numeric strings to integers the server might crash, you can test it by starting the custom game with the following script and as you have spawned press the interact key, idk your level of workshop knowledge but i assume u know how to proceed:
Edit: I made some optimazations and removed some redundancies, it’s now more compressed, more readable and is generalized it works now for any numeric input like, negatives and floating point numbers -with two kind of seperators-.
Workshop script syntax
tvariables
{
global:
0: Chars
1: Numerics
2: FloatingPointSeperator
3: returnValue_Atox
4: ret
5: sign
6: it
7: ot
8: iaf
9: s
10: ret_0
11: sign_0
12: it_0
13: ot_0
14: iaf_0
15: s_0
16: ret_1
17: sign_1
18: it_1
}
rule("Initial Global")
{
event
{
Ongoing - Global;
}
// Action count: 2
actions
{
Set Global Variable(Chars, Array(Custom String("0"), Custom String("1"), Custom String("2"), Custom String("3"), Custom String("4"), Custom String("5"), Custom String("6"), Custom String("7"), Custom String("8"), Custom String("9")));
Set Global Variable(Numerics, Array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9));
}
}
rule("ATOX")
{
event
{
Ongoing - Global;
}
conditions
{
Is Button Held(Host Player, Button(Interact)) == True;
}
// Action count: 62
actions
{
If(String Contains(Custom String("12,12"), Custom String(".")));
Set Global Variable(FloatingPointSeperator, Custom String("."));
Set Global Variable(ret, 0);
Set Global Variable(sign, 1);
Set Global Variable(it, 0);
Set Global Variable(ot, 0);
Set Global Variable(iaf, 0);
Set Global Variable(s, String Split(Custom String("12,12"), Global Variable(FloatingPointSeperator)));
If(Compare(Char In String(First Of(Global Variable(s)), 0), ==, Custom String("-")));
Set Global Variable(sign, -1);
Modify Global Variable(it, Add, 1);
End;
While(Compare(Char In String(First Of(Global Variable(s)), Global Variable(it)), !=, Custom String("")));
Set Global Variable At Index(iaf, 0, Add(Multiply(First Of(Global Variable(iaf)), 10), Value In Array(Global Variable(Numerics), Index Of Array Value(Global Variable(Chars), Char In String(First Of(Global Variable(s)), Global Variable(it))))));
While(Compare(Char In String(Value In Array(Global Variable(s), 1), Global Variable(ot)), !=, Custom String("")));
Set Global Variable At Index(iaf, 1, Add(Multiply(Value In Array(Global Variable(iaf), 1), 10), Value In Array(Global Variable(Numerics), Index Of Array Value(Global Variable(Chars), Char In String(Value In Array(Global Variable(s), 1), Global Variable(ot))))));
Modify Global Variable(ot, Add, 1);
End;
Modify Global Variable(it, Add, 1);
End;
Set Global Variable(ret, Add(First Of(Global Variable(iaf)), Divide(Value In Array(Global Variable(iaf), 1), Raise To Power(10, String Length(Value In Array(Global Variable(s), 1))))));
Set Global Variable(returnValue_Atox, Multiply(Global Variable(sign), Global Variable(ret)));
Skip(38);
Else If(String Contains(Custom String("12,12"), Custom String(",")));
Set Global Variable(FloatingPointSeperator, Custom String(","));
Set Global Variable(ret_0, 0);
Set Global Variable(sign_0, 1);
Set Global Variable(it_0, 0);
Set Global Variable(ot_0, 0);
Set Global Variable(iaf_0, 0);
Set Global Variable(s_0, String Split(Custom String("12,12"), Global Variable(FloatingPointSeperator)));
If(Compare(Char In String(First Of(Global Variable(s_0)), 0), ==, Custom String("-")));
Set Global Variable(sign_0, -1);
Modify Global Variable(it_0, Add, 1);
End;
While(Compare(Char In String(First Of(Global Variable(s_0)), Global Variable(it_0)), !=, Custom String("")));
Set Global Variable At Index(iaf_0, 0, Add(Multiply(First Of(Global Variable(iaf_0)), 10), Value In Array(Global Variable(Numerics), Index Of Array Value(Global Variable(Chars), Char In String(First Of(Global Variable(s_0)), Global Variable(it_0))))));
While(Compare(Char In String(Value In Array(Global Variable(s_0), 1), Global Variable(ot_0)), !=, Custom String("")));
Set Global Variable At Index(iaf_0, 1, Add(Multiply(Value In Array(Global Variable(iaf_0), 1), 10), Value In Array(Global Variable(Numerics), Index Of Array Value(Global Variable(Chars), Char In String(Value In Array(Global Variable(s_0), 1), Global Variable(ot_0))))));
Modify Global Variable(ot_0, Add, 1);
End;
Modify Global Variable(it_0, Add, 1);
End;
Set Global Variable(ret_0, Add(First Of(Global Variable(iaf_0)), Divide(Value In Array(Global Variable(iaf_0), 1), Raise To Power(10, String Length(Value In Array(Global Variable(s_0), 1))))));
Set Global Variable(returnValue_Atox, Multiply(Global Variable(sign_0), Global Variable(ret_0)));
Skip(15);
Else;
Set Global Variable(ret_1, 0);
Set Global Variable(sign_1, 1);
Set Global Variable(it_1, 0);
If(Compare(Char In String(Custom String("12,12"), 0), ==, Custom String("-")));
Set Global Variable(sign_1, -1);
Modify Global Variable(it_1, Add, 1);
End;
While(Compare(Char In String(Custom String("12,12"), Global Variable(it_1)), !=, Custom String("")));
Set Global Variable(ret_1, Add(Multiply(Global Variable(ret_1), 10), Value In Array(Global Variable(Numerics), Index Of Array Value(Global Variable(Chars), Char In String(Custom String("12,12"), Global Variable(it_1))))));
Modify Global Variable(it_1, Add, 1);
End;
Set Global Variable(returnValue_Atox, Multiply(Global Variable(sign_1), Global Variable(ret_1)));
Skip(1);
End;
Big Message(Host Player, Custom String("{0}", Add(Global Variable(returnValue_Atox), 1)));
}
}