Ruby/RGSSx questions that don't deserve their own thread

Zalerinian

Jack of all Errors
Veteran
Joined
Dec 17, 2012
Messages
4,696
Reaction score
935
First Language
English
Primarily Uses
N/A
Oh yea, for the #{} its gotta be in a double quotation or it just wont show. Sure I have tried pulling that one (and failed) in the past :D

Can also do something like this...

    /#{some_text_variable}/i =~ "Some_text"
Yes, there's also an option in regexes (plural form?) to only do substitutions once, like if you're checking things in a loop. I personally have never used it like that, but according to rubular, the 'o' option (i.e. /<regex>/imxo) will only perform #{...} substitutions once. 
 

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,517
Reaction score
3,221
First Language
Binary
Primarily Uses
RMMZ
Would 'Regexps' not be the correct plural for Regular Expressions? <- not really relevant though :D
 

That sounds quite handy - if your into your regexp && loops.

Personally, I have only used regexp for notetags and name checking before, and never in a loop. But yea, I can see how that would be more efficient within a loop :)
 

Milena

The woman of many questions
Veteran
Joined
Jan 26, 2014
Messages
1,281
Reaction score
106
First Language
Irish
Primarily Uses
N/A
Is it possible to save different portions of the gameplay but only of one saved file?
 

Neok

Veteran
Veteran
Joined
Jul 31, 2014
Messages
45
Reaction score
15
First Language
English
Primarily Uses
Ah, so there's actually many ways to handle bringing in double quotes. Awesome, thanks everyone!

Does the first part work?
Yes! It took some time for me to figure out the syntax, but I think I know what I'm doing now.

Is it possible to save different portions of the gameplay but only of one saved file?
What do you mean? Describe exactly what you want to do.
 

DRS

Veteran
Veteran
Joined
Aug 10, 2014
Messages
67
Reaction score
6
First Language
English
Primarily Uses
I'm wanting to implement XAS Hero in a current project, but the I'm having some trouble with the site. http://xasabs.com/submit/ None of the links appear to be working. I was just wondering if anyone else is having this problem.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,108
Reaction score
13,713
First Language
English
Primarily Uses
RMMV
Not really a question for this thread, is it?


Milena, not sure what you're asking. You can't save "different portions of the gameplay" - you save the game in its current state, and that's it. Are you asking how to allow just a single save file? Look in DataManager for the savefile_max method, and change 16 to 1.
 

Milena

The woman of many questions
Veteran
Joined
Jan 26, 2014
Messages
1,281
Reaction score
106
First Language
Irish
Primarily Uses
N/A
Hmmm I am asking if its possible to save different parts in one saved file. To explain further, say for my example my game has a 20 minute gameplay, I saved between 10 minutes of the game, however, I want two different saved contents, so I saved the other one on File 1, the other 10 minutes on File 2. However, the saved file that should be only created on the game folder is only 1. It means that that 1 Saved File contains two saves.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,108
Reaction score
13,713
First Language
English
Primarily Uses
RMMV
No. That's what save files are - one save file is one game. If you play 20 minutes, your second save file is going to contain the full 20 minutes, not just the last 10.


I am not sure why you'd want a save file to only contain what happened since the last time you saved - you still need all the switches, variables, actors, items, etc there were in the first 10 minutes of the game, after your 10-minute save.
 

Milena

The woman of many questions
Veteran
Joined
Jan 26, 2014
Messages
1,281
Reaction score
106
First Language
Irish
Primarily Uses
N/A
Perhaps I was thinking much about it. Basically, I just want a save file that contains different progress of my game as one :o
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,108
Reaction score
13,713
First Language
English
Primarily Uses
RMMV
For what purpose? That is the whole reason we have multiple save slots - so you can save your game at different points without overwriting.


It sounds like what you're wanting is to be able to have multiple saves, but all in a single save file. In that case you'd need to modify the way they're saved and loaded, and also write a new scene to let you choose which "version" to open from a save file. It's also going to result in a VERY big save file.


I'm struggling to see what benefit it could have over the current method of multiple slots.
 

DRS

Veteran
Veteran
Joined
Aug 10, 2014
Messages
67
Reaction score
6
First Language
English
Primarily Uses
Not really a question for this thread, is it?

Milena, not sure what you're asking. You can't save "different portions of the gameplay" - you save the game in its current state, and that's it. Are you asking how to allow just a single save file? Look in DataManager for the savefile_max method, and change 16 to 1.
I kind of thought that would be a scripting question that didn't deserve it's own thread. Where should I have put it?
 

DRS

Veteran
Veteran
Joined
Aug 10, 2014
Messages
67
Reaction score
6
First Language
English
Primarily Uses
I'm just asking because I'm not sure. I've actually resolved the issue I had already.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,108
Reaction score
13,713
First Language
English
Primarily Uses
RMMV
DRS, please avoid double posting, as it is against the forum rules. You can review our forum rules here. Thank you.


If it's a resource you're after, you would post in the Resource Requests forum. If you're trying to get hold of a script, it would go into the Script Requests forum for whichever maker you're using. Or in other words, you are having problems with a site, not with a script, so it doesn't go into Ruby/RGSSx Questions :)


This topic is if you are trying to get something working in a script you already have and just need a few tips. It's also not the ideal place to post "how do I ..." questions or ask for help with custom scripts that you've downloaded and can't get working - those would go into their own topic in this forum, as they often require a bit more back and forth than the "quick/easy" questions that this thread is intended for.


Hope that helps. We do know new members will take a bit of time to find their way around.
 
Last edited by a moderator:

Milena

The woman of many questions
Veteran
Joined
Jan 26, 2014
Messages
1,281
Reaction score
106
First Language
Irish
Primarily Uses
N/A
For what purpose? That is the whole reason we have multiple save slots - so you can save your game at different points without overwriting.

It sounds like what you're wanting is to be able to have multiple saves, but all in a single save file. In that case you'd need to modify the way they're saved and loaded, and also write a new scene to let you choose which "version" to open from a save file. It's also going to result in a VERY big save file.

I'm struggling to see what benefit it could have over the current method of multiple slots.
I want to learn how for my learning purposes, or probably how to make something like Memory Cards.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,108
Reaction score
13,713
First Language
English
Primarily Uses
RMMV
Honestly, I think "for learning purposes" there would be far better things to try and do. If you are determined to attempt this, I suggest you create a new thread as it is not going to be quick OR easy, and you will need a lot of help (as evidenced by how many posts this has taken up already just in defining what you are trying to do and why)
 

Milena

The woman of many questions
Veteran
Joined
Jan 26, 2014
Messages
1,281
Reaction score
106
First Language
Irish
Primarily Uses
N/A
Thanks, I'll do that. By the way Shaz, the user.equips doesn't work. What I wanted to do was to check the note tag of the user's equipments in the make_damage_value from Game_Battler.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,108
Reaction score
13,713
First Language
English
Primarily Uses
RMMV
Show me what you've got, because the statement you had previously was wrong. If it gives you an error, you should ALWAYS say what the error is (the exact and full text) - otherwise we're just guessing.
 

Milena

The woman of many questions
Veteran
Joined
Jan 26, 2014
Messages
1,281
Reaction score
106
First Language
Irish
Primarily Uses
N/A
class Game_Battler < Game_BattlerBase #-------------------------------------------------------------------------- # * Calculate Damage #-------------------------------------------------------------------------- def make_damage_value(user, item) value = item.damage.eval(user, self, $game_variables) value *= item_element_rate(user, item) value *= pdr if item.physical? if item.magical? if user.is_a?(Game_Actor) user.equips.each do |equip| value *= $data_weapons[equip.id].mag_critical_value + $data_armors[equip.id].mag_critical_value end else value *= mdr end end value *= rec if item.damage.recover? value = apply_critical(value) if @result.critical value = apply_variance(value, item.damage.variance) value = apply_guard(value) @result.make_damage(value.to_i, item) endendmag_critical_value is a method I made to read the value of:

<magical_attack: 90000> or any value under magical attack. Somehow it says equip doesn't have a note etc.
 

KieronGryph

Veteran
Veteran
Joined
Dec 12, 2012
Messages
40
Reaction score
0
First Language
English
I'm needing a little help with a simple map name display HUD.

I wrote this,

class Location_Name_Window2 < Window_Base  def initialize()    super(0, 0, window_width, 64)    refresh  end #initialize   def window_width    return Graphics.width / 2  end #window_width#---------------------------------- def refresh contents.clear contents.font.size = 22 #Map Name Display map_name = $game_map.display_name draw_text(0, 0, contents.width + 45, line_height, map_name) leader_name = $game_party.leader.name + " " + $game_party.leader.nickname draw_text(0, line_height-4, contents.width + 45, line_height, leader_name) end #refresh#---------------------------------- def open   refresh   super end #openend #class Location_Name_Window2but it displays the previous map's name unless I open then close the menu.

How do I get it to display the current map's name?
 

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,517
Reaction score
3,221
First Language
Binary
Primarily Uses
RMMZ
...It's also going to result in a VERY big save file....
Not if you compress the data before it gets marshaled ;)

For idk,16 files (seeing thats the rm default) of 'save game 1' at different intervals, it would still work out less than a normal RM save file.

But yea, I also don't have a clue what the point of doing such a thing(having the save intervals - obviousl there is a point to compressing before marshal...) would be.

Usually I like to do "unnecessary" things as well... :D

@Milena

the reason you are getting an error is simply because there is an empty equip slot (pretty sure anyway)

try doing this...

user.equips.compact.each do |equip|  # Crap...endOR

user.equips.each do |equip|  next unless equip  # Crap...end@Keiron

For specific scripts, you should usually make a new thread. Pretty sure Shaz mentioned that a few posts up...

It sounds like it could be because you are not refreshing the map name when you change area (im assumng you are showing this window on the map? can easily make a new sprite class to show the information rather than using the window class, but whatever...) 

Maybe try calling the refresh method AFTER the map transition occurs (if you do it before it will make no difference cause the transfer wont have happened, so it would just reshow the 'old'(map your leaving) map name)

Ahh... I remember when I was asking questions such as this... Memories.... <3

Feels good to be able to contribute back to helping 'newbies' after all the help I've gained within this thread alone :D
 
Last edited by a moderator:

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

Latest Threads

Latest Posts

Latest Profile Posts

Day 9 of giveaways! 8 prizes today :D
He mad, but he cute :kaopride:

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

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.

Forum statistics

Threads
106,040
Messages
1,018,472
Members
137,822
Latest member
madelbylz
Top