Joined
Aug 12, 2012
Messages
164
Reaction score
79
First Language
English
Primarily Uses
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 edited by a moderator:

vindaca

CEO of Tales of the Valiant
Veteran
Joined
Dec 11, 2012
Messages
534
Reaction score
77
First Language
English
Primarily Uses
Out of all the times I've watched each one, I didn't relize till now how many videos you've done. :thumbsup-left: :D
 

mrthree

Villager
Member
Joined
May 20, 2012
Messages
7
Reaction score
0
First Language
indonesian
Primarily Uses
Please add more tutorial for intermediate level scripting :)
 

XinChao

Veteran
Veteran
Joined
Jun 11, 2012
Messages
117
Reaction score
3
Primarily Uses
I am looking for some type of vidoe like this but can you make tutorial from 1-3 screen larger to HD clearer like other tutorials later so I can see.
 
Last edited by a moderator:

Pugh95Bear

Veteran
Veteran
Joined
Nov 11, 2013
Messages
191
Reaction score
12
First Language
English
Primarily Uses
It's good that you have these, but can you maybe put the videos in spoilers? Having so many videos to load like this causes a bit of a lag issue, at least on Tapatalk. Like... the title of the tutorial above each spoiler, and then just hide the video in the spoiler. This should help in organization, too.
 
Joined
Aug 12, 2012
Messages
164
Reaction score
79
First Language
English
Primarily Uses
Please add more tutorial for intermediate level scripting :)
When I feel motivated again ;)
I am looking for some type of vidoe like this but can you make tutorial from 1-3 screen larger to HD clearer like other tutorials later so I can see.
Unfortunately you're stuck with the lower scale.
It's good that you have these, but can you maybe put the videos in spoilers? Having so many videos to load like this causes a bit of a lag issue, at least on Tapatalk. Like... the title of the tutorial above each spoiler, and then just hide the video in the spoiler. This should help in organization, too.
I'd prefer that if you were to watch these, you'd do so on a PC whilst RPG Maker is open and ready to use.
Links here do not/should not become outright video attachments. Should you see the post without a browser/plugin which makes this happen, I'm positive you'd agree the current layout is about as organised as it's going to get.
 

Kurisu

game dev, pilot, cat lover
Veteran
Joined
Aug 14, 2013
Messages
77
Reaction score
18
First Language
non-english
Primarily Uses
This is pretty awesome! Thank you :) I'm definitely going to check them out.
 

XinChao

Veteran
Veteran
Joined
Jun 11, 2012
Messages
117
Reaction score
3
Primarily Uses
Ok I am on Tutorial 24, I understand everything. Here some suggestions to make tutorials easy to follow.

When you demonstrate the code if it works as it is supposed to, you could delete the code that not relevant or relate to the one you want to demonstrate.

For example, in Tutorial 24 when you demonstrate the method Relevance Called in module you could delete the method Hooray before that, will make it easier to follow.

Second, when you introduce the new content for example Alias in chapter 17, it will be easier to follow if you delete other irrelevance code in the previous tutorials to make it easier for us to stay focus on that new content.

Anyway, your tutorial are really helpful. I wanted to learn some scripting but dont know where to start. I picked up some Ruby books, read them and understand all the things but still dont know how to make simple script for my game. Same here, I watched your tutorials, understand everything but dont know what to write neither. 
 

XinChao

Veteran
Veteran
Joined
Jun 11, 2012
Messages
117
Reaction score
3
Primarily Uses
On Tutorial 40, just scarified my weekend Thanksgiving for that, I am working on my first script right now, however I run into a few problems.

I created a custom scene but can't return to the previous window with the script inherited from Scene_MenuBase. The script below I did not close the class because there are more scripts in it.

class My_Custom_Scene < Scene_Base

  #--------------------------------------------------------------------------

  # * Start Processing

  #--------------------------------------------------------------------------

  def initialize

    super

    @my_scene = My_Custom_Class.new()

   @my_scene.set_handler:)cancel,   method:)return_scene))

  

  end

 
I can do the way you show in the tutorial input trigger? to return to previous window. I just wondering why the bold line does not work on my custom scene but it works on other Scenes status, item.

The second problem i have is when accessing elements in array. 

class My_Custom_Class < Window_MenuStatus

  def initialize

      super(0, 0)

    end

 

    def draw_item(index)

    actor = $game_actors[index]

    rect = item_rect(index)

    draw_item_background(index)

    draw_actor_face(actor, rect.x + 1, rect.y + 1)

    draw_actor_simple_status(actor, rect.x + 108, rect.y + line_height / 2)

  end
Basically, I am trying to pull actors in database and put it on my custom scene. I copied the code in  Window_Status and change the line where actor = $game_party.member[index] to $game_actors[index]

