【Solved】Tried to edit the script but end up error

I need random BGM to play at my main title scene.


I have no idea about the script at all but i tried to copy around the code and paste it and seems like i get variable error
I don't understand but i believe that i didn't key in any integer variable...


1.jpg2.jpg
To edit the script, you'll need at least a minimum knowledge of programming and Ruby to prevent those errors.


And it is (as many users have learned) a bad way to edit the core scripts, if you have to change them better override the functions in a new script.


As Tech-Support is for getting the editors to run and not support for game development or script support, I need to move this topic. Either to script request (if you're satisfied with someone else to provide you with the solution) or Learnung Ruby and RGSSx (if you want to learn how to do it yourself).


I've moved this thread to Script Request. Please be sure to post your threads in the correct forum next time. Thank you.


If you want it in learning RGSS, then please say so and a moderator will move it again.
To edit the script, you'll need at least a minimum knowledge of programming and Ruby to prevent those errors.


And it is (as many users have learned) a bad way to edit the core scripts, if you have to change them better override the functions in a new script.


As Tech-Support is for getting the editors to run and not support for game development or script support, I need to move this topic. Either to script request (if you're satisfied with someone else to provide you with the solution) or Learnung Ruby and RGSSx (if you want to learn how to do it yourself).


I've moved this thread to Script Request. Please be sure to post your threads in the correct forum next time. Thank you.


If you want it in learning RGSS, then please say so and a moderator will move it again.

Sorry about that i am new to the forum and i'm trying to search for somewhere i can ask simple question..
You almost had it.

Code:
def play_title_music

  # What is 'Dark_Walk.png' doing in the random title music array?
  titlem = ["Allemande.mp3","Meditation_Impromptu_01.mp3","Dark_Walk.png"]

  # Use the '+' operator to add the two strings together.
  # Use the 'sample' method to grab a random item from an array.
  Audio.bgm_play("Audio/BGM/" + titlem.sample, 70, 100)

  RPG::BGS.stop
  RPG::ME.stop

end
Much respect to @Exhydra; that's an extremely good explanation of how to correct the small technical mistakes!
You almost had it.



def play_title_music

# What is 'Dark_Walk.png' doing in the random title music array?
titlem = ["Allemande.mp3","Meditation_Impromptu_01.mp3","Dark_Walk.png"]

# Use the '+' operator to add the two strings together.
# Use the 'sample' method to grab a random item from an array.
Audio.bgm_play("Audio/BGM/" + titlem.sample, 70, 100)

RPG::BGS.stop
RPG::ME.stop

end

It work very well!
thanks for your kindness XDD

Original thread: https://forums.rpgmakerweb.com/threads/solved-tried-to-edit-the-script-but-end-up-error.67795/