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

Is there a way to increase an actor's ex and sp param rates through script calls? 
Use the Custom Database to make it easy

#regular stuffactor = $data_actors[1]ft = RPG::BaseItem::Feature.new(code, data_id, value)actor.features.push(ft)# here is where the custom database is usedCustomData.update_actor(actor)Sp-params have code 21

Ex-params have code 22

You specify the data ID of the param, which is the order that they appear in the dropdown list, using a zero-based index.

For example, the CNT ex param has ID = 6.

The value is the...value. Just test them out.
Here's a small example that replicates my problem.

class Game_Interpreter def example(mapid) events = $game_map.events.keys for eventid in events $game_self_switches[[mapid, eventid, 'A']] = false end endendThis works perfectly if it's used on the map you're in,  but if you designate a different map, then there are complications.  It uses the event IDs of the map you are currently on, and applies it to the events of the target map.

So my question is, how would I change the above example so that it would use the event IDs of the target map?  I have a workaround where I'd just put the scriptcall(s) I want into a common event, do a quick transfer to the target map, call the common event, then transfer back to where I was, but that defeats the purpose of choosing a map and limiting the capabilities a bit.
Events in a map are only available when that map is loaded. You would either have to load the map into a temporary variable (NOT $game_map, but you could do it the same way the Game_Map class loads its map data), or you would have to know what events exist on each map.

Using events on the current map as keys for the events on the other map you want to turn on is incredibly unreliable. What if your target map has 100 events, but your current ($game_map) only has 5? To do what you're doing, you would not reference $game_map at all.

Here is one way to do what you're after (I'm assuming you have a reason to WANT to turn off a self switch on every event on that map, though I can't really imagine what that would be since you'll have lots of different types of events):

class Game_Interpreter def example(mapid) events = load_data(sprintf("Data/Map%03d.rvdata2", mapid)).events.keys for eventid in events $game_self_switches[[mapid, eventid, 'A']] = false end endendYou may also need to add a check - if mapid happens to be the id of the currently loaded map, you might need to add a $game_map.need_refresh = true after updating all the events.

In fact, if you're wanting to turn self switches OFF, it might be even easier to just poll $game_self_switches and for each key, if the map id is the one you want to change, and the self switch is the one you want to change, turn that self switch off. Question is, will you have so many self switches in use when you need to run it, that it'll take more or less time to go through all self switches, or to load a whole map just so you can access the events?
More or less the reason why I am asking, is because I''m seeing how far I can get into making a farming system like that of harvest moon games.  I have more or less succeeded and am working on improving it when I noticed this problem.  I'musing fomar's self switches, and PK8's self variables to keep everything into a single event, so that I don't have to mess with global variables/switches, and thus can copy the event over and over if needed.

Just in care you're curious about what the actual scriptcall looks like...

Spoiler
def fall_reset(mapid) events = $game_map.events.keys for eventid in events $game_self_switches[[mapid, eventid, 'A']] = false $game_self_switches[[mapid, eventid, 'B']] = false if $game_self_switches[[mapid, eventid, 'F']] if self_variable([mapid, eventid, 1]) >= 2 $game_self_switches[[mapid, eventid, 'C']] = true end if self_variable([mapid, eventid, 1]) >= 6 $game_self_switches[[mapid, eventid, 'D']] = true end if self_variable([mapid, eventid, 1]) >= 10 $game_self_switches[[mapid, eventid, 'E']] = true end end if $game_self_switches[[mapid, eventid, 'G']] if self_variable([mapid, eventid, 1]) >= 2 $game_self_switches[[mapid, eventid, 'C']] = true end if self_variable([mapid, eventid, 1]) >= 7 $game_self_switches[[mapid, eventid, 'D']] = true end if self_variable([mapid, eventid, 1]) >= 8 $game_self_switches[[mapid, eventid, 'E']] = true end end if $game_self_switches[[mapid, eventid, 'H']] if self_variable([mapid, eventid, 1]) >= 3 $game_self_switches[[mapid, eventid, 'C']] = true end if self_variable([mapid, eventid, 1]) >= 6 $game_self_switches[[mapid, eventid, 'D']] = true end if self_variable([mapid, eventid, 1]) >= 8 $game_self_switches[[mapid, eventid, 'E']] = true end end if $game_self_switches[[mapid, eventid, 'I']] if self_variable([mapid, eventid, 1]) >= 4 $game_self_switches[[mapid, eventid, 'C']] = true end if self_variable([mapid, eventid, 1]) >= 10 $game_self_switches[[mapid, eventid, 'D']] = true end if self_variable([mapid, eventid, 1]) >= 15 $game_self_switches[[mapid, eventid, 'E']] = true end end end end def rain_water(mapid) if $game_variables[HM_SEL::WEATHA] == 2 events = $game_map.events.keys for eventid in events if $game_self_switches[[mapid, eventid, 'F']] if $game_self_switches[[mapid, eventid, 'B']] == false self_variable([mapid, eventid, 1], 1, 1) $game_self_switches[[mapid, eventid, 'B']] = true end end if $game_self_switches[[mapid, eventid, 'G']] if $game_self_switches[[mapid, eventid, 'B']] == false self_variable([mapid, eventid, 1], 1, 1) $game_self_switches[[mapid, eventid, 'B']] = true end end if $game_self_switches[[mapid, eventid, 'H']] if $game_self_switches[[mapid, eventid, 'B']] == false self_variable([mapid, eventid, 1], 1, 1) $game_self_switches[[mapid, eventid, 'B']] = true end end if $game_self_switches[[mapid, eventid, 'I']] if $game_self_switches[[mapid, eventid, 'B']] == false self_variable([mapid, eventid, 1], 1, 1) $game_self_switches[[mapid, eventid, 'B']] = true end end end end end def reset_crops(mapid) events = $game_map.events.keys for eventid in events self_variable([mapid, eventid, 1], 0, 0) $game_self_switches[[mapid, eventid, 'A']] = false $game_self_switches[[mapid, eventid, 'B']] = false $game_self_switches[[mapid, eventid, 'C']] = false $game_self_switches[[mapid, eventid, 'D']] = false $game_self_switches[[mapid, eventid, 'B']] = false $game_self_switches[[mapid, eventid, 'F']] = false $game_self_switches[[mapid, eventid, 'G']] = false $game_self_switches[[mapid, eventid, 'H']] = false $game_self_switches[[mapid, eventid, 'I']] = false end endend
I'll try out what you've given me and see if I run into any issues.