Also, I got a few more questions; what is the different between def initialize and def start? they both seem do the same thing. Another question about the methods. I can't seem to grasp the whole thing. For example this piece of code

def draw_actor_face(actor, x, y, enabled = true)

    draw_face(actor.face_name, actor.face_index, x, y, enabled)

  end
The first method draw_actor_face, I understand that method take 4 parameters, then it pass to the draw_face that takes another 5 more parameters. So when I want to put in the values, I have to pass the value in draw_actor_face method, I can't pass the values in draw_face method right?

Other than that you have made awesome tutorials for beginner scripters. I think many future scripters/programmers graduate from your tutorials online without the need going to school crap, waste time and money.

If ever mastered programming whoever ask me where do I learn, DiamondandPlatinum3 youtube rpgmakervx  :) . Though, I have no intention do programming or making game for living, these stuffs merely passion.
 
Last edited by a moderator:
Joined
Aug 12, 2012
Messages
164
Reaction score
79
First Language
English
Primarily Uses
There are several things here. Firstly which Window are you inheriting from? Window_Selectable/Window_Command

What are you doing in your update method? Are you using the super keyword?

Is the command_window actually being updated? It won't cancel for you if it isn't being updated.

If all that fails you'll need to show me the code you're using for your CustomCommandWindow.

Another note, after adding the class, perhaps you should activate the window.

class My_Custom_Scene < Scene_Base #-------------------------------------------------------------------------- # * Start Processing #-------------------------------------------------------------------------- def initialize super @my_scene = My_Custom_Class.new() @my_scene.activate() @my_scene.set_handler:)cancel, method:)return_scene)) endend~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You have stated to me that you have a problem, but didn't tell me what the problem was.

What is wrong with the code you're using?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The difference is that 'initialize' is a default method in Ruby that gets called when you assign a new instance of a class to a variable.

EG. @timer = Timer.new. The 'initialize' method located inside of the Timer class will be called as soon as this code happens.

The start method is a user defined method created by the Programmer(s) at Enterbrain to occur when you go to a new scene.

class Scene_Base #-------------------------------------------------------------------------- # * Main #-------------------------------------------------------------------------- def main start post_start update until scene_changing? pre_terminate terminate endendAs you can see, this is for Scene Classes. Should you use the start method in any class that isn't used as a Scene class, the start method will not work at all like the initialize method.~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You most certainly CAN just use the draw_face method is you wish. The draw_actor_face method is merely a wrapper... code that is designed to allow you to access other code easier.

In this case, you just pass in the actor instance to the 'draw_actor_face' and it passes in the face_name and face_index directly into the 'draw_face' method. Meaning less code for you to write.

However should you wish to, you may just as easily avoid the wrapper and use the target method.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Thank you :)
 

XinChao

Veteran
Veteran
Joined
Jun 11, 2012
Messages
117
Reaction score
3
Primarily Uses
Ok, now I am able to return to previous screen after activate my scene. Care to explain?

====================================

You said I can use the draw_face method? However, if you look at the draw_face method in side draw_actor_face, it has the argument that requires you to pass the value in the draw_face method first.

def draw_actor_face(actor, x, y, enabled = true)

    draw_face(actor.face_name, actor.face_index, x, y, enabled)

  end
That is where confusion comes from. In other words, I dont understand how you can use the draw_face method without access draw_actor_face because they seem dependent.
======================================

The problem I have is in this script.

class My_Custom_Class < Window_MenuStatus

  def initialize

      super(0, 0)

    end

 

    def draw_item(index)

    actor = $game_actors[index]

    rect = item_rect(index)

    draw_item_background(index)

    draw_actor_face(actor, rect.x + 1, rect.y + 1)

    draw_actor_simple_status(actor, rect.x + 108, rect.y + line_height / 2)

  end
You see the line I bolded? That is the def I copied from Window_StatusMenu, I only changed the line I bolded from $game_party.member to $game.actors. I was trying to make a scene that will pull out a list of all actors in database and display them on screen and able to select them
 
Last edited by a moderator:
Joined
Aug 12, 2012
Messages
164
Reaction score
79
First Language
English
Primarily Uses
First, may I suggest using more appropriate variable names in the future.

'@my_scene' makes me think you're referring to a Scene type class instead of a window; I spent a good minute bewildered in confusion.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

If that new line of code managed to make the system work, that is because you have been using Window_Selectable as a base_class instead of Window_Command.

class Window_Selectable < Window_Base def initialize(x, y, width, height) super @index = -1 @handler = {} @cursor_fix = false @cursor_all = false update_padding deactivate endend
Code:
class Window_Command < Window_Selectable  def initialize(x, y)    clear_command_list    make_command_list    super(x, y, window_width, window_height)    refresh    select(0)    activate  endend
As can be seen, the Command Window Activates itself automatically. The Selectable Window in turn does the opposite.The activation problem on your end does one simple thing:

