Jump to content
Rikifive

[SOLVED] Help Description of Highlighted Commands

Recommended Posts

No, not really. I'm just a little bit exasperated at how three different scripters all came in to help and still couldn't come up with anything neat. Even though this shouldn't have been hard.

 

One of the reasons why I advocate learning to script instead of waiting out for help that may or may not help as much as it should.

Edited by Traverse

Share this post


Link to post
Share on other sites

his screenshot only has 1 line of descriptions in it so you would have to edit the current Window_Help class to change it.

Share this post


Link to post
Share on other sites

That is actually awesome Traverse. I never even realized you can do that. I should review my scripting knowledge, lol. It seems I left out a lot when I stopped opening RPG Maker. There's something more to learn, I guess.

Share this post


Link to post
Share on other sites

Well, the one that Xypher wrote, seems to work perfectly ~ I can move the window, change size, opacity, font and whatever...

BUT if there is something wrong, please let me know.

 

WtvmtpT.png

That's how it looks:

jJmCF9x.png

 

Its appearance is perfect, I'm not complaining about anything.

Edited by Rikifive

Share this post


Link to post
Share on other sites

 

his screenshot only has 1 line of descriptions in it so you would have to edit the current Window_Help class to change it.

 

No, Xypher you don't have to. That's why I opened up the "create_help_window" method even though I didn't have to (as I said in the comments). I called super then, but I could also have done this:

  def create_help_window
    @help_window = Window_Help.new(1)
    @help_window.viewport = @viewport
  end

for a one-line help window.

Share this post


Link to post
Share on other sites

If there is still something wrong or you have any improvements to make it better then let me know.

You see, when I'm writing scripts, of course I'm taking a look to the default ones ~ that's how I created these bars etc. for actor statuses, and I'm going to edit many more things.

BUT there are some things, that I cannot solve by myself ~ I'm not a scripter, never encountered that before so bear with me.

 

WtvmtpT.png

And sometimes it's better to wait for help, than wasting many many many hours on failures etc.. Sometimes things are easier than I expect ~ I'm trying to fix something, spending so much time, then deciding to ask the community... ~ sometimes the solution was just about few lines of script...

 

I'm not a scripter at all ~ I'm doing nearly all the things by myself in my game - to be honest I'm proud of myself, that I managed to 'create' something.

The first time I encountered any scripting is ~3 months ago and that was - you guessed that - In RM.

Edited by Rikifive

Share this post


Link to post
Share on other sites

 

 

his screenshot only has 1 line of descriptions in it so you would have to edit the current Window_Help class to change it.

 

No, Xypher you don't have to. That's why I opened up the "create_help_window" method even though I didn't have to (as I said in the comments). I called super then, but I could also have done this:

  def create_help_window
    @help_window = Window_Help.new(1)
    @help_window.viewport = @viewport
  end

for a one-line help window.

 

ok i have no idea why i thought line number wasn't an argument last night, should not be looking at scripts in a hurry late at night before sleeping.

 

@Rikifive

I would probably go with Traverse's implementation for this one.

Share this post


Link to post
Share on other sites

If there is still something wrong or you have any improvements to make it better then let me know.

 

Well like I said there's not really a "problem" in that their code probably works and does what you want it to do (I haven't tested it). I just don't think it's written neatly. Killo's offering looks like it got taken from a larger script (or set of scripts) and Xypher and Soul both went down the route of making custom help windows that do basically what the default help window already does. Xypher even makes a new "@menu_help_window" instance variable to do what the existing "@help_window" variable is already meant to do and completely ignores the existing "update_help" method (instead using the broader "update" method to update his new custom window).

 

It works, it's just not what would be considered ideal coding practice - it's duplicate/redundant code.

 

And sometimes it's better to wait for help, than wasting many many many hours on failures etc.. Sometimes things are easier than I expect ~ I'm trying to fix something, spending so much time, then deciding to ask the community... ~ sometimes the solution was just about few lines of script...

 

If you don't have the time to learn properly, then yes - you don't have many other options but to get external help. But if you do have the time, from experience spending hours to try and fail before you succeed is usually still quicker than spending days or weeks waiting before you get a reply. It won't always be this fast. And remember, there is also usually something to learn from every failure, failing is not always a waste of time.

 

I'm pretty sure I've said this before, but even if the solution is just a few lines of script, it doesn't mean getting there was easy. Physically writing the code takes minutes. Figuring out what you need to write takes a hell of a lot longer.

 

For example, in what I posted, I used "@command_window.current_data[:symbol]" to refer to the index. How did I know there was something called "current_data" that corresponded to the index and had an element called ":symbol"? I had to look through Window_Command to find out. I did that right then when I wrote that script. It took me a fair few minutes to figure out how it worked and I had to go over just those three lines in "update_help" a few times to get it to work properly.

 

