Learning how to script basics - Problem with basic script

red_codec

Villager
Member
Joined
Sep 9, 2014
Messages
38
Reaction score
1
First Language
English
Primarily Uses
As said above (a lot of posts above), = is the assignment operator - for comparisons you need ==

The correct code would be

if num_item34 == 15
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.
 

red_codec

Villager
Member
Joined
Sep 9, 2014
Messages
38
Reaction score
1
First Language
English
Primarily Uses
After 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? 
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,425
Reaction score
7,710
First Language
German
Primarily Uses
RMMV
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...
 

red_codec

Villager
Member
Joined
Sep 9, 2014
Messages
38
Reaction score
1
First Language
English
Primarily Uses
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...
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
 

red_codec

Villager
Member
Joined
Sep 9, 2014
Messages
38
Reaction score
1
First Language
English
Primarily Uses

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,425
Reaction score
7,710
First Language
German
Primarily Uses
RMMV
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/
 

red_codec

Villager
Member
Joined
Sep 9, 2014
Messages
38
Reaction score
1
First Language
English
Primarily Uses
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  :o
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.
Can someone recommend some fun story-heavy RPGs to me? Coming up with good gameplay is a nightmare! I was thinking of making some gameplay platforming-based, but that doesn't work well in RPG form*. I also was thinking of removing battles, but that would be too much like OneShot. I don't even know how to make good puzzles!
one bad plugin combo later and one of my followers is moonwalking off the screen on his own... I didn't even more yet on the new map lol.
time for a new avatar :)

Forum statistics

Threads
106,018
Messages
1,018,357
Members
137,803
Latest member
andrewcole
Top