If a window is not active, it means it doesn't update. If it doesn't update, it means it doesn't catch your :cancel request.

By activating it, it will now catch your requests.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Except it's not dependent; not at all. It is as I said earlier, a wrapper.

Let me give you an example. You use this code here to draw a face:

class My_Custom_Class < Window_MenuStatus

def initialize

super(0, 0)

end

def draw_item(index)

actor = $game_actors[index]

rect = item_rect(index)

draw_item_background(index)

draw_actor_face(actor, rect.x + 1, rect.y + 1)

draw_actor_simple_status(actor, rect.x + 108, rect.y + line_height / 2)

end
Now all you have to do is replace that line with:

class My_Custom_Class < Window_MenuStatus

def initialize

super(0, 0)

end

def draw_item(index)

actor = $game_actors[index]

rect = item_rect(index)

draw_item_background(index)

draw_face(actor.face_name, actor.face_index, rect.x + 1, rect.y + 1, true)

draw_actor_simple_status(actor, rect.x + 108, rect.y + line_height / 2)

end
And now I've avoided the wrapper method altogether. As I stated, it's not necessary to use. However it would have been easier to use the 'draw_actor_face' method rather than manually pass in those extra arguments myself.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

And what is your issue with that? All you've told me is that you've modified one line of code.

What happens?

Do you get an error? What is the error saying? is it referencing something about a nil object?

Does it not do as intended?

Does it not give you the right actor you want for it to?

Does a monster pop out of your monitor and shout "a-bloogy-woogy-woo"?

I can't assist you if you don't specify your problem. Because there is nothing I can see wrong with that code as far as functionality is concerned.
 
Last edited by a moderator:

TroyZ

The Slayer
Veteran
Joined
Jun 18, 2013
Messages
74
Reaction score
5
First Language
Indonesian
Primarily Uses
RMVXA
*mobile mode typing

nah this is the most useful tutorials of RGSS3 that i found. simple but effective because of using video. thanks a lot DP3 :D you really make my day of scripting since May 2013. i just need to learnt it for only two weeks and voila, easy level scripts were completed at that time. :D
 

XinChao

Veteran
Veteran
Joined
Jun 11, 2012
Messages
117
Reaction score
3
Primarily Uses
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

And what is your issue with that? All you've told me is that you've modified one line of code.

What happens?

Do you get an error? What is the error saying? is it referencing something about a nil object?

Does it not do as intended?

Does it not give you the right actor you want for it to?

Does a monster pop out of your monitor and shout "a-bloogy-woogy-woo"?

I can't assist you if you don't specify your problem. Because there is nothing I can see wrong with that code as far as functionality is concerned.

I got "undefined method 'face_name' for nil:NilClass. I think I stil not gasp the idea of wrapper, and values passing among methods. I understand the simple concept of value passing between one or two mehod and, variables....etc. however when it became more complicate involve many methods, classes, modules I get lost. Do you think you can put up a demo demonstrate value passing among methods class ...etc. and how extract data in the array using various kind of loops or whatever techniques to extract data,Would be very helpful. Thanks.

Sorry, did not response sooner, only have some time in the weekend for programming and RPGmaker.
 
Joined
Aug 12, 2012
Messages
164
Reaction score
79
First Language
English
Primarily Uses
if your issue is only that the value is nil. You simply just need to check for that.

The following checks if the variable is equal to something, and will pre-emptively leave the method if it is not.

def draw_item(index)

actor = $game_actors[index]

return if actor.nil?

rect = item_rect(index)

draw_item_background(index)

draw_face(actor.face_name, actor.face_index, rect.x + 1, rect.y + 1, true)

draw_actor_simple_status(actor, rect.x + 108, rect.y + line_height / 2)

end
As for the loops and techniques. The only one I can think of to help you in this case that I haven't done already would be the .compact method for an array.

Read what it does here, as I think it explains it better than I could here.

Pretty much, it removes nil data from an array.

I'd wager that your nil issue is because the 'index' variable is starting at zero, and there is no Actor that is located at $game_actors[0].

So if your were to compact that, the $game_actors array would go from:

$game_actors{ 0 => nil, 1 => <{Game_Actor}>, 2 => <{Game_Actor}>,}To
Code:
$game_actors{    0 => <{Game_Actor}>,    1 => <{Game_Actor}>,}
See?! No nil Elements.Now in your code, I would simply put

Code:
def draw_item(index)  actor = $game_actors.compact[index]  rect = item_rect(index)  draw_item_background(index)  draw_face(actor.face_name, actor.face_index, rect.x + 1, rect.y + 1, true)  draw_actor_simple_status(actor, rect.x + 108, rect.y + line_height / 2)end
And so long as your Index variable is working within bounds, that'll all work just fine.
 

