RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
RGSS3 ~ Scripting Video Tutorials

0 Members and 4 Guests are viewing this topic.

*
*crack*
Rep:
Level 64
2012 Best Newbie2012 Most Unsung MemberFor frequently finding and reporting spam and spam bots
Only a week and a half into my holidays and I'm up to the point where I'm trying to find more productive ways to procrastinate.
So here is my latest scheme. It is my hope to start from the very beginning and go all the way up to RegEXP (as that was my ultimate goal when I started scripting).
Edit: Not on holidays anymore, but still continue when I can...


Tut 01 ~ Variables
Tut 02 ~ Variable Types and IF Statements
Tut 03 ~ Methods & Functions
Tut 04 ~ Method Arguments
Tut 05 ~ Boolean Operators
Tut 06 ~ The 'Return' Keyword
Tut 07 ~ Playing Audio (BGM, BGS, ME, SE)
Tut 08 ~ Arrays
Tut 09 ~ Classes
Tut 10 ~ The 'New' Keyword
Tut 11 ~ A little on Instance Variables and some more on 'New'
Tut 12 ~ Class Inheritance
Tut 13 ~ More on Class Inheritance
Tut 14 ~ The 'Super' Keyword
Tut 15 ~ Hierachy of Classes and Methods
Tut 16 ~ Aliasing Methods
Tut 17 ~ First Script: Collision Sound
Tut 18 ~ 'If', 'Unless', and the 'Case' keyword
Tut 19 ~ Loops
Tut 20 ~ More Loops and the 'Break' Keyword
Tut 21 ~ Concatenating Strings
Tut 22 ~ Gsub (Replacing Text)
Tut 23 ~ Modules
Tut 24 ~ Module Methods
Tut 25 ~ Some Altenate 'If' Statement Code and .is_a?
Tut 26 ~ Going Through the Workings of the Default Scripts
Tut 27 ~ Ternary Operators
Tut 28 ~ Second Script: Play SE on Balloon Pop-Up
Tut 29 ~ Aliasing Module Methods
Tut 30 ~ Creating Command Window Options
Tut 31 ~ Creating a Window and Drawing Text
Tut 32 ~ Using Script Calls in Events
Tut 33 ~ Creating a Custom Scene
Tut 34 ~ Using Sprites and Textures
Tut 35 ~ attr_reader, attr_writer, attr_accessor and Saving Variables in a Save File
Tut 36 ~ Writing a Basic Word-Wrapper
Tut 37 ~ Finishing the Synopsis Scene
Tut 38 ~ Writing Script Instructions
Tut 39 ~ Accessing Pre-Made/Internal Data
Tut 40 ~ 2D|3D Arrays
Tut 41 ~ Hash
Tut 42 ~ Horizontal Commands, Animated Sprites, Window Entrances
Tut 43 ~ Scrolling Text in a Window
Tut 44 ~ Third Script: Sound Test Scene (Part One)
Tut 45 ~ Third Script: Sound Test Scene (Part Two)
Tut 46 ~ Third Script: Sound Test Scene (Part Three)
Tut 47 ~ Third Script: Sound Test Scene (Part Four)
Tut 48 ~ Third Script: Sound Test Scene (Final)
Tut 49 ~ Structs
Tut 50 ~ Getting Access to the Contents of Noteboxes
Tut 51 ~ Regular Expressions
Tut 52 ~ Getting Multiple Regex Matches
Tut 53 ~ Event Commands and Comment Tags
Tut 54 ~ Creating a Core Script
Tut 55 ~ Fiber.new { explain_me() }
« Last Edit: December 25, 2013, 07:47:02 PM by D&P3 »
All of my scripts are totally free to use for commercial use. You don't need to ask me for permission. I'm too lazy to update every single script post I ever made with this addendum. So ignore whatever "rule" I posted there. :)

All scripts can be found at: https://pastebin.com/u/diamondandplatinum3

*
? ? ? ? ? ? ? ? ? The nice kind of alien~
Rep:
Level 92
Martian - Occasionally kind
Thanks for giving me some good laughs  :tpg:
It was fun waiting to see the code blow up and hear your reaction.

