Author Topic: Script Call for changing multiple variables (like the batch variable command)  (Read 164 times)

Offline RoseSkye

  • Ban requested
  • Chaos User
  • ******
  • Posts: 1218
  • LV: 59
  • Gender: Male
  • Chaos Project's Black Sheep
    • View Profile
    • Loveless Games
Does it exist?  It's very convenient

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 19985
  • LV: 648
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
There is a way to batch-modify variables with events, isn't there? Or was that just for switches?
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


Quote from: winkio
I do not speak to bricks, either as individuals or in wall form.

Quote from: Barney Stinson
When I get sad, I stop being sad and be awesome instead. True story.

Offline KK20

  • Master Scripter Fixer
  • Global Moderator
  • Guardian of Chaos
  • ****
  • Posts: 3143
  • LV: 378
  • Gender: Male
  • Choco Octo <3
    • View Profile
Yeah, variables have that ability too.

The only scripting approach would be to make a loop and iterate through a range, like
Code: [Select]
for i in 1..10
$game_variables[i] = 100
end
$game_map.need_refresh = true
which would set variables 1 through 10 to a value of 100. The game map refresh at the end is needed for events to update their page conditions (you have to do the same thing with switches too).



Other Projects
RPG Maker XP AceUpgrade RMXP to RMVXA performance!
XPA TilemapTilemap rewrite with many features, including custom resolution!


Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Offline RoseSkye

  • Ban requested
  • Chaos User
  • ******
  • Posts: 1218
  • LV: 59
  • Gender: Male
  • Chaos Project's Black Sheep
    • View Profile
    • Loveless Games
Works beautifully and I've learned something new again. Thanks KK20 for showing me how & Blizz for stating that it also works with switches.

Offline LiTTleDRAgo

  • Astral Trancist
  • *****
  • Posts: 844
  • LV: 516
  • Gender: Male
    • View Profile
    • ~
You can do it like this too.

Code: [Select]
[1,2,5,6,9,11,44, ..... ].each { |i| $game_variables[i] = 100 }
$game_map.need_refresh = true

Offline RoseSkye

  • Ban requested
  • Chaos User
  • ******
  • Posts: 1218
  • LV: 59
  • Gender: Male
  • Chaos Project's Black Sheep
    • View Profile
    • Loveless Games
Wow, thanks!

That'll be useful as well in the future!