Should microScript have a upgrade to 3.0?
There has been no upgrades for microScript for 4 years, I was wondering like maybe have more key words enhancing game dev experience? Or make some changes to make it better? Here is what I got let me know if these are good ideas!
const, declare a read only value:
In 2.0, a variable like Gravity = 9.8 looks the same as any other variable, nothing stops you from accidentally overwriting it later. const marks a value as permanently fixed. Trying to reassign it raises a clear error message instead of silently breaking your game. (This fixes some super annoying bugs)
Here is a example:
// These look like normal vars
// Nothing stops accidental changes
Gravity = 9.8
Max_Speed = 300
Tile_Size = 16
// Oops silent bug
Gravity = 0
Instead something like this:
// Locked forever
const Gravity = 9.8
const Max_Speed = 300
const Tile_Size = 16
// Error: cannot reassign a const
Gravity = 0
is, readable type checks:
myvar.type == "number" is wordy and easy to misspell. The new is keyword turns this into a simple sentence. Works with all built in types: number, string, list, object, function. Also works with class names.
In 2.0 be have to do something like this everytime:
if val.type == "number" then
print("it's a number")
end
if val.type == "list" then
print(val.length)
end
if val.type == 0 then
print("not defined")
end
Instead have a is keyword do the trick:
if val is number then
print("it's a number")
end
if val is list then
print(val.length)
end
if val is undefined then
print("not defined")
end
// Works with classes too
if enemy is Boss then
playBossMusic()
end
How are these? Maybe comment your opinions or ideas? Let me know! :)



