Is there a way to make a 5th global switch? (2.0 PAL)

Moderators: Semi-moderatos, Moderators, SMBX2

Animebryan
Topic author, Good citizen
Good citizen
Animebryan
Topic author, Good citizen
Good citizen
Reputation: -1
Posts: 27
Joined: 9 Jun 2017

Post #1by Animebryan » 20 Oct 2019, 3:11

Is there a way to make a custom 5th Global Colored Switch? Because I need a 5th one.

Wohlstand M
Lead Developer
Lead Developer
Avatar
Wohlstand M
Lead Developer
Lead Developer
Age: 30
Reputation: 493
Posts: 1747
Joined: 15 Feb 2014
English Pronouns: he/him
Location: Moscow, Russia
Website Youtube channel URL Skype Tencent QQ

Post #2by Wohlstand » 20 Oct 2019, 13:16

For SMBX2 - Idk.

Spoiler
For PGE Engine (out of SMBX2) - easy: make three blocks (switch itself, closed and open state blocks) and mark each of block to have switch-id 5, and they should work ;-)

Animebryan
Topic author, Good citizen
Good citizen
Animebryan
Topic author, Good citizen
Good citizen
Reputation: -1
Posts: 27
Joined: 9 Jun 2017

Post #3by Animebryan » 21 Oct 2019, 1:04

Yes. You can register a new "color" (it doesn't have to be a color, but it uses switchcolors.lua to add custom ones) for a new Global Switch. You can add "local activator, myColor = switchcolors.registerColor(string name)", which gives you an activator and a numeric key for the "color". By calling the activator with "activator()", it will toggle a switch. You can also use "function switchcolors.onSwitch()" to catch switch toggles, the basic thing would be changing the id of the filled out blocks with the empty blocks and vice versa, with "switchColors.switch(id1, id2)".

I haven't tested much in this, so someone with better experience on creating this would explain it better, and also the handbook helps. Here's a shortcut to the "Switch Colors" section of the handbook: https://docs.google.com/document/d/1uOd ... exlnwxvphe
I got this response on the smbx forums, but I'm not very proficient in lua. Do you know how this would be written out in code?

Wohlstand M
Lead Developer
Lead Developer
Avatar
Wohlstand M
Lead Developer
Lead Developer
Age: 30
Reputation: 493
Posts: 1747
Joined: 15 Feb 2014
English Pronouns: he/him
Location: Moscow, Russia
Website Youtube channel URL Skype Tencent QQ

Post #4by Wohlstand » 21 Oct 2019, 9:57

Animebryan wrote:I got this response on the smbx forums, but I'm not very proficient in lua. Do you know how this would be written out in code?
In SMBX2 it's impossible without code yet. Right now PGE Engine is only allows you to declare new switches without code: with few settings of INI files.
Anyway, don't worry, lua is easy! https://wohlsoft.ru/pgewiki/How_To:_LunaLua_basics


Return to “SMBX2 Troubleshooting”

Who is online (over the past 5 minutes)

Users browsing this forum: 2 guests