Seriously though, it is a great idea. Having to structure and formulate sentences about what you are doing and how it works will help you grow as a scripter :D
If you get in to trouble with regular expressions don't hesitate to ask me or modern algebra for help.

More variable types are available for usage as a scripter
Code: [Select]
@@class_variables   # Yup, they are funnily enough shared across all instances of a given class
Constants   # Which contrary to it's name can be treated surprisingly much like a variable in Ruby.

Now isn't it interesting that you got an error when you tried to print out the local variable before you assigned it a value?
What would have happened if you had used an instance variable instead? Which variables have default values nil?
Why do you think it's not true for all variable types?

In terms of the actual contents I suggest you try to come up with examples on which you apply what you want to show.
That way it is easier to come up with names and you get training in given good names. (It's hard)

*hugs*
- Zeriab

*
*crack*
Rep:
Level 64
2012 Best Newbie2012 Most Unsung MemberFor frequently finding and reporting spam and spam bots
You're welcome for the laughs friend :)

It is interesting actually, I thought the messagebox would try to convert it and return nil, but guess it didn't like it :malson2:
though I'm fairly certain that instance and global variables default to nil if they do not already exist.
I guess since there wasn't a local variable, it tried looking for a method and threw an error, which is also why I like to use parenthesis when calling a method, just so the difference is more easily recognised.

@@class_variables are something I've never actually used
Constants are something I'll get into when we start doing scripts that need an editable part to it (though I suspect that's probably not soon).

I think I should be okay with RegEXP, I was mainly asking Modern Algebra to help me on that one but last week it sorta clicked in and I understand it now ;8



I did want to use examples to apply this, but everything I could think of on the spot required using other methods and aliases, all of which were out of the scope of what had been shown, so I decided to cut it short :yuyu:
All of my scripts are totally free to use for commercial use. You don't need to ask me for permission. I'm too lazy to update every single script post I ever made with this addendum. So ignore whatever "rule" I posted there. :)

All scripts can be found at: https://pastebin.com/u/diamondandplatinum3

*
Rep:
Level 82
Definitely a good idea, even just for personal development. It's funny because I working on something similar for that reason, but I've been a little more preoccupied with other things lately. That said, if there's anything I can help with, you only need to ask. A bit of collaboration might be useful. I'll be sure to watch through your videos.

I haven't yet seen them, so I'm not sure if this was covered. But when naming variables, you can't give them names which are reserved names. It's worth point that out early, in case someone tries to do so and doesn't quite understand why that is.

Constants are funny variable types and there's quite a bit to learn about them in Ruby.

Spoiler for:
I've never understood why it is that you can actually reassign them. But you can't reassign (or even initialize, for that matter) a constant variable within a method. Unless you use const_set(sym, obj), then you can. Now, I can get with const_set, because that could be a handy thing to have as an explicit request to modify a constant. I just hope there's a good design reason for not enforcing constant variables. It kind of defeats the point when you can modify them.

As for @@class_variables, I can't say I've used too many of them. I just haven't come across many script ideas that require something like that. They are still worth mentioning, though.

I love writing Regular Expressions. They really are one of those things that just clicks after a while. I still manage to get it wrong the first time, though, especially for those interesting literals.
(Why do I always feel like it's the end of the world and I'm the last man standing?)

*
*crack*
Rep:
Level 64
2012 Best Newbie2012 Most Unsung MemberFor frequently finding and reporting spam and spam bots
I use the const_set fairly often actually.
Aside from having a module contain an editable portion to a script, I like to use it to contain relative information that would be handy to store while the game is running without needing to use attrs; it's helpful in preventing the script from requiring the user to start a new game. Though sometimes I do need to have information saved completely and this is when I use attrs.
From a design perspective I don't really understand it either, however I've found it useful so I'm not complaining :D

At the moment I haven't gone into methods/functions, so I haven't gone into reserved names yet either, a good thing I did notice though was that variable names do not allow a question mark at the end of its name but a method does

RegEXP was the same as pointers in C++, it just clicked in without me really noticing :)
All of my scripts are totally free to use for commercial use. You don't need to ask me for permission. I'm too lazy to update every single script post I ever made with this addendum. So ignore whatever "rule" I posted there. :)

All scripts can be found at: https://pastebin.com/u/diamondandplatinum3

*
Rep:
Level 82
Watching through your latest video, here's a suggestion.

Spoiler for:
Rather than using existing classes from the script editor, it might be better to write your own example classes that are tailored to what it is you're trying to teach. If you do this in a script directly above Main, and use the global space to create instances of the example class to work with, you'll be able to use the start up period to demonstrate what is going on underneath, inside the code.

A script that demonstrates calling methods, no classes or objects involved, could look like this:

Code: [Select]
def method_one
  #When calling method_one, print out some text
  p "Test from method one"
end

def method_two
  #When calling method_two, print out some text
  p "Test from method two"
end

def method_three
  ##When calling method_three, print out some text
  p "Test from method three"
  #Method_three also calls method_two and method_one
  method_two
  method_one
end

#We want to call each of the three methods above in turn
method_one
method_two
method_three

I threw in comments because it's easier to understand what is happening, after it's been written. But as you are also saying whilst showing, you can explain it as you go. No classes, no modules, no nothing except methods. Then you'd go on to showing arguments and parameter passing, and explaining how those work.

I'm not sure what the scope of your tutorials are, but if it's Ruby in general, it'd be best to stay away from the existing scripts and stick to using your own. If you also want to integrate that into RGSS3 and the default scripts, then you can work that in slowly. But by starting from a basic empty script it allows you to introduce different aspects and topics over time, rather than doing all this stuff at the beginning where you are copy/pasting text around (which is a habit you shouldn't teach, because that can lead to problems if you aren't too confidant in scripting/programming).

You can also avoid bringing in things you haven't talked about, like modules and classes, which to a first time user might be raising more questions than you are answering.

If you want something to look at for ideas, you could check out Gubid's tutorials on youtube. He starts off with a few introductory videos, but mostly uses a project based approach, like demonstrating how to write a particular scene like a cooking/crafting script.
(Why do I always feel like it's the end of the world and I'm the last man standing?)

*
? ? ? ? ? ? ? ? ? The nice kind of alien~
Rep:
Level 92
Martian - Occasionally kind
It is interesting actually, I thought the messagebox would try to convert it and return nil, but guess it didn't like it :malson2:
though I'm fairly certain that instance and global variables default to nil if they do not already exist.
I guess since there wasn't a local variable, it tried looking for a method and threw an error, which is also why I like to use parenthesis when calling a method, just so the difference is more easily recognised.

You are indeed on the right track. Local variables have the same syntactic structure as methods so it cannot be sure whether you do mean a local variable or a method.
For instance, class and global variables it can be sure you don't really mean a method so it can default to nil.
Do note that you can have code like:
Code: [Select]
msgbox_p = 42
msgbox_p msgbox_p

Intuitively odd, but definitely worth knowing as it will help you understand how ruby works better.

Btw. I have made a tutorial about regular expresions if you are interested.

*hugs*

P.s. as a funny aside try first to write down what you expect the following code to do, then execute it and see if it matched your expectations:
Code: [Select]
class Test
  def test(boolean = true)
    if boolean == true
      local = 7
    else
      bokal = 9
    end

    msgbox_p local, local()
  end
 
  def local
    42
  end
end

test = Test.new
test.test
test.test(false)

exit
« Last Edit: December 22, 2012, 11:35:06 AM by Zeriab »

*
*crack*
Rep:
Level 64
2012 Best Newbie2012 Most Unsung MemberFor frequently finding and reporting spam and spam bots
Logan - Ack! How silly of me not to use global space right from the beginning, would've made it so much easier. I think I shall redo the first three with that, also including constants, things I didn't touch upon that I probably should have, etc.

Zeriab - My thought was that it would do 7 & 42 the first time then do 42 & 42 the second time, but it resulted in nil ???
I take it the second time around it knew what you wanted and gave you the appropriate results? But hold on, since you don't need the parenthesis shouldn't it have gone to the method anyway? Please elaborate on this for me :D
All of my scripts are totally free to use for commercial use. You don't need to ask me for permission. I'm too lazy to update every single script post I ever made with this addendum. So ignore whatever "rule" I posted there. :)

