I had to google assignment operator to understand what that is. Thank you for helping and guiding. Appreciated. Will go test out the correct code now.
Learning how to script basics - Problem with basic script
Learning Ruby and RGSSxAfter testing and tweaking I finally perfected the code, or at least the first known working iteration.
I want to say a big thank you to everybody who helped here. Your help is greatly appreciated.
I have one last question. Rather than just paste this whole script to every instance everytime I need to use it,
is it possible, and how do I make it into a script that I can add to materials under script editor?
Such that I can simply just enter one line of script everytime I want to use it to an item or instance? Also if I needed to customise it, such as enter different values, for example the
item 33, item 34, digits etc for different items via such a script, how would I go about doing all these?
I want to say a big thank you to everybody who helped here. Your help is greatly appreciated.
I have one last question. Rather than just paste this whole script to every instance everytime I need to use it,
is it possible, and how do I make it into a script that I can add to materials under script editor?
Such that I can simply just enter one line of script everytime I want to use it to an item or instance? Also if I needed to customise it, such as enter different values, for example the
item 33, item 34, digits etc for different items via such a script, how would I go about doing all these?
theoretically yes - practically that's a lot more complex, and you need to understand the basics of programming to even decide where and when to execute what change.
Because especially that customization depends a lot on when you want to change the values...
Because especially that customization depends a lot on when you want to change the values...
Its mostly for convenience sake. Also hoping it will benefit the community too especially for those who very minimal knowledge with such stuff.
Guess I might go about getting volunteers to help with it eventually :S
I wanted to tell the script to play an SE file when it runs,
I got the code for that from:
http://forums.rpgmakerweb.com/index.php?/topic/25759-script-call-collection-for-vxace/
under play bgm/me/bgs/se
#alternative script calls
Audio.se_play(fName, volume, pitch)
Using that command I typed in:
Audio.se_play(pistol reload, default, default)Got a game interpreter error code sigh.
What did I do wrong this time? 🙁
I got the code for that from:
http://forums.rpgmakerweb.com/index.php?/topic/25759-script-call-collection-for-vxace/
under play bgm/me/bgs/se
#alternative script calls
Audio.se_play(fName, volume, pitch)
Using that command I typed in:
Audio.se_play(pistol reload, default, default)Got a game interpreter error code sigh.
What did I do wrong this time? 🙁
Your problem is that you didn't give a name for the sound file - you gave a variable name that was never defined anywhere.
I suggest you take some time off your game experimenting to learn the basics of Ruby programming.
Most of the mistakes so far are because you didn't understand programming conventions and what the symbols and letters in scripts really do. And with scripts, even a missing or added space can cause errors, you have to follow the rules extremely strict.
In your example the game interpreter reads pistol as a variable and looks at the content stored in that variable, reload is another variable with a different content - only if it tries to read those variables, the interpreter doesn't find them because neither the variable pistol nor the variable reload has ever been defined anywhere.
You need to place a string, not a variable, with the content of the sound name there.
I could easily correct your mistake and tell you what to write - and then you'll ask the next ten dozen questions without ever understanding where you made mistakes.
Yes, it will take you one or two months to learn the basics, but that is vital at this moment or you'll end up as a "cargo cult programmer":
http://forums.rpgmakerweb.com/index.php?/topic/5108-a-good-article-for-you-budding-scripters/
learning ruby, as andar mentioned, would be greatly beneficial for you..
Most ruby courses would cover things such as assignment operators and how to define methods, and more, within the first 20-30 minutes.
https://www.codecademy.com/tracks/ruby
https://www.ruby-lang.org/en/documentation/quickstart/
Most ruby courses would cover things such as assignment operators and how to define methods, and more, within the first 20-30 minutes.
https://www.codecademy.com/tracks/ruby
https://www.ruby-lang.org/en/documentation/quickstart/
Thank you guys. I read the cargo cult programmer article. Yes I don't want to become one and yes I've wanted to be better at coding before even this thread. Becoming someone who understands the codes in and out is definitely something I desire. I do have time constraints however, so I will need to learn programming along the way instead of prioritizing it first then work on games after. Thanks for the link ksjp17 I'd be spending whatever time I can squeeze out to read and learn. Hopefully it won't all be obsolette by the time the new RPG MX is out, i hear it utilizes java and not ruby 😮
Original thread: https://forums.rpgmakerweb.com/threads/learning-how-to-script-basics-problem-with-basic-script.43999/