Edit: Error "Unable to find file: Data/Mapd.rvdata2"

I assume I should have if statements to take the mapid and convert it into a string in another variable to be used for that one line. *tries it*
that should say


Data/Map%03d.rvdata2


not sure why it didn't paste across properly from the script.
Great!  It works now, thanks for the help on that.
anyone got any tips on improving the speed of which my text is drew?

i was thinking...

maybe if i reduced the width and height as much as possible it would improve on the speed a little.

i was also thinking of using sprintf to draw all my text so that instead of having...

draw_text(x,y,w,h,"TEXT",0)draw_text(x,y,w,h,"VALUE",2)
i would have ...

text_A = "TEXT"text_B = "VALUE"text = sprintf("%s",text_A,"%s#{spacing}","text_B")draw_text(x,y,w,h,text,0)
note : i already figured the sprint f code to space my letters evenly so it has the same effect as the two draw text methods.(dont have it to hand right now)

im just unsure if this would work faster or not because the sprintf has arguments that determine the spacing between letters

any advice ?
Hi, been looking around the different in-game scripts but not sure what I need to edit around.

 I have this http://puu.sh/29ngx but I want to space out the menu commands evenly and/or be able to adjust the position of the first command. (I'm assuming the other two commands are positioned relative to the first command)

Thanks!
Hey guys. What is the proper script call to make the player unable to move? I found a 'solution' in another locked thread, but unfortunately it did not mention in detail how to go about doing it.

Something about aliasing "movable?" in Game_Player.

I have a minigame in my project which uses a bunch of parallel processes. The objective is to press Left and Right consecutively until a variable reaches 0. This however makes it so that the player can move while the minigame is still on. Thanks in advance
@seita - yanfly has a handy script for that:

http://yanflychannel.wordpress.com/rmvxa/utility-scripts/stop-all-movement/
@Dekita

Use Mithran's Text Cache or write your own method for saving each letter as a bitmap to then use blt instead of the normal draw_text.
thanks Galv. Works nicely once I remembered there was a way to disable diagonal movement in victor's script.
@Dekita

Use Mithran's Text Cache or write your own method for saving each letter as a bitmap to then use blt instead of the normal draw_text.


already using mithrans text cache script, but because its alot of text being drew on some pages, i was trying to cut down on the amount of FPS drop when changing pages (it drops down to 56FPS for a second then back up)
Can someone please tell me what commands I would need to do the following?


Set the region id of a map's x and y coordinate to 0.


Remove the autoshadow from a map's x and y tile.


I'm pretty sure they both use $game_map.data, and I know at least the region id relies on bit manipulation (I can see how to get it, but don't know how to change it to 0)
For shadow

$game_map.data[x, y, 3] &= 0b0111 # remove lower-right$game_map.data[x, y, 3] &= 0b1011 # remove lower-left$game_map.data[x, y, 3] &= 0b1101 # remove top-right$game_map.data[x, y, 3] &= 0b1110 # remove top-leftFor region

$game_map.data[x, y, 3] >> 8Gets you the region ID, so you could probably just say

$game_map.data[x, y, 3] &= 0b1111To preserve the shadows while setting the region to 0.

The region and shadow data is stored in layer 3, in two bytes.

The region occupies one byte, and the shadow occupies the other byte.

I believe the data is stored like

<------------------------------_ _ r r r r r r _ _ _ _ s s s sWhere < is where the most significant bit is.

So you would mask the last 4 bits to deal with the shadow, and to deal with the region ID you would mask the...significant bits. To get the region ID you have to shift it by 8 bits to the right

For whatever reason there is some unused bits and I don't know why they didn't just make it 256 regions or something.
So does $game_map.data[x,y,3] ONLY contain info on regions and shadows? Do you know what's in bits 4-7?


If I want to set the region to 0 AND remove all shadows, would this work:

$game_map.data[x,y,3] &= 0b000011110000
and if I wanted to remove JUST the shadows, this:

Code:
$game_map.data[x,y,3] &= 0b111111110000
No clue what are in those seemingly unused bits but I haven't managed to find a way to use them.

The region takes up 6 bits so it would be

1100 0000 1111 0000To remove regions and shadows.

Just shadows would be

1111 1111 1111 0000Assuming you are cautious and want to preserve the unused bits in case someone uses them.
Great, thanks 🙂
Anyone know how to analyze a wave (audio file) in Ruby? Neon Black and I were discussing a script idea.
Anyone know how to analyze a wave (audio file) in Ruby? Neon Black and I were discussing a script idea.
 ive been trying to figure that one out for a while so i could create a little music production / mixing mini game type thing.

so i would also like to know the answer to this, and i would like to add a little to the question also, 

Does anyone know how to access the midi audio synthesizer within vx ace ? 

i figure if playing a midi it must pass through some kind of vst instrument ( probably a very weak one ) but cannot find any reference to this whatsoever in the F1 help pages.

Original thread: https://forums.rpgmakerweb.com/threads/ruby-rgssx-questions-that-dont-deserve-their-own-thread.150/