Scripting in RGSS Ruby for Intermediate and Experts
½th Edition
Author: Boris Mikić alias Blizzard
This is the ½th Edition! There might be typing and other mistakes!Contents:1. Introduction2. Compatibility- 2.1. Aliasing
- 2.2. Thinking in Advance
- 2.3. Names and Problems
- 2.4. "Stack level too deep"
- 2.5. RAM or CPU?
3. Data Processing and Storage- 3.1. Why "looping"?
- 3.2. Why Methods/Functions?
- 3.3. How to handle Data efficiently
- 3.4. Module or Class?
- 3.5. RAM or CPU?
4. Windows- 4.1. The Basics
- 4.2. The wrong Way to create a Window
- 4.3. Do they look nice?
- 4.4. Window or Sprite
- 4.5. HUD Basics
- 4.6. The Problem with non-vital Information being displayed
- 4.7. RAM or CPU?
5. Lag-weg- 5.1. Algorithm Complexity
- 5.2. What lags and why it lags (RGSS specific)
- 5.3. Decrease Process Time
- 5.4. Don't fear more Code
- 5.5. RAM or CPU?
6. Wannabe-Cool Scripting- 6.1. Scripts with {} Brackets
- 6.2. One Line Functions/Methods
- 6.3. Too many useless and pointless Things
- 6.4. Too much SephirothSpawn
- 6.5. Avoid being an Idiot
- 6.6. Re-invent the Wheel
- 6.7. Enforcing Standards
- 6.8. Scripts the World doesn't need
- 6.9. RAM or CPU?
7. Hints and Tricks- 7.1. Pen on Paper or train your Brain
- 7.2. "Game_System" is your save data's best friend
- 7.3. Boolean Algebra
- 7.4. The evil Bug in "if" Branching
- 7.5. First this or that? - When "if" goes crazy
- 7.6. The Trick with "unless" - De Morgan's Law
- 7.7. Comparisons
- 7.8. Instance Variable Access aka Encapsulation
- 7.9. Powerful implemented Iterator Method "each"
- 7.10. Bug Hunter
- 7.11. Global, Local, Instance Variable or Constant?
- 7.12. Inside-Outside or Outside-Inside
- 7.13. "Uh, what does this Knob do?"
- 7.14. About Superclasses and Mix-ins
- 7.15. NFS - Need for Sorting
- 7.16. RAM or CPU?
8. Useful Links9. Summary
1. IntroductionAre you reading this to
learn how to script? Then this is
NOT for you. If you want to understand this e-book fully, you need basic scripting knowledge. You can read this, of course, but you'll end up wasting your time by not understanding even half of it.
Instead, this e-book will teach you how to become a better scripter. There are far too many scripters who know just a few basics and in the best case they can make a CMS. I will teach you how to handle data, how to make windows look nice and handle them efficiently, how to avoid lag, how to hunt down bugs and how to not be an idiot when scripting. At the end of each chapter there is a little summary, also teaching you how to choose between RAM and CPU specific for that chapter.
Note that I will explain you several things, but these are only the basics. You can't become a better scripter just by reading this e-book, it will only give you a head start in becoming a better scripter. You simply can't become a better scripter without practical experience.
2. CompatibilityThis chapter will show you how to make your scripts work with scripts of other scripters more conveniently. If you don't make your scripts compatible, most won't be used. If a user has three cool scripts from three other scripters that work together just fine and yours just won't fit in, he will kick yours most likely and keep using the other three. Another reason for compatibility is to save your time and effort. If your script doesn't work with another one, you will need time to merge it with the other ones for that user.
If your script can be configured and/or has options, make a working precondition and turn off all critical options that need to be first set up correctly by users. It's always a good idea to make your script work
Plug 'n' Play as most people don't bother reading instructions.
3. Data Processing and StorageIn this chapter you will learn how to handle data and data processing. In other words, this chapter IS
RAM or CPU. You will learn how you can decrease the number of coded lines.
4. WindowsNo, it's not the operating system. This chapter will teach you how to handle windows, since they are actually consisting out of several sprites and sprites are the ones that can cause the most lag, especially if they are large.
5. Lag-wegThis chapter will teach you about the worst archenemy of every programmer and scripter:
Lag.
Lag-weg literally means
Lag-away as
weg means
away in German.
6. Wannabe-Cool ScriptingYou are a scripter/programmer, but before all, you are a human being like everybody else. There just are people in the world who seem to believe they would be better than other for either no real or some really idiotic reason. You won't come over as
cool if you're being an idiot and rude to people. In this chapter we will work on your relations to the world around you, since it doesn't evolve around you: You evolve around it.
7. Hints and TricksThis chapter will show you some interesting ideas how to make your scripts work faster, be more compatible, be shorter and on top of that have a cool and professional looking code. Most probably you will enjoy this chapter most as it teaches you actually something to script and doesn't teach you the theory behind all of it too much. This chapter also includes a lot of practical experience.
8. Useful LinksSince this e-book explains just a few basics, here are several links for those who are eager to learn more.
Rubyhttp://en.wikipedia.org/wiki/Ruby_(programming_language)Stackhttp://en.wikipedia.org/wiki/Stack_(data_structure)Recursionhttp://en.wikipedia.org/wiki/Recursion_(computer_science)Interpreterhttp://en.wikipedia.org/wiki/Interpreter_(computing)Compilerhttp://en.wikipedia.org/wiki/CompilerMachine Languagehttp://en.wikipedia.org/wiki/Machine_languageCPUhttp://en.wikipedia.org/wiki/Central_processing_unithttp://en.wikipedia.org/wiki/CPU_designObject-oriented programminghttp://en.wikipedia.org/wiki/Object-oriented_programmingRAMhttp://en.wikipedia.org/wiki/Random_access_memoryArrayhttp://en.wikipedia.org/wiki/ArrayHashhttp://en.wikipedia.org/wiki/Hash_tableHUDhttp://en.wikipedia.org/wiki/HUD_(computer_gaming)Algorithm complexityhttp://en.wikipedia.org/wiki/Complexityhttp://en.wikipedia.org/wiki/Computational_complexity_theoryLogarithmhttp://en.wikipedia.org/wiki/LogarithmBoolean Algebrahttp://en.wikipedia.org/wiki/Boolean_algebra_(structure)Call by Value/Call by Referencehttp://en.wikipedia.org/wiki/Evaluation_strategy
9. SummaryDon't compare yourself with other scripters. You might lose your motivation by thinking "I will never get as good as him..." On the other hand you could also DO compare yourself with other scripters. You might be the type of person who says "I want to do better. I can do better. I will do better." instead. It's up to you. None of the good and known scripters today was just born with his skills. He has earned them through work and experience. This e-book is a part of my knowledge as a gift to all of you. It's not only what I have learned from scripting in RGSS, it's also what I have learned from programming in general, from what I have been taught in college and from life itself. Every scripter is unique and his experience and skills are incomparable with the experience and skills of any other scripter. One day you will just realize "Hey, I became better than that other guy..."
The RPG Maker XP help file is always a big help when you get into a dilemma asking yourself "Can I do that?" or "Does that class support that?" or... That's why I have included an enhanced English help file with an extra chapter by an unknown author and the Scripts.rxdata with English commented code, improved iteration coding, recoded to avoid the built-in RGSS bug with conditioning and overworked code to shorten the and improve the code. Many of you might not have a legal copy of RPG Maker XP and therefore not the English files.
But this does not mean that I encourage illegal copies! I only give support regardless of the fact that your copy is legal or not! If you like the RMXP editor and engine, buy it! Reading through the help file once completely will help you a lot. You will find many useful methods that can give you results, instead of using your own code for that. I also included a copy of the RGSS102E.dll
By reading this e-book I hope right now you got the itches to make something more than just a CMS. And even if it's a CMS, I hope its moving windows that move from behind a window to the side and then back over the other window will look cool, since they don't lag at all.
10. DownloadFull e-book download linke-book PDF ONLY download linke-book DOC ONLY download linkIf you have problems, you can also try the .txt file download:
http://www.megaupload.com/?d=18E7942R