Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

How do you Set Screen Color Tone with a script?

See topic. I'm sure it's something like $game_screen.start_tone_change(-255,-
255,-255, 0), but I get an error that says

"ArgumentError occurred while running script.

wrong number of arguments (4 for 2)"

I'm guessing I'm only supposed to have two numbers in there, not 4, but I don't think 2 is enough to set the entire screen tone.


EDIT: I looked a little further and I saw a method that went 'def start_tone_change(tone, duration)'. So I tried $game_screen.start_tone_change([-255, -255, -255, 0], 10) to make the screen black (with 0 gray) and last 10 frames. But now I get this error:

"Script 'Game_Screen' line 106: NoMethodError occurred.

undefined method 'red' for [-255, -255, -255, 0]:Array"
 
verballydecapitating said:
$game_screen.start_tone_change(Tone.new(-255, -255, -255, 0), 10)
or if not that,
$game_screen.start_tone_change(Color.new(-255, -255, -255, 0), 10)

The Tone.new one works! Thank you!

Also, did you know you can set the screen tone with a variable? Try using a Call Script and type:

$tone_red = -255
$tone_green = -255
$tone_blue = -255
$tone_gray = 0
$tone_duration = 10

Then use another Call Script and go:

$game_screen.start_tone_change(Tone.new($tone_red, $tone_green, $tone_blue, $tone_gray), $tone_duration)

It pretty much does the same thing, but this could possibly be useful in certain dungeons that are supposed to remain a certain tone, and you needed to change it for one moment (i.e. turn screen completely black to cover up changes in map while teleporting), but don't want to remember the screen color of the dungeon again and again -- Just set the variables when you enter it. ^^

Anywho; thanks again! Problem resolved, I think.
 
Umm... calling that script would do the same thing as using the Change Screen Color Tone event command, so doing it from a call script event seems pretty pointless.

Not to mention that $game_screen.start_tone_change(Tone.new($tone_red, $tone_green, $tone_blue, $tone_gray), $tone_duration) wouldn't fit on one line of the call script box. As a matter of fact, all you can fit is $game_screen.start_tone_change(Tone. which is syntax error galore. So unless you feel like renaming classes and methods... I think it's like 100x easier to use the event command, if you're doing it from the map anyway.
 
Dark Zero said:
Umm... calling that script would do the same thing as using the Change Screen Color Tone event command, so doing it from a call script event seems pretty pointless.

Not to mention that $game_screen.start_tone_change(Tone.new($tone_red, $tone_green, $tone_blue, $tone_gray), $tone_duration) wouldn't fit on one line of the call script box. As a matter of fact, all you can fit is $game_screen.start_tone_change(Tone. which is syntax error galore. So unless you feel like renaming classes and methods... I think it's like 100x easier to use the event command, if you're doing it from the map anyway.

That's strange. The Script event command box is large, and it gives me a lot of room to write all that. I was even able to fit the whole $tone_red, etc. variable stuff in it, skipped lines and all.

Maybe we have different versions of RMXP? I have the English trial.
 
No, I'm saying that you can't fit $game_screen.start_tone_change(Tone.new($tone_red, $tone_green, $tone_blue, $tone_gray), $tone_duration) on one line. It has to be all on the same line or it will result in a syntax error.
 
Dark Zero said:
No, I'm saying that you can't fit $game_screen.start_tone_change(Tone.new($tone_red, $tone_green, $tone_blue, $tone_gray), $tone_duration) on one line. It has to be all on the same line or it will result in a syntax error.

Oh.

Well, then, event command it is then!
 
Dark Zero said:
No, I'm saying that you can't fit $game_screen.start_tone_change(Tone.new($tone_red, $tone_green, $tone_blue, $tone_gray), $tone_duration) on one line. It has to be all on the same line or it will result in a syntax error.
This works:
Code:
$game_screen.start_tone_change(
Tone.new($tone_red, $tone_green,
$tone_blue, $tone_gray), 
$tone_duration)

But it uses five uneeded global variables.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top