Jump to content
kal

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

Recommended Posts

Haha, probably. It's easy to lose track of those things. I do all the time.

 

I've been working with your script and Cidiomar's for a few hours now, and it's a shame, but I've concluded that Cidiomar's script is not compatible with my project. Apart from the fact that it disables joypad support, which is certainly a setback, it conflicts with other input-related scripts that are essential for my game system, such as Hime's Event Trigger Labels. I suppose one could adapt your script so it works without Cidiomar's, but I don't really know how. In the end I'll probably opt to simply inform the player of the functionality of the F1 key and have them work it out by themselves. Not very professional, but it's the best option I've got so far.

 

Even so, thank you for posting the script :) Despite being unfinished, it works quite well. I've also learnt a few things; for example, that directional input for menus and for chara movement in map work differently (if I'm not mistaken, the first uses button input directly, while the second uses Input.dir4), which is probably the reason why your script only changes directional key binding for menus and not for the map.

 

Thanks for your help and the best of luck!

Share this post


Link to post
Share on other sites

Can you create tilesets using a script? I'm making a rogue-like space explorer and putting together tilesets as they are used, I.E. I don't have to pre-make them, would be extraordinarily helpful.

Share this post


Link to post
Share on other sites

 

Can you create tilesets using a script? I'm making a rogue-like space explorer and putting together tilesets as they are used, I.E. I don't have to pre-make them, would be extraordinarily helpful.

 

 

Technically I am pretty sure you can, or at least dynamically fiddle with the tileset bitmaps.

Share this post


Link to post
Share on other sites

Okay, I'm sorry for asking a question I'm sure is probably quite obvious, but I'm stuck. If I create a tileset; "Base", in the database, wouldn't it be an object in ruby? What would its name be, and how would I change the array @tileset_names at the index 5 to be 'B13', or otherwise the name of the B sheet I want to change the current one to be?

Share this post


Link to post
Share on other sites

I have thoroughly read the help documentation on the matter, but unfortunately it didn't answer my question. I need to know what my tileset, Tileset 001 "Base" is instantiated as.

Share this post


Link to post
Share on other sites

Is there a way to play BGM starting from a specific point?

 

Also, what are all the different event priorities? I know the default 0, 1, and 2 are below player, same as player, and above player, respectively. But I also know you can manually set the priority_type to -1 and the event will be below the map. I'm actually needing to know if I can have an event above the map, not just player, so it will show above pictures. Is that possible?

Edited by AeghtyAteKees

Share this post


Link to post
Share on other sites

How would I go about checking to see if a certain actor's name is one of the following from a list?
I'm using Actor12 as a placeholder for passwords and such.

 

$game_actors[12].name.any? {|name| ["snuff", "snuff out", "extinguish", "stub out", "smother", "put out", "blow", "suffocate", "black", "black out"].include?($game_actors[12].name }

 

I think it's something like this but I know there's some mistakes in there

Share this post


Link to post
Share on other sites

Extremely silly question:

 

How to get the length of the text/value?

 

For example let's say I'd have this:

draw_text(280, 100, 100, 24, "HP: ")

and now I want to put something next to it:

draw_text(280 + text_from_above.length, 100, 100, 24, @actor.hp.to_s)

Or if I'd want to put two values:

draw_text(280, 100, 100, 24, @actor.hp.to_s)

And next to this:

draw_text(280 + above_value.length, 100, 100, 24, " / " + @actor.mhp.to_s)

Why do I need this?

I want to use different colors and I obviously cannot do this in one line.

 

~Thanks

Share this post


Link to post
Share on other sites

To my knowledge ,there is no method that do that, you can try to create one yourself if you know how many pixels wide each character of your font is (easier if you have a monospaced font)

Share this post


Link to post
Share on other sites

There is a text_size method actually... for windows at least. You pretty much need it for variable width text stuff, but it doesn't take in to account command codes. You will have to do some extra processing for that, like I did with my word wrap script.

Share this post


Link to post
Share on other sites

Can I control where the cursor is in a choice list when it is opened? Is there a way to store the cursor index in a variable? So if I select something from a choice list, open another window, close that window, and want to reopen the choice list with the cursor where it was before?

Share this post


Link to post
Share on other sites

Try with this

class Window_ChoiceList < Window_Command

  def start
    update_placement
    refresh
    select($game_variables[id]) # This will set the starting index to the stored in the variable
    open
    activate
  end

  def call_ok_handler
    $game_message.choice_proc.call(index)
    $game_variables[id] = index # This will store the current index when an option is selected
    close
  end
  
end

if you also want to store the index when canceling, add this:

def call_cancel_handler
    $game_message.choice_proc.call($game_message.choice_cancel_type - 1)
    $game_variables[id] = index
    close
end

However this way, a single variable will control all choice lists. Don't know if it is what you wanted.

Share this post


Link to post
Share on other sites

You definitely set me on the right track. :) My final setup used the variable you suggested, along with an added switch. Since I didn't want this tweak affecting ALL choice lists (in which case I would have to be very careful about resetting the variable when I closed every window, yadayadayada), the cursor index is only stored if the switch is on, so I can turn it on before the choice list I want, then when I'm through with the event, turn it off and set the variable to 0, and it's like nothing is changed.

 

Thank you much!

Edited by AeghtyAteKees

Share this post


Link to post
Share on other sites

Add
attr_reader :window_name

in your scene script

 

and then use SceneManager.scene.window_name.activate/deactivate

 

This should work ... I think ... maybe

Share this post


Link to post
Share on other sites

Is it possible to have a variable amount of times in this function:

 

duration.times { Fiber.yield }

 

that, or to have fiber.yield only occur until something else finishes

for example: Fiber.yield while $game_map.screen.shake?

 

That, or figuring out if the screen is shaking in a conditional branch

 

I did find $game_screen.shake_duration but it doesn't seem to work inside a conditional branch (as in $game_screen.shake_duration == 0)

I want the player to not be able to exit an elevator as it's moving.

Edited by Jolt Android

Share this post


Link to post
Share on other sites

Doing something variable times is no problem!

x = 5

y = 0

 

x.times { y += 2 }

 

puts "#{y}" #=> 10

 

However I'm not sure about concurrence with shakescreen... (outside my area of expertise) It might just get stuck in the while loop :(

Edited by Cookie Ninja

Share this post


Link to post
Share on other sites

You can put it inside of any kind of loop you want really. Both "duration.times { Fiber.yield }" and "Fiber.yield while $game_map.screen.shake?" are perfectly valid (though the later assumes that the screen's shake status is in fact updated when yielded). The way Fiber.yield works is basically just telling the game "suspend what you are doing in this fiber to do other stuff until it is resumed". The catch is it only works inside a fiber that has previously been set up. The event interpreter sets up a fiber for you when you run events, but otherwise you have to set one up yourself and resume it yourself.

Edited by KilloZapit

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×