[SOLVED] Change block and npc forecolor?

Description: Internal scripting system of SMBX-38A Engine based on the simple VB-like language
Moderators: Lx Xzit, Yoshi021, 5438A38A, Semi-moderatos, Moderators

1gnacio25 M
Topic author, Good citizen
Good citizen
1gnacio25 M
Topic author, Good citizen
Good citizen
Age: 15
Reputation: 24
Posts: 31
Joined: 15 Mar 2021

Post #1by 1gnacio25 » 2 Aug 2021, 21:15

So i found that you can change the forecolor of NPCs and blokcs via scripts, and i typed this to make a red koopa have a shade of blue

Code: Select all

With npc(sysval(Param1))
.forecolor = rgba(53, 53, 126, 1)
end with

But anything in the rgba just seems to make the NPC invisible, same with blocks. I am doing something wrong?
Last edited by 1gnacio25 on 6 Aug 2021, 1:00, edited 1 time in total.
Image

NESTED ERNEST M
Count
Count
Avatar
NESTED ERNEST M
Count
Count
Reputation: 71
Posts: 268
Joined: 23 Sep 2017
Location: Perú, Lima
Youtube channel URL

Post #2by NESTED ERNEST » 3 Aug 2021, 6:19

The last parameter of the rgba function:
255: completely filled.
0: completely invisible or no fill of the image.
Programming NPCs in SMBX-38A is fun:
That is me
Image
Image
Image
Image

Special image
  • yt-image-banner: https://yt3.ggpht.com/M_O1AzQEOJogSq5OJESIaA5kFLdbwdDNMihDOJkJgPiH7cOx-LWK41TU9GWzExmkmpn3EWYbJg=w1060-fcrop64=1,00005a57ffffa5a8-k-c0xffffffff-no-nd-rj
  • image-to-up: https://3.bp.blogspot.com/-Y-LrpIS2rqw/UCBTtk7k-pI/AAAAAAAABBs/qZuI0sCStkc/s1600/jean-baptiste+beaudelle+girafe++escargot.jpg
  • image-to-left: https://us.123rf.com/450wm/trassnick/trassnick2007/trassnick200700002/152919781-el-marl%C3%ADn-negro-grande-salta-del-mar-pesca-extrema-del-pez-espada-negro-en-alta-mar-vacaciones-en-lo.jpg
  • image-last-w: 1


ROCKMAN GIF IN SMBX 38A

Image

1gnacio25 M
Topic author, Good citizen
Good citizen
1gnacio25 M
Topic author, Good citizen
Good citizen
Age: 15
Reputation: 24
Posts: 31
Joined: 15 Mar 2021

Post #3by 1gnacio25 » 3 Aug 2021, 21:07

NESTED ERNEST wrote:The last parameter of the rgba function:
255: completely filled.
0: completely invisible or no fill of the image.
Ok, so the NPC forecolor works just fine. I assumed that it would work the same for blocks, so i wrote this:

Code: Select all

With block(sysval(Param1))
block(136).forecolor = rgba(53, 53, 126, 255)
end with

But it turns random blocks into that color and i only want all the specified blocks to change color
Image

coolXD
Honourable citizen
Honourable citizen
coolXD
Honourable citizen
Honourable citizen
Reputation: 32
Posts: 43
Joined: 13 Jan 2020

Post #4by coolXD » 4 Aug 2021, 7:02

1gnacio25 wrote:
NESTED ERNEST wrote:The last parameter of the rgba function:
255: completely filled.
0: completely invisible or no fill of the image.
Ok, so the NPC forecolor works just fine. I assumed that it would work the same for blocks, so i wrote this:

Code: Select all

With block(sysval(Param1))
block(136).forecolor = rgba(53, 53, 126, 255)
end with

But it turns random blocks into that color and i only want all the specified blocks to change color

Here just all blocks to sysval(BCount) code, enjoy!

Code: Select all

Dim shader as integer
With block(sysval(Param1))
For shader = 1 To sysval(BCount)
block(shader).forecolor = rgba(53, 53, 126, 255)
Next
End with

1gnacio25 M
Topic author, Good citizen
Good citizen
1gnacio25 M
Topic author, Good citizen
Good citizen
Age: 15
Reputation: 24
Posts: 31
Joined: 15 Mar 2021

Post #5by 1gnacio25 » 4 Aug 2021, 23:08

coolXD wrote:
1gnacio25 wrote:
NESTED ERNEST wrote:The last parameter of the rgba function:
255: completely filled.
0: completely invisible or no fill of the image.
Ok, so the NPC forecolor works just fine. I assumed that it would work the same for blocks, so i wrote this:

Code: Select all

With block(sysval(Param1))
block(136).forecolor = rgba(53, 53, 126, 255)
end with

But it turns random blocks into that color and i only want all the specified blocks to change color

Here just all blocks to sysval(BCount) code, enjoy!

Code: Select all

Dim shader as integer
With block(sysval(Param1))
For shader = 1 To sysval(BCount)
block(shader).forecolor = rgba(53, 53, 126, 255)
Next
End with
Now it works, thanks :)
Image


Return to “TeaScript”

Who is online (over the past 5 minutes)

Users browsing this forum: 1 guest