I didn't magically know how to do that. I was originally going to add a reader method to Window_MenuCommand to access its command array if I couldn't find an existing method that could be used (and then I found out that "current_data" existed when I looked).

 

There's nothing magical about scripting. Even if it looks easy on the face, it is hard to tell how much pain might have gone in behind it, especially if you're not familiar with scripting yourself. And even if it seems to WORK like magic, that just means if and when it goes wrong it is probably going to be spectacularly bad and excruciating to debug.

 

So it's fine if you don't have much experience in scripting yet, you'll learn as you go along. My first scripting exposure was with RM too; I still don't consider myself anywhere near an expert. Just be sure you don't start overrelying on the "scripting magic" waved in your face by the people you ask, because there is no such thing. At all.

 

TL;DR - The other scripts are probably fine. I'm just nitpicking. The ease of making a script is, to me, more determined by how hard it is to figure out what you need to do than the number of lines involved. No script is a panacea - the only one who can come up with your perfect solution is you, so it is usually better to be able to read and make minor edits to scripts than have to ask someone and spend time corresponding (and risk miscommunication to boot). Unless your circumstances really give you no other choice.

 

EDIT: And yes, I do still consider adding a help window to the main menu something that should be relatively easy to do seeing as the default code is pretty much all set up for it. Which was why I found it both bemusing and admittedly, twistedly amusing that- well, maybe I was wrong about how easy it was.

Edited by Traverse

Share this post


Link to post
Share on other sites

So... I used your script and added some stuff ~ is everything correct here?

 

 

module COMMAND_DESCRIPTIONS
  COMMAND = {
  :item => "View and use items.",
  :equip => "View and change actor equipment.",
  :skill => "View and use skills.",
  :status => "View actor status.",
  :learn => "Learn new skills.",
  :formation => "Change party formation.",
  :save => "Save the game.",
  :game_end => "Return to title screen.",
  :cancel => "Exit main menu.",
  }  
end

class Scene_Menu < Scene_MenuBase
  
  alias menu_help_window_start start
  def start 
    menu_help_window_start
    create_help_window
  end

  def update_basic
    update_help
    super
  end  
  
  def update_help
    return if @command_window.current_data.nil?
    selected_command = @command_window.current_data[:symbol]
    @help_window.contents.font.name = ["KG Miss Kindergarten"]
    @help_window.contents.font.size = 26
    @help_window.contents.font.bold = true
    @help_window.contents.font.shadow = true
    @help_window.contents.font.outline = true
    @help_window.set_text(COMMAND_DESCRIPTIONS::COMMAND[selected_command])
  end

  def create_help_window 
    @help_window = Window_Help.new(1)
    @help_window.x = -8
    @help_window.y = 443
    @help_window.viewport = @viewport
  end

end

 

 

 

About help - It's not that i'm asking community for help and looking / waiting for help and saying to myself "Ya, why I have to do things if community can do that for me".

After asking I'm still trying to fix that ~ sometimes even successfully. BUT how do I know if my solution isn't a magic but proper solution?

As you did here: If I would figure that by myself and manage it to work ~ you would say it's bad, because I'm not good and that would be messy.

As you can see, now I have a perfectly done help window from dreams and I'm really grateful.

Anyway, I'll be working on this game even more than a year, because it'd be huge... Yes, it is my first game and you can tell me that I'm stupid for working seriously on a first game, but it wouldn't change anything. I'll not learn advanced things like scripting etc by doing silly game.

I have to take care of everything, there is so much work, I can't even wait months for help ~ it's still worth that, as it saves not only my time, but it's actually done correctly. Without the help of the community I still would have many problems ~ they helped me a lot during that process.

I don't care if they did magic of not, I'm doing magic all the time, so I'm not better than anyone...

 

... Hmm.. Why we are talking about help? If that would be really that bad and not worth it, I wouldn't ask for help. We're kinda getting off topic with it. Don't get me wrong, I really appreciate the help you gave me, and look at that - You did great job with helping me, thank you.

Share this post


Link to post
Share on other sites

Now wait a minute, where did I say you were stupid for working seriously on your first game? Or that those other scripts were "bad"? I said they weren't neat or probably not ideal programming practice, but not that they were bad. Even if I had, that's subjective and what is bad to me might not necessarily be so to somebody else.... and anyway, criticism is something every developer has to deal with at some point.

 

What I was mainly trying to get across was to remember not to overrely on community/external help. That's "overrely", not just "rely". And no, I can't tell you where that line gets drawn, it's different for everyone. And of course, learning to script/program always helps.

 

See, here's an example - you just asked me whether your edits were "correct". "Correct" here would depend entirely on context and what you were trying to achieve. Which was one of the other things I was trying to get across - I don't know your aims, only you do.

 

