222 std::string tmpcalc = expression;
232 if (
int(tmpcalc.find(
"&&")) >= 0 ||
int(tmpcalc.find(
"||")) >= 0 ||
int(tmpcalc.find(
"==")) >= 0 ||
int(tmpcalc.find(
"!=")) >= 0)
234 ScriptError(
"Syntax error in IF operation: '" + tmpcalc +
"' (might be nested)");
241 start = tmpcalc.find(
"(", 0);
247 for (
int i = start + 1; i < (int)tmpcalc.length(); i++)
249 char &tmpchar = tmpcalc.at(i);
264 if (IfProc(tmpcalc.substr(start + 1, end - start - 1)) ==
true)
269 one = tmpcalc.substr(0, start);
270 if (end < (
int)tmpcalc.length() - 1)
271 two = tmpcalc.substr(end + 1);
274 tmpcalc = one + newdata + two;
278 ScriptError(
"Syntax error in IF operation: '" + tmpcalc +
"' (might be nested)");
295 for (
int i = 1; i < (int)tmpcalc.length(); i++)
297 char &tmpchar = tmpcalc.at(i);
298 if (tmpchar ==
'=' || tmpchar ==
'!' || tmpchar ==
'<' || tmpchar ==
'>')
301 if (tmpchar ==
'&' || tmpchar ==
'|')
305 if (operators == 1 && operators2 == 2)
318 else if (operators == 0)
322 end = (int)tmpcalc.length();
327 if (operators > 1 && check ==
false)
329 ScriptError(
"Syntax error in IF operation: '" + tmpcalc +
"' (might be nested)");
335 if (IfProc(tmpcalc.substr(start, end - start)) ==
true)
340 one = tmpcalc.substr(0, start);
341 two = tmpcalc.substr(end);
342 tmpcalc = one + newdata + two;
352 temp1 = tmpcalc.find(
"=", 1);
355 one = tmpcalc.substr(0, temp1);
356 two = tmpcalc.substr(temp1 + 1);
362 temp1 = tmpcalc.find(
"!", 1);
365 one = tmpcalc.substr(0, temp1);
366 two = tmpcalc.substr(temp1 + 1);
372 temp1 = tmpcalc.find(
"<", 1);
375 one = tmpcalc.substr(0, temp1);
376 two = tmpcalc.substr(temp1 + 1);
387 temp1 = tmpcalc.find(
">", 1);
390 one = tmpcalc.substr(0, temp1);
391 two = tmpcalc.substr(temp1 + 1);
402 temp1 = tmpcalc.find(
"&", 1);
405 one = tmpcalc.substr(0, temp1);
406 two = tmpcalc.substr(temp1 + 1);
407 if (one ==
"true" && two ==
"true")
412 temp1 = tmpcalc.find(
"|", 1);
415 one = tmpcalc.substr(0, temp1);
416 two = tmpcalc.substr(temp1 + 1);
417 if (one ==
"true" || two ==
"true")
434 int start, first, last;
436 std::string tempdata;
451 if (check >= 65 && check <= 122)
462 tempdata =
Calc(
LineData.substr(first + 1, last - first - 1));
466 result = cosf(value);
478 if (check >= 65 && check <= 122)
489 tempdata =
Calc(
LineData.substr(first + 1, last - first - 1));
493 result = sinf(value);
505 if (check >= 65 && check <= 122)
516 tempdata =
Calc(
LineData.substr(first + 1, last - first - 1));
520 result = tanf(value);
532 if (check >= 65 && check <= 122)
543 tempdata =
Calc(
LineData.substr(first + 1, last - first - 1));
547 if (value < -1 || value > 1)
550 result = acosf(value);
562 if (check >= 65 && check <= 122)
573 tempdata =
Calc(
LineData.substr(first + 1, last - first - 1));
577 if (value < -1 || value > 1)
580 result = asinf(value);
592 if (check >= 65 && check <= 122)
603 tempdata =
Calc(
LineData.substr(first + 1, last - first - 1));
607 result = atanf(value);
619 if (check >= 65 && check <= 122)
626 int mid =
LineData.find(
",", first);
628 if (last < 0 || mid < 0)
631 std::string tempdata1 =
Calc(
LineData.substr(first + 1, mid - first - 1));
632 std::string tempdata2 =
Calc(
LineData.substr(mid + 1, last - mid - 1));
640 result = atan2f(value1, value2);
652 if (check >= 65 && check <= 122)
663 tempdata =
Calc(
LineData.substr(first + 1, last - first - 1));
667 result = sqrtf(value);
679 if (check >= 65 && check <= 122)
690 tempdata =
Calc(
LineData.substr(first + 1, last - first - 1));
694 result = std::abs(value);
706 if (check >= 65 && check <= 122)
717 tempdata =
Calc(
LineData.substr(first + 1, last - first - 1));
721 result = expf(value);
733 if (check >= 65 && check <= 122)
744 tempdata =
Calc(
LineData.substr(first + 1, last - first - 1));
751 result = logf(value);
763 if (check >= 65 && check <= 122)
774 tempdata =
Calc(
LineData.substr(first + 1, last - first - 1));
781 result = log10f(value);
793 if (check >= 65 && check <= 122)
804 tempdata =
Calc(
LineData.substr(first + 1, last - first - 1));
811 result =
Log2(value);
823 if (check >= 65 && check <= 122)
830 int mid =
LineData.find(
",", first);
832 if (last < 0 || mid < 0)
835 std::string tempdata1 =
Calc(
LineData.substr(first + 1, mid - first - 1));
836 std::string tempdata2 =
Calc(
LineData.substr(mid + 1, last - mid - 1));
847 result = fmodf(value1, value2);
859 if (check >= 65 && check <= 122)
866 int mid =
LineData.find(
",", first);
868 if (last < 0 || mid < 0)
871 std::string tempdata1 =
Calc(
LineData.substr(first + 1, mid - first - 1));
872 std::string tempdata2 =
Calc(
LineData.substr(mid + 1, last - mid - 1));
883 result = sqrtf(powf(value1, 2) + powf(value2, 2));
895 if (check >= 65 && check <= 122)
906 tempdata =
Calc(
LineData.substr(first + 1, last - first - 1));
913 result = ceilf(value);
925 if (check >= 65 && check <= 122)
936 tempdata =
Calc(
LineData.substr(first + 1, last - first - 1));
943 result = floorf(value);
955 if (check >= 65 && check <= 122)
966 tempdata =
Calc(
LineData.substr(first + 1, last - first - 1));
974 result = rnd.
Get(value);
986 if (check >= 65 && check <= 122)
997 int option =
LineData.find(
",", first);
998 std::string decimals;
1000 if (option > 0 && option < last)
1002 tempdata =
Calc(
LineData.substr(first + 1, option - first - 1));
1003 decimals =
Calc(
LineData.substr(option + 1, last - option - 1));
1007 tempdata =
Calc(
LineData.substr(first + 1, last - first - 1));
1023 result =
Round(value, decimal);
1266 face_direction =
"";
1267 open_direction =
"";
1269 if (direction == 1 || direction == 2)
1270 face_direction =
"left";
1271 if (direction == 3 || direction == 4)
1272 face_direction =
"right";
1273 if (direction == 5 || direction == 6)
1274 face_direction =
"front";
1275 if (direction == 7 || direction == 8)
1276 face_direction =
"back";
1278 if (direction == 1 || direction == 4)
1279 open_direction =
"left";
1280 else if (direction == 2 || direction == 3)
1281 open_direction =
"right";
1282 else if (direction == 5 || direction == 8)
1283 open_direction =
"front";
1284 else if (direction == 6 || direction == 7)
1285 open_direction =
"back";