All scripts can be found at: https://pastebin.com/u/diamondandplatinum3

*
Rep:
Level 82
It did what I expected as I had an idea from the begin. I can't be certain, but I believe that including the parenthesis, despite not having arguments, invokes the method (by priority at the least) rather than the variable. It'd be to do with how Ruby orders priority.

 So my guess would be:

Calling the name with no parenthesis checks local variables first, then methods (and whatever else it might do). With parenthesis, it checks methods first, then variables perhaps. You'd have to try the second by not defining a method with the same name as a local variable.
(Why do I always feel like it's the end of the world and I'm the last man standing?)

*
*crack*
Rep:
Level 64
2012 Best Newbie2012 Most Unsung MemberFor frequently finding and reporting spam and spam bots
Re-upped the first three and did a few more. Looks like it'll be a daily thing :V
All of my scripts are totally free to use for commercial use. You don't need to ask me for permission. I'm too lazy to update every single script post I ever made with this addendum. So ignore whatever "rule" I posted there. :)

All scripts can be found at: https://pastebin.com/u/diamondandplatinum3

*
*crack*
Rep:
Level 64
2012 Best Newbie2012 Most Unsung MemberFor frequently finding and reporting spam and spam bots
I'm kinda running out of ideas :-[
Anything I'm missing before I get into Sprites/Bitmaps?
All of my scripts are totally free to use for commercial use. You don't need to ask me for permission. I'm too lazy to update every single script post I ever made with this addendum. So ignore whatever "rule" I posted there. :)

All scripts can be found at: https://pastebin.com/u/diamondandplatinum3

*
Rep:
Level 82
There's a lot of material you can cover with regards to working with Ruby, it just depends on your overall focus on the tutorials. If the goal is to be able to work on writing your scripts with some basic-intermediate knowledge of RGSS3, then what you have is going in the right direction. If you want to cover more Ruby specifics, then I can think of quite a few.

Suggestion, though. Set the title screen BGM to none. It's a little annoying. Another would be to see about some video editing to zoom in on the script editor. It can be a little difficult to read the code you are writing sometimes.

Also, have you thought of using the console window output rather than message boxes? It might just be me, but I find it easier to read from. The benefit of using it is that the p or puts output can be read and returned to. With a message box, once you've closed it it's impossible to go back to without re-executing the code that called it.

I can go through your videos so far and see if there's any areas I'd want to know more about if I was new to the language. I can already think of a few based on the titles, but the videos themselves might cover those so I will refrain from posting until I'm sure.

One of the big things to cover is string literals and regular expressions. For string literals you have the difference between using double quotes and single quotes.

Also, how to evaluate code within a string (known as interpolation), for example:

Code: [Select]
some_sum = 5 + 5
str = "the value of some_sum is #{some_sum}"
#------
def add_five(value)
  value + 5
end

string = "the result of 10 add five is #{add_five(10)}"
p string

For one difference of single quoted strings, try the above but with those instead of double quotes.

Regular expressions are also something that should be covered for what I hope are fairly obvious reasons.

Fun comment: I can see how much you are used to writing code with C++. You write your code samples in a fairly C++ way.
« Last Edit: January 19, 2013, 01:56:43 PM by LoganF »
(Why do I always feel like it's the end of the world and I'm the last man standing?)

*
*crack*
Rep:
Level 64
2012 Best Newbie2012 Most Unsung MemberFor frequently finding and reporting spam and spam bots
It's really more Scripting based than actual Ruby, there's some pretty good video tutorials for Ruby in general out there, so I don't think I need to go down that alley.
Programming is also something that's self-motivational. I get that it's hard to start up, but once you do you should be good to research what you need on your own, that's what I'm trying here.


I'll keep the BGM since it makes a difinitive statement to me (The code has passed compilation error checking), I should probably change it to something less ear-destructive though :)
Have you been watching them in HD, youtube automatically turns the quality off HD when I try watching them on there, so I need to reset it back to HD, in that regard I've never had a problem seeing anything myself :/


No, no I have not thought of using the console window for this, now I feel a little silly ;9


Go ahead and post your suggestions, doesn't matter if I've covered them or not, I don't expect other scripters to watch them.


So you think strings should be covered next? Sounds good to me :) I'm not doing RegEXP yet though, in my opinion that's really a tad bit advanced. I mean it's easy once you understand it, but it's not something I'd be teaching to people who only watched 20 videos online.


The Code Sample being similar to C++ is really more because I'm switching back and forth frequently between the two, and C++ syntax mostly works with Ruby. It's been really difficult to hold back putting semicolons on everything ;_;
All of my scripts are totally free to use for commercial use. You don't need to ask me for permission. I'm too lazy to update every single script post I ever made with this addendum. So ignore whatever "rule" I posted there. :)

All scripts can be found at: https://pastebin.com/u/diamondandplatinum3

*
*crack*
Rep:
Level 64
2012 Best Newbie2012 Most Unsung MemberFor frequently finding and reporting spam and spam bots
Just Finished the Second Script :)
All of my scripts are totally free to use for commercial use. You don't need to ask me for permission. I'm too lazy to update every single script post I ever made with this addendum. So ignore whatever "rule" I posted there. :)

All scripts can be found at: https://pastebin.com/u/diamondandplatinum3

**
Rep: +0/-0Level 46
Evented AI
Really great job. Your explanations really make sence to me, being a Ruby-Newb.
It really helped me getting started, which in my opinion is the biggest obstacle on the way to learning the basics of any programing language.

A big THUMBS UP (~imagine a "thumbs up" smiley right here~)

pokeball VeeOffline
*
Rep: +0/-0Level 41
Thanks for doing these, it's been helpful since I've decided to get back into trying to learn RGSS and Ruby.

*
*crack*
Rep:
Level 64
2012 Best Newbie2012 Most Unsung MemberFor frequently finding and reporting spam and spam bots
Done a couple more, any scripts or snippets people want to see me make feel free to suggest.
All of my scripts are totally free to use for commercial use. You don't need to ask me for permission. I'm too lazy to update every single script post I ever made with this addendum. So ignore whatever "rule" I posted there. :)

All scripts can be found at: https://pastebin.com/u/diamondandplatinum3

**
Rep: +0/-0Level 46
Evented AI
Hm, I would like to see something about viewports, maybe an explanation of why and how they work or even something like a "acid mode" Script, that makes the screen look really crazy (using viewports) as if the player is high. (not sure if it is really possible in the way I imagine it though :P) Or a few useful tips like why a "imported" hash is nice to have.

*
*crack*
Rep:
Level 64
2012 Best Newbie2012 Most Unsung MemberFor frequently finding and reporting spam and spam bots
Can't really help much with viewports, you'd know just as much as me if you scan'd through the help file for it and tweaked with the available methods you have to use. Can't really think of a way to achieve the 'high' effect with RGSS Viewports the way they are, certainly gives me something to think about though.
On the other hand Imported Hash Arrays is something I can do, it's something I believe is way overused. You'll see why when I explain it.
All of my scripts are totally free to use for commercial use. You don't need to ask me for permission. I'm too lazy to update every single script post I ever made with this addendum. So ignore whatever "rule" I posted there. :)

All scripts can be found at: https://pastebin.com/u/diamondandplatinum3

*
*crack*
Rep:
Level 64
2012 Best Newbie2012 Most Unsung MemberFor frequently finding and reporting spam and spam bots
Updated, Latest Script Included here
All of my scripts are totally free to use for commercial use. You don't need to ask me for permission. I'm too lazy to update every single script post I ever made with this addendum. So ignore whatever "rule" I posted there. :)

All scripts can be found at: https://pastebin.com/u/diamondandplatinum3

*
*crack*
Rep:
Level 64
2012 Best Newbie2012 Most Unsung MemberFor frequently finding and reporting spam and spam bots
Regex is done ;8
All of my scripts are totally free to use for commercial use. You don't need to ask me for permission. I'm too lazy to update every single script post I ever made with this addendum. So ignore whatever "rule" I posted there. :)

All scripts can be found at: https://pastebin.com/u/diamondandplatinum3