If your objective by those edits was just to make the help window font display in a certain way all the time, then yes, it seems like a step in the right direction. If you were trying to optimize the code, then perhaps not, since you're running those methods every frame under "update" when you could just run it once under "create_help_window" (unless the font resets itself every update, which I don't believe it normally does, but I might be misremembering). 

 

But I don't know precisely what you're trying to achieve - only you do. And you could always make changes to whatever you decide, anyway. When you know how to script, you can make things exactly how you want. Otherwise you have to post up pictures and text and hope your helpers can work out what you're asking for.

Share this post


Link to post
Share on other sites

I also didn't say that you said, that i'm stupid. Perhaps with the 'bad' scripts I gone too far.

All that mess was created in hurry, because I had some urgency.

 

As for the text, I simply wanted to change its font and stuff nothing else.

I moved these lines to where you pointed me, thanks.

 

If I can, I'm really trying to figure out things by myself, but it's sometimes too much.

 

Sorry if what I said was harsh-y. I didn't meant to insult you in any way.

 

And of course, besides whining I wanted to thank you for clarifying stuff and helping me. =)

Edited by Rikifive

Share this post


Link to post
Share on other sites

 

I moved these lines to where you pointed me, thanks.

 

Hey, hey, this is one of the reasons I told you not to expect magic from other people - they're not always gonna be right!

 

I just double-checked that myself and as it happens I DID misremember and the font DOES reset every time "draw_text_ex" is called (well, the size, italics, emboldening and color does).

 

Which means that you really do actually need to put those in the update method if you want the changes to stick... except there's no point changing the help window's contents bitmap's font, since that will just get reset when "set_text" is called to draw the text before the text is drawn. You need to change the default font settings (the ones that go Font.default_size and Font.default_bold, ect.) in order to get them to apply - when "draw_text_ex" resets the font, it resets them to the defaults from the Font module, so if you change the defaults before it calls the reset, the method will reset the contents' font to whatever you changed the defaults to.

 

Then you'll probably want to change the defaults back to what they were, otherwise everything else will get drawn with the same font settings.

 

Example:

def update_help
    return if @command_window.current_data.nil?
    selected_command = @command_window.current_data[:symbol]
    Font.default_italic = true # Makes the next thing to be drawn use italics.
    @help_window.set_text(COMMAND_DESCRIPTIONS::COMMAND[selected_command])
    Font.default_italic = false 
    # Turns off italics, otherwise whatever else is drawn next will be italicized too.
end
Edited by Traverse

Share this post


Link to post
Share on other sites

I noticed kinda weird behaviour ~ it changes font setting after opening the window for the second time ~when you for the first time open the menu, the font isn't changed...

 

Uh... What exactly is the difference here? It worked perfectly before ~ is there any 'hidden' thing that I don't know?

Share this post


Link to post
Share on other sites

Just to comment about the help and the scripting part. Rikifive, its good that you look at the scripts and try to make solution. Some scripter told this to me before, that the best way to learn the scripting process is just to look at how the scripts from default (the default scripts) and then trying to make something out with it. I think that is what exactly what Traverse did though, as he looked into the scripts in problem and made the simplest and for me, the best approach.

 

My approach is truly not neat and definitely not the best solution out there, but the reason I did that was because it was the limit of my knowledge and a solution I thought of that achieves a solution to your problem. Getting critiques or getting opinions from others always helps to get you better too. 

Share this post


Link to post
Share on other sites

I didn't said, that I'm upset/ungrateful ~ sorry if that sounded like that.

I know, that the best solution is to looking on default scripts, that's what I'm doing always, but my scripting skills are as high as snail's jump and sometimes I cannot find the solution. I'm never asking for help, before trying many things. Well I'm still learning and I hope I'll get only better, sorry for asking these questions now.

Even if I'd found the solution - I'm sure i'd be that 'magic scripting' and it wouldn't be neat, but messy.

 

Finding things is different than placing them correctly and setuping that properly, I still kinda don't get these modules and refreshes and stuff. I'm only good at maths, so when it comes to make 'dynamic' positions, lengths etc. then after some time I'll do that < and I like it, because it's simple and fun.

 

I got criticism about 'my scripting knowledge' few times now, and it's okay ~ I'm not a scripter, well I tried, good to know what I did wrong ~ If I'm doing something and see that even working, but not perfectly, because I would be not sure about few things, then there's no point in trying, when 'my attempt' would just create a mess.

 

I'll better stop creating these wall of texts...

TL;DL - I'm not smart at scripting, I'm creating messy scripts, it's always worth to ask for help from more experienced people. Sorry if my asking for help is annoying etc. I'm really trying, before asking for help. And of course, thank you all for help and your time.

Edited by Rikifive

Share this post


Link to post
Share on other sites

