-
Content Count
20 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Downloads
Calendar
Gallery
Everything posted by HeathLocke
-
All right, this took me an entire weekend of maddening hash debugging. I'm still not sure why, but RMXP's hashes seem to be sorted by something else other than hash. Even on a for loop, inserting the values one by one from 1 to 6 (number of events I was working with), but the end hash would always be 5, 6, 1, 2, 3, 4. I think at some point I even tried to hardcoding the hashes receiving the value in the right order, but the end hash would still have weird order. But after a lot of trial and errors, I managed to make the events run by id order. In the Interpreter 1 script, on setup_starting_event method, at line 92 I think, I changed the for loop to use a number from 1..number of events, and then access the events array with this number. The final code is # Loop (evento de mapa) for i in 1..$game_map.events.size # Se houver um Evento ocorrendo if $game_map.events[i].starting # Se não é uma execução automática if $game_map.events[i].trigger < 3 # Limpar flag de inicialização $game_map.events[i].clear_starting # Trava $game_map.events[i].lock end # Um evento é configurado setup($game_map.events[i].list, $game_map.events[i].id) return end end Hope this helps someone in the future.
-
I have been working all day on this, and still couldn't fix it. I have managed to pinpoint the source of the problem though, it comes from Game_Map, on the following line @map = load_data(sprintf("Data/Map%03d.rxdata", @map_id)) so I guess the events are being saved in the wrong (for me) order. I have tried many times to manually create the hash with for loops, but couldn't get it working. Hashes are satan's work, probably. I have an idea for an ugly fix that hopefully will work, I should get to it tomorrow. In the meantime I'm open to suggestions of better ways to fix this.
-
I'm doing some debugging where I have autorun events on the map with the following code: print("The event #{@event_id} was started!"); (followed by local switch shenanigans that go with autorun events) And if I copy and paste the same event, say, 4 times around the map, everything works neatly and I get The event 1 was started! The event 2 was started! The event 3 was started! The event 4 was started! However, if after pasting the four events I try to create a new one with the same settings, I'll get The event 5 was started! The event 1 was started! The event 2 was started! The event 3 was started! The event 4 was started! Is there any way to force the events to be executed by id number? The hash @events (line 80) at Game_Map is already starting with the correct event order but somewhere down the line they get scrambled, apparently. All help is greatly appreciated, and I thank in advance.
-
No "tags" input box when submitting a script
HeathLocke replied to HeathLocke's topic in Feedback, Bug Report and Forum Help
Oh, I forgot to check other scripts. I'm used to things not working on my browser, so I assumed it was just on my side. Well, thanks for the reply! Is there a prevision of when/if this is going to be fixed? -
Well, it worked! I'm using a 640x480 picture and then adjusting the rect size as I need. Here is a code snippet for future reference: bitmap = RPG::Cache.picture("pic") self.contents.blt(0, 0, bitmap, Rect.new(0, 0, gridWidth, gridHeight)) I'll mark dolarmark's answer as solved since it answers the thread question. @Heretic86: That's good to know, thanks! In this code I don't think there are any redraws but I hope I'll remember to check if they're altered on future scripts.
-
I had thought about that, but the sizes would be user adjusted and I didn't wanted to require the user to edit the background images, if possible. But you gave me an idea, I could try making one image screen sized and then just adjust the rect so it crops the rest. I'll give that a try and report back.
-
I'm editing a script (releasing soon!) and I want to tile some pictures together. The same picture could be repeated like, from 64 times to more than 200. It should be a 32x32 picture, but I wonder if would be bad to create one rect for every picture, because maybe it could cause performance problems or something like that. By creating a bitmap/rect I mean (and would probably do) something like this: #the x and y would be passed on a for loop bitmap = RPG::Cache.picture("picture") rect = Rect.new(x, y, bitmap.width, bitmap.height self.contents.blt(0, 0, bitmap, rect) So, should I do it like this? Or is there any way to clone a picture or something like that? I haven't got time to look at the stock scripts to see if they have something like this but I plan on doing that tomorrow. Thanks in advance for your attention!
-
I'm making a config menu script and I want to add some BGM and BGS sliders. They're working fine already, but for the changes to be made, the currently playing BGM/S have to be stopped and played again (I'm doing this with bgm_stop and bgm_restore). Looking around I found this thread, and the problem seems to be exactly the same as mine, but none of the solutions in the thread helped me (the last one didn't worked, not sure why). So is there any way to change the volume and actually affect the volume of the music/sound being played? Thanks in advance for the help.
-
Just found out that the Blizzard's slice text script was for RGSS3. Edited the whole thread.
-
Hey, sorry for the late reply. Tried that, and while I don't get the error, the string doesn't breaks, it resizes, just as if I didn't used text_slice. Thanks for the help, anyway.
-
Edit: Just found out that Blizzard's slice_text is for RGSS3. Shame on me. Editing the question so I don't need another thread. I'm trying to add a newline on my script. Using \n, however, returns me a weird character. The string that I'll use will be based on an array index, so I can't (more like don't wanna) do a two-dimensional array and do something like this (unless it's the only case): for i in 0...text_array.size self.contents.draw_text(0,32*i,self.width-32,32,text_array[i]) end Is there any other way to put a line break? Putting characters on the string isn't a problem. (Old post, just in case)
-
How can I use File.exist even with an encrypted game?
HeathLocke replied to HeathLocke's question in Support
Yeah. Fortunately my images don't change dynamically, so I don't really need FileTest. I was doing it just for a good scripting practice, so I can remove it and things will work just fine.. I'll mark your answer as 'solved' because it really seems the best solution if someone really needs to do a FileTest for their script to work. Thanks a lot for your support and input, man. -
How can I use File.exist even with an encrypted game?
HeathLocke replied to HeathLocke's question in Support
Hey man, I'm sorry but I must've messed something up, neither using the picture path nor just the filename are working now. I think I might have encrypted an older version and thought it was working. Since the save files are in the main folder, both File.exists and FileTest.exists can find them, because they're probably not encrypted. So yeah, the problem is still going on. -
How can I use File.exist even with an encrypted game?
HeathLocke replied to HeathLocke's question in Support
Hey, thanks! Although you don't use the file path, just the file name (figured that out by trial and error). Can you edit your answer and remove the path? It would be better for people finding this through google. In this case, it would be if FileTest.exist?("picture.png") Again, thanks a lot for your answer. -
Here I am making yet another thread :P. Thanks to everybody that has been helping me, it means a lot. Anyway, I need to use File.exist in a script that I made, and it works unless the game is encrypted. Since when encrypted there is no "Graphics/Pictures" folder, the file can't be accessed. How can I work around this? RPG::Cache.picture works well with the other images, but I guess it is only for bitmaps. I've also thought about using File.load, but it would ruin the purpose of using File.exist. So yeah, I've ran out of ideas now. PS: Just to make it a little more clear, here is a sample of the code I'm trying to do: if File.exist("Graphics/Pictures/picture.png") @picture.bitmap = RPG::Cache.pictures("picture") else @picture.bitmap = RPG::Cache.pictures("otherpicture") end
-
No, the main game folder is the folder where the Game.exe file is at (see pic). The graphics folder is inside that folder. I wanna move the file to this folder. I'll take a look at that and tell you if it works. Thanks in advance. Edit: Yes, it worked! Thanks a lot. In case anybody is wondering, the syntax is: File.rename(from, to)
-
I'm trying to move a file from the pictures folder (Graphics/Pictures) to the main game folder (the one with Game.exe) using RGSS. I know that in Ruby you can do that with FileUtils, but it doesn't works on RMXP, and the built-in File class doesn't have anything like that. Is there any way to move files with RGSS?
-
Hey, thanks a lot! Also for anybody finding this thread from google or something, since my mapId changes, here is the code to make it match with RMXP's naming format: mapIdNum = mapId.to_s.rjust(3, "0") # .to_s is only necessary if your map id is a number mapWidth = load_data("Data/Map#{mapIdNum}.rxdata").width mapHeight = load_data("Data/Map#{mapIdNum}.rxdata").height
-
Hello. I'm trying to get the width and height of a map using its id, while the player is in another map, with a different ID. I've been able to do this with this code: currentMapId = $game_map.map_id # Stores current map id to use later $game_map.setup(mapId) # Changes map id to get properties mapWidth = $game_map.width # Getting the properties mapHeight = $game_map.height $game_map.setup(currentMapId) # Reverting the map id to its original state (so that the player does not teleports) But I feel this is a really dirty trick. Isn't there a simpler way to do this? Something like $game_map[mapId].width/height. Edit: I would preferably not edit Game_Map or anything like that. If it is really necessary, how can I make the change in a new script page, instead of just editing the default file?