XinChao

Veteran
Veteran
Joined
Jun 11, 2012
Messages
117
Reaction score
3
Primarily Uses
You right about the "nil" index as I set $game_actors[2], it does show up the actor in database. The compact method does not work in RGSS3 I get undefined method compact. I think RGSS3 does not support that method

Are there any other way to extract an array and minus the index [0]. If possible can you put up a demo of extracting array and value passing among classes, methods, wrapper, placeholder...etc. One more thing I think it would be helpful if you can explain the calculation in the demo.

For example this script.

rect.x = index % col_max * (item_width + spacing)

 rect.y = index / col_max * item_height
It's easier to understand if they all are numbers instead of variables because each of the variable hold some value and I do not know the actual value in there. That 's why I was requesting a demo of value passing and array extraction, because I still can't seem to gasp the whole concept. Though I understand the basic concept, and understand all you tutorials.
 
Last edited by a moderator:
Joined
Aug 12, 2012
Messages
164
Reaction score
79
First Language
English
Primarily Uses
RGSS3 does work with the compact method. It didn't work in this case because $game_actors is not actually an Array. My bad, I completely forgot.

Add the following anywhere in your scripts database:

class Game_Actors def compact @data.compact endendAnd there, now you can use the compact method with $game_actors.If you don't know the value of something, that's when you start using either:

msgbox_p( variable )orp( variable )You say it's easier to understand if you know what the numbers are; so here is your way of finding out :) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I wouldn't even know where to begin making a demo for what you're asking.
 
Last edited by a moderator:

XinChao

Veteran
Veteran
Joined
Jun 11, 2012
Messages
117
Reaction score
3
Primarily Uses
For the tutorial, I think most newbie having problem with understanding how classes, methods, modules talk to each other, and how to extract values in Array and Hash. Take a look at this code for example.

def draw_item(index)
actor = $game_actors.compact[index]
rect = item_rect(index)
draw_item_background(index)
draw_face(actor.face_name, actor.face_index, rect.x + 1, rect.y + 1, true)
draw_actor_simple_status(actor, rect.x + 108, rect.y + line_height / 2)
end 
As you can see there are 5 methods inside a method, you said it is wrapper right. How do these methods talk to each other and beyond? What does the draw_item method/wrapper does.

I will post more examples code which confuse me and I think many newbie do have common problem. You can then put them all into a tutorial demo.

------------------------------------

One more thing about the code above, it only display 3 actors in the database instead of all. There must be a loop some where to limit the number of actors to 3.
 
Last edited by a moderator:

vindaca

CEO of Tales of the Valiant
Veteran
Joined
Dec 11, 2012
Messages
534
Reaction score
77
First Language
English
Primarily Uses
The method wrappers are...

def draw_item(index)end 
Everything from the def draw_item(index) to the end is the method itself.
 
The (index) takes in the id or index variable of the actor it is drawing the item for.  That variable.is passed by another method much like...
 

draw_face(actor.face_name, actor.face_index, rect.x + 1, rect.y + 1, true) 
This is another method and the values it is being passed are (face_name, face_index, x, y, and the last is a Boolean variable) that tells the method if the face should have a dark tint to it.(which is handled by that method.)
 
The reason it is only displaying the number of characters it does has nothing to do with this method. Remember the Boolean variable called "index" inside of the ()'s. That variable is being pass into the variable (or array) to reflectance 1 particular actor in this case index
 

actor = $game_actors.compact[index] 
 
Honestly as someone who has learn a great deal watching D&P3's rgss3 tutorials. Just watch his videos a few times and don't forget to take notes. A lot of people forget because they are on a computer but, a pen and paper won't hurt. Whatever the case Good Luck it is a rough path.
 
Last edited by a moderator:

Latest Threads

Latest Posts

Latest Profile Posts

A woman gave me her number without me even asking for it. Then she left because she had other patients to see.
oh, hey, I forgot about all this!

my old project got abandoned after I started working too much on stuff I'd already worked on - plus, starting to hate the story I wrote for it. Then, well, a lot of serious life **** went down. I ended up moving across the country, cutting off some people, etc. - **** was rough.

So, uh, I guess I'm back for now? Funny how things work.
I'm glad I'm sticking to my guns on having fighting game mechanics in my game, from what I've read, it's not for everyone. but for the most part, I've made it so you don't have to use them motion inputs for attacks if you don't want to.
And my project's just entered the Lunar New Year Sale 2022... Let's see if it reaches it's goal of $ 7,77.
Ohmygoodness I played Dicey Dungeons for the first time last night. Gave me SO MANY IDEAS for how to fix Heidi.

Forum statistics

Threads
118,726
Messages
1,118,252
Members
155,875
Latest member
snool_
Top