Variables additions/changes

Give us your feedback about the Level Editor! Or have an idea? Post it here!

Variables additions/changes

Postby phsc » 21 May 2018, 17:25

So I feel like PB2 lacks a few things to make variables really great
First of all, add >= and <=, not only > < =, so think of it as:
If var A has a value higher/lower or equals of var B or value B keep executing this etc

also maybe add booleans as theyre really great for making things simpler

also there should be something kinda like a break in programming, think of it as:
If var A has value of var B or value B this trigger execution will stop
Would be pretty great for "repetition/condition" structure aka timers activating triggers that check for something with vars

but anyway, it would also be great to have an actual repetition structure, I think the one that goes the most well with pb2 right now would be a while as for wouldnt be that great considering how triggers are:
Keep executing this trigger while variable A is equals/bigger/lower/etc than var B or value B

and also a few other math ones, like tan, which is sen/cos, but also all of them not only in radians but also as real numbers, maybe not as big as how big a float or a double can be(idk which one pb2 uses) but maybe half of it, and then you could round it using in game functions rn
Give variable A the tangent of angle B(var of value) in radians
and the
Give variable A the cos/sen/tan of angle B(var or value) as a real number

and also maybe other math formulas, as theres no square root(i didnt see one) and even tho its possible to calculate it, this rn is going to be C# as a console application just to show the formula if someone wants it
also this isnt the only way, the easiest and most popular way uses the break function and it is also pretty heavy, this is something my OOP teacher showed me at the start of this year before we got into real OOP
also the original was in portuguese as i live in brazil and that is the language right here, if i forgot to translate something raiz = root, quadrado = square
Code: Select all
static void sqroot()
        {
            Console.WriteLine("Enter value");
            double sq = double.Parse(Console.ReadLine());
            double r = sq / 3;
            for (int x = 0; x < 32; x++) r = (r + sq / r) / 2;
            Console.WriteLine(r);
            return;
        }

but anyway, back to pb2, it would be great to have something like:
Give variable A the square root of var/value B
and maybe even get as far as
Give variable A the cube root of var/value B

and maybe even something like logarithm(not using euler's constant as i feel like theres really no use for it in pb2)
Give variable A the logarithm of var/value B

and maybe also add truncate as an option in pb2
Truncate var A and give that value to var B(for integers)
Truncate var A with precision B(for doubles and it would go back to var A)

and also add a ton of string methods, kinda like:
Compare the similarity of var A with var B and return the value to var A as a number
Change/remove all characters that are B of var A(would be really great to remove blank spaces)
also maybe add other two opitions for at the start and after but only for blank spaces, kinda like trim in php
Give var B the size of var A(like "text" would return 4)
Make var A lower/upper case
maybe also add an opition to only do that with the first letter
and maybe also go as far as md5 for passwords and stuff like that for databases in pb2 maps, even tho i havent used them yet idk how it goes, as most programming languages you do the math before throwing them into a database

but anyway, now i'll get into the stuff i know won't get added at any point in pb2's existance
what about an actual programming language, kinda like c, where you have variable type declaration, basic functions, basic stuff in general, with the addition of arrays too, maybe something like a switch case and a for, not going as far as classes and stuff, something like var++, var--, var+=var at most
i mean theres that new editor trigger as text thing and i feel like that can be done
anyway that might be too much
and thats it
EDIT: made a better title, added strings part
User avatar
phsc
Noir Lime [600]
 
Posts: 694
Joined: 27 July 2013, 13:58
Location: Brazil

Return to Level Editor

Who is online

Users browsing this forum: No registered users



cron