I know this topic is already resolved, but I can't help but throw my hands up in exasperation when I look back at all of the answers that have been given for a problem that, really, is this:

 

...

 

easy to write a solution to. Seriously guys? Whole new custom help windows? New Game_System variables? Overwriting Window_MenuCommand? Really?

 

The only thing I didn't do here was adjust the dimensions of the windows to make space for the help window, but I'm sure you guys all already know how to do that.

 

EDIT: And before anyone asks, yes - this extremely simple modification to Scene_Menu WILL work with custom menu commands too. All you need to do is add a new key to the hash corresponding to the symbol of the custom command. But I'm sure you could work that out by reading the code.

 

The version I made was made to be something a lot more broad and generic. I mean I kinda thought anyone who wanted menu help on one menu might want it on all menus. But it was not made with the main menu in mind. I thought my version should work perfectly well if the main menu is given a help window, but I guess it needs more fiddling? I honestly never tried it myself. I basically do the same thing you are with the hashes only include extra logic for skill menus, I just expect the help window to already be there. Using Window_MenuCommand is just so I can set the menu help when commands are selected automatically.

Share this post


Link to post
Share on other sites

Yeah, Killo yours works fine (leaving aside from the fact that you didn't put any keys for the main menu commands into the hash, but I guess that should be up to the user too). It just seemed like it originally came from a script trying to modify the skill system not the MenuCommand window, what with all the skill window-specific code and the "Scene_LearnSkill" and "passive skills" thing.

 

Like I said, they probably all work fine and I was just nitpicking.

 

 

I noticed kinda weird behaviour ~ it changes font setting after opening the window for the second time ~when you for the first time open the menu, the font isn't changed...

 

I can't help you with this one. I'm not getting the same problem. This why even writing messy code can be better than getting something slick from somebody else - if you wrote it yourself, you know exactly what you did and can tackle the problem more easily.

 

This could be caused by any number of things. You could be having a conflict with another script you have installed. You could have inserted the font-changing methods below the "set_text" method. It could be both.

 

If you're really trying to solve problems like these before asking, then that's good - keep that up. Just make sure it doesn't get to the point where you completely give up on trying to get "smart" at scripting and only ask other people for help, because that would probably be the point where you're overrelying (and I'm not saying you are; the only one who can judge that is you - I'm just giving you advice in advance).

 

Ideally, you would know exactly what it is that you're getting from your helper. Sometimes that may be difficult, but the script I put up was only about 40 lines (including the hash). It shouldn't be hard to read through. If you have a compatibility issue, you should be able to find it pretty easily.

Share this post


Link to post
Share on other sites

Yeah, Killo yours works fine (leaving aside from the fact that you didn't put any keys for the main menu commands into the hash, but I guess that should be up to the user too). It just seemed like it originally came from a script trying to modify the skill system not the MenuCommand window, what with all the skill window-specific code and the "Scene_LearnSkill" and "passive skills" thing.

 

Like I said, they probably all work fine and I was just nitpicking.

Yeah, I had it configured for my test game where I use lots o other scripts... I actually removed a lot of men settings before posting it here. Mostly the skill stuff was for skill categories though.

Share this post


Link to post
Share on other sites

The previous version worked perfectly ~ but you told something about changing the font every time...

Hmm.. So.. Is that bad or I can leave it as it was before? Everything was fine anyway.

(I have many many many scripts, so some incompatibility would be very likely. I just want to change the font in this window, nowhere else.)

Edited by Rikifive

Share this post


Link to post
Share on other sites

Well, do you use yanfly's message system at all? I noticed I added something at the bottom of my script to reset the message window if it is installed, probably to fix that exact thing. Maybe it effects more then yanfly's message system though?

Share this post


Link to post
Share on other sites

(if that qestion was to me) I'm using YANFLY_Ace Message System and YANFLY_Ace Menu Engine and lots of other scripts, so yup ~ incompatibility etc. could be possible.

Share this post


Link to post
Share on other sites

(if that qestion was to me) I'm using YANFLY_Ace Message System and YANFLY_Ace Menu Engine and lots of other scripts, so yup ~ incompatibility etc. could be possible.

 

Oh then try using this:

 

 

if $imported && $imported["YEA-MessageSystem"]
 
  class Window_Help < Window_Base
    
    alias window_help_initialize_ams initialize
    def initialize(line_number = 2)
      window_help_initialize_ams(line_number)
      setup_message_font
    end
    
  end
 
end

Share this post


Link to post
Share on other sites

The one Traverse gave me works perfectly, so I'll stick to that one. =P

~ Don't get me wrong. =P

Share this post


Link to post
Share on other sites

I just mean that little part can fix your font problem I think.

Share this post


Link to post
Share on other sites

Perhaps it would work =P Thanks for helping though. =)

Edited by Rikifive

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted