Discord
Login
Community
DARK THEME

Microscript+

A basic extension to microscript bringing some common (and some not-so-common) helper functions and variables, plus new classes! https://microstudio.dev/i/JmeJuniper/msplus/

Changelog:

v2

12/22/2022

This is... a huge update. I haven't worked on microscript+ very much, but I added a few features every once in a while and it built up to this. Well, it doesn't look that big, since the place where most of the content is and the place that looks the most underwhelming happen to be the same place: New.

New

  • Variables
    • i/imgry/imgnry/imaginary
    • allX
    • allY
  • Classes
    • complex
  • Prototypes
    • List
      • clone
      • removeIf
    • Object
      • clone
      • removeIf

Updated

  • Functions
    • roundPlace
      • Now rounds to the nearest multiple of mark, instead of rounding to the nearest place decimal places
  • Variables
    • wasdX
      • Now supports more keyboard layouts
    • wasdY
      • Now supports more keyboard layouts
  • Classes
    • vec2d
      • "*" now returns the dot product of two vectors, instead of multiplying magnitude.

Renamed

  • Functions
    • divisibleBy -> divisible

Deleted

  • Classes
    • vec3d
  • Prototypes
    • List
      • remove (already a function)
      • arrange (already a function)

Bugfixes

  • Functions
    • rand
      • Now can return decimal values (broke: v1)

Misc

  • Removed msplus. before all functions/classes/variables.
  • Added default parameter values to rand, chance, roundPlace, lerp, and contencate

v1.6.1

9/16/2022

New

  • Functions
    • map2d

Updated

  • Classes
    • Dynamic
      • Merged addWall and updWall into one function: setWall
      • touchingWall now accepts a list, and returns true if any of them are being touched

v1.6

8/31/2022

Microscript's back! I was waiting to release this because one of the features doesn't work due to a microscript bug, but I figured it's been long enough and I might as well just publish this and add a note saying it won't work until it's fixed. Anyways, because of that, it's a pretty big update :D

New

  • Functions
    • mod
  • Prototypes
    • String
      • replace
    • List
      • arrange
      • random
      • remove

Updated

  • Classes
    • Button
      • Added .press
      • Added .release
    • Dynamic
      • Added setVar()
      • Added getVar()
      • Added setSprite()
      • Added touchingAny()
      • Dynamics now lose speed when hitting screen borders, just like when hitting walls (if clamp is on)

Deleted

  • Functions
    • arrange (replaced with List.arrange, as seen in New)
    • randItem (replaced with List.random, as seen in New)

Misc

  • Changed the few straggling =s in if statements to ==s

v1.5.5

7/1/2022

Updated

  • Classes
    • Dynamic
      • Collisions now work while the dynamic is still
      • Dynamics now (probably) won't teleport through walls anymore
      • Dynamics can now "skim" past the sides of walls without losing (all) of their momentum
      • Walls now display when debug for a dynamic is on, with an orange hitbox and an orange line linking them and their parent dynamic
  • Prototypes
    • String
      • "*"
        • Returns "" when multiplying a string by 0 or less
  • Demo
    • Arrows now disappear faster (allowing you to fire them quicker)
    • Arrows now no longer bounce off the wall (they fall on the ground instead)

v1.5.4

6/30/2022

Updated

  • Functions
    • Numberfy
      • Now conducts deep searches of lists. Returns first numberfiable thing it can find, numberfied
  • Demo
    • ? now activates help

Bugfixes

  • Functions
    • Numberfy
      • Now works instead of returning "540" when inputted "54", for example (Broke with microstudio update)

v1.5.3

6/27/2022

New

  • Functions
    • randItem

Updated

  • Functions
    • arrange
      • Now returns error notifying that string sorting may not be accurate with non-numbers in the array, but still returns the attempted sorted list

Bugfixes

  • Functions
    • arrange
      • "low-high" method stops zero-ing numbers (Broke v1.5.2 hotfix 1 (it's a really quick hotfix to repair a bug, of course there are going to be a bunch of bugs sprouting from it)

v1.5.2 hotfix 1

6/25/2022

Bugfixes

  • Functions
    • arrange
      • Now properly returns the value instead of changing the variable (Broke v1.5.2)
    • median
      • Properly uses arrange with the new bugfix (Broke v1.5.2 hotfix 1)

v1.5.2

6/24/2022

Changed

  • Classes
    • dynamic
      • Added move
      • Added setAlpha
      • Added changeAlpha
      • draw now sets the transparency of the sprite
  • Demo
    • Arrow now fades when bouncing

Deleted

  • Classes
    • list2d
      • Couldn't get it to work properly

v1.5.1 "Statistics" update

6/23/2022

New

  • Functions
    • arrayPercents
    • mean/average
    • median
    • mode
    • arrange
    • divisibleBy

v1.5 "Undo" update

6/22/2022

New

  • Functions
    • chance
    • roundPlace

Updated

  • Classes
    • Dynamic
      • BindKey now allows for "forward", "backward", "turnLeft", and "turnRight" bindings (useful for top-down games)
      • Added removeBinds
      • .width and .height and all collision tests now reflect rotation!
      • Added toggleDebug
      • Added toggleClamp

v1.4.4

6/16/2022

New

  • Functions
    • Arrayify

Updated

  • Functions
    • Stringify
      • Returns input if it cannot be stringified
    • Numberfy
      • Returns input if it cannot be numberfied

v1.4.3

6/15/2022

New

  • Demo
    • Highscore
    • Countdown
    • Help button

Updated

  • Classes
    • Dynamic
      • Added touchingWall, it returns true if the sprite is touching a wall
      • Added bindKey
  • Demo
    • Fixed aspect ratio
    • Arrow now bounces off of wall

Deleted

  • Demo
    • 1 wall

v1.4.2 "Demo" update

6/14/2022

New

  • Demo (Thanks @TinkerSmith for the idea!)

Updated

  • Classes
    • Dynamic
      • Now has setPos function, which I somehow forgot about

Deleted

  • Functions
    • Fill
      • Unnecessary, screen.clear(color) exists

v1.4.1

6/14/2022

Updated

  • Classes
    • Dynamic
      • Now has 4 new functions: colliding, addWall, updWall, getWall, deleteWall
      • .update() now features wall collision

Renamed

  • Functions
    • fillScreen -> fill

Bugfixes

  • Functions
    • Fill
      • Now fills the screen instead of drawing a border (broke v1.3)

v1.4 - "Dynamic" update

6/13/2022

New

  • Classes
    • countdown
    • dynamic
    • list2d

Misc

  • Lowered chance of overwriting user-defined variables (mostly "temp") by using local in functions and classes

v1.3.2

6/13/2022

New

  • Functions
    • map

Updated

  • Variables
    • All dynamic variables are now updated every millisecond, as opposed to every frame
  • Classes
    • Optimized scrollbar and slider, removing a lot of mathematical operations in update and draw (however, it does require a bit more computing when initiating a new instance). Not anything you would notice normally, but if you for some reason need a ton of scrollbars, or have a really really weak machine, it might help.
    • Scrollbar and slider now have a progress variable you can access, mapping the pure x/y position of the slider/scrollbar to a 0-1 range showing the progress from the starting position

Bugfixes

  • Variables
    • milliseconds and seconds are back inside the msplus object, like they're supposed to be (Broke v1.2.2)
  • Classes
    • Scrollbar and slider now actually scroll with the mouse wheel (Broke v1.3.1)

v1.3.1

6/11/2022

Updated

  • Classes
    • Scrollbar & slider now can adjust when you scroll with a mouse wheel, with a new variable scrollSpeed (If scrollSpeed is negative, it will go in reverse, if scrollSpeed is 0 or not defined, it won't react at all to mouse wheel events.)
    • Separated scrollbar's, slider's, and button's draw() into both draw() and update() in case you want to do something like stop the button/scrollbar/slider from updating (i.e. if you are in a pause menu, and don't want to let the user press the button, but still want to draw it to the screen)

v1.3 - "UI" update

6/10/2022

New

  • Functions
    • fillScreen
  • Classes
    • uiButton
    • scrollbar
    • slider

Updated

  • Classes
    • Vec2d
      • Removed .attr() in favor of .x, .y, .mag, and .dir
    • Vec3d
      • Removed .attr() in favor of .x, .y, .z, and .mag
    • Timer
      • Removed .getTime(), in favor of .time

v1.2.2

6/10/2022

New

  • Functions
    • MultiPrint
  • Variables
    • Public
      • Milliseconds
      • Seconds
    • Private
      • StartMilliseconds
  • Prototypes
    • String
      • "*"

Bugfixes

  • Functions
    • Contencate
      • Works properly again (Broke v1.1)

v1.2.1 - "Type Conversion v2" update

6/8/2022

Updated

  • Functions
    • Numberfy
      • Now supports lists (where the first object is a valid string) and returns informative errors
    • Stringify
      • Now supports objects & functions (Note: Functions do not return the code you enter, they return a lower-level code filled with instructions like STORE_LOCAL, LOAD_LOCAL, and FUNCTION_APPLY_VARIABLE 1)

Renamed

  • Functions
    • angle -> dirTo

Bugfixes

  • Functions
    • Numberfy
      • Now actually works (broke v1.1)
    • Stringify
      • Now works properly with numbers and lists again (broke v1.1.1)

v1.2 - "Vector Revamp" update

6/7/2022

New

  • Classes
    • vec3d

Updated

  • Classes
    • Vec2d
      • Revamped, renaming .getAttr() to .attr(), massively improving + and -, fixing * to be mathematically correct, and removing / and &

Renamed

  • Classes
    • Vec2d -> vec2d

v1.1.2

6/7/2022

Updated

  • Functions
    • Stringify
      • Added newlines to stringify, making it clearer to read

Bugfixes

  • Functions
    • Stringify
      • Fixed stringify returning 0 when given a class (broke v1.1.1)
  • Classes
    • Vec2d
      • Fixed Vec2d division multiplying instead of dividing (Thanks @Sebastian!) (broke v1)

v1.1.1

6/7/2022

Updated

  • Functions
    • Stringify
      • Now supports non-MSPLUS classes (Thanks @Sebastian!)

Renamed

  • Functions
    • randBetween -> rand

v1.1 - "Type Conversion" update

6/6/2022

New

  • Functions
    • Numberfy

Updated

  • Functions
    • Stringify
      • Reports an error when inputting an object or non MSPLUS class instead of attempting and possibly outputting weird results
      • Added support for MSPLUS classes Vec2d and timer

Misc

  • Simplified function & variable calling by only requiring the name of the function/variable, not requiring .func. or .var.
  • Put classes in the msplus object to avoid overwriting

v1 - "Initial" update

6/6/2022

New

  • Functions
    • randomBetween
    • clamp
    • lerp
    • sign
    • dist2d
    • dist3d
    • angle
    • stringify
    • contencate
    • rgbStr
    • rgbaStr
  • Variables
    • Public
      • wasdY
      • wasdX
      • arrowY
      • arrowX
  • Classes
    • Vec2d
    • timer

In stringify you could replace the error message with

str = "object: "
for property in a.class
  str = str + property + "=" + a[property] + ", "
end
return str

to handle unknown types.

Also, not sure what you're trying to do with operators "/" for the vector?

(edit: corrected typo in the code - now uses correct a variable name)

@Sebastian I tried to do that with the objects, but it didn't work, didn't think to do it with classes though, thank you! As for the /, it's just division, I figured there might be a rare case where someone might want it, so I added it :p

Ok, but I think you made a mistake in definition?

"/" = function(a, b)
      return new Vec2d(a.x*b.x, a.y*b.y)
    end

And beside that - division of a vector by another vector is not defined in mathematics, so if someone needs it, then they have a bigger problem ;)

Oops, thanks for catching that! Honestly, Vec2d was kinda rushed, I'm going to redo it soon

Dang, this is growing quickly :)

P.S. are you planning on releasing some demo to show the use of some of your extensions? Especially looking at your dynamics and walls :)

Live Long and Tinker

Thank you :D I'm really excited for dynamics, so expect some more updates to that! And yeah I better start work on a demo, I have procrastinated that long enough XD

Edit: Aaand... Done! Nothing much, but I think it helps show the usefulness of dynamics and some other things

Aaaaaah, that makes much more sense right away :) So basically by assigning walls to a dynamic object it creates kind of collision groups, or so.

Thanks a lot for the example :)

@TinkerSmith Yeah, pretty much. I was thinking of having them a separate class, but then you would need to call something like sprite.updWallPos(wall) and it would be annoying :/ Glad you enjoyed! (P.S. I'm almost done with a new update that adds keybinding and a way to see if a sprite is touching a wall, I think you'll like it :D )

Cool. I might need some walls soon, but haven't had time yet to further explore it.

Have to see how it works when I have multiple players/NPCs and one set of walls

@Tinkersmith Walls are assigned to a single dynamic at a time (really it's just an array named this.walls with some objects with x y width and height) so they won't transfer :/

EDIT: Though that does make it easier to make walls that only apply to one dynamic

Post a reply

Progress

Status

Preview
Cancel
Post
Validate your e-mail address to participate in the community