Group: Global Mod
Posts: 1,414
Type: Scripter
RM Skill: Advanced
Rev Points: 15
The Script Builders' Help Topic
- Refuge for scripters everywhere, get your problems sorted here. -
Introduction
Welcome to the Script Builders' Help Topic. If you have come to this topic, you are probably looking for help with a script you have found, or are making. Well this is the aim of this topic. The Script Builders will try their hardest to help you out with buggy script errors that you may encounter, or maybe you have a question about a function like how to display an item's name from a script. Well all you'll need to do is follow the simple rules and fill in the request form which are found further on.
Rules
Here are just a few rules to help keep this much easier.
Please do not pressure us. Once we have recieved your request, we will work on it and will work in the order that we have recived the scripts in. So please be patient. Also, this is a must: do not spam this topic, this is a serious topic that we have created to bring you the most support we can, if you want to spam please do it in the Off-Topic Cesspool. One more rule, please be kind to the Script builders as we are giving up our spare time to try and help your own problems, we won't have a go at you if it's something very simple, but saying that we do not expect you to have a go at us if we get it wrong.
Thank you for following and reading these rules.
Request Form
To help us to help you more efficently, try and follow the form bellow to give us the most infomation about the error or question you need.
Form:
Link to Script Topic (If needed):
(If not the above)Actual script:
Error or problem you have encountered (Please explain in as much detail as you can, screen shots of the error work wonders):
Conclusion
Please post your request here in this topic, or if you think its urgent, you may PM the following people.
- Legacy - The Law G14 - Night_Runner - Night5h4d3 - Juan
Please try to explain your problem in full detail, this will make it faster to find the problem. Also, when PMing either of the above members, please try to use the form above.
Thank you - Legacy -
This post has been edited by Legacy: Nov 12 2012, 01:35 PM
"When you first come, no one knows you. When help them out, they all know you. When you leave, they all love you. When you come back, they've already forgotten you." -- copy into your sig if you think this quote speaks true!
If you are one of the very few teenagers that know what real rap is and don't blindly listen to the hate statements (rap is crap), then put this in your sig. I say this in the name of Common, Mos Def, Lupe Fiasco, 2Pac, Nas, Talib Kweli, Eminem, and many others. -Exiled One
"When you first come, no one knows you. When help them out, they all know you. When you leave, they all love you. When you come back, they've already forgotten you." -- copy into your sig if you think this quote speaks true!
If you are one of the very few teenagers that know what real rap is and don't blindly listen to the hate statements (rap is crap), then put this in your sig. I say this in the name of Common, Mos Def, Lupe Fiasco, 2Pac, Nas, Talib Kweli, Eminem, and many others. -Exiled One
I'm not really sure if this question belongs here but still:
Is it possible to have a script that can activate/deactivate other scripts with in-game commands? [similar to the tons-of-addns thing]
Eventhough I'm overly busy with other stuff, if that's possible, I'd give it a shot and try to make it. [example of use: have a battler or a sideview battlestyles depending depending on the creature you fight by adding a activation script line before battle processing]
So yeah probably wrong place to ask, but since noone else is asking anything mightaswell use it to bump the topic
__________________________
Given the choice - whether to rule a corrupt and failing empire, or to challenge the Fates for another throw, a better throw against one's destiny - what was a king to do?
Would it be possible to create a script that copies an existing event and places the copy at a location you specify?
Is it possible to create a script that calls up the item menu, lets you select an item and then stores the value of the item to a variable?
And how bout a script that matches X and Y coordinates to a set of variables and then identifies the parent event? (So you dont need to write a list of if statements a mile long)
This post has been edited by Darkreaper: Dec 4 2009, 10:49 AM
Group: Local Mod
Posts: 1,346
Type: Scripter
RM Skill: Skilled
Rev Points: 5
@Dummy: Hm, that seems like something really difficult to do. I do know of an easy way to deactivate a whole script very easily by putting
CODE
=begin
at the beginning of the script which will comment out everything below it. If that's not what you're looking for, I have an idea on how you could go about doing this.
@Darkreaper: I don't have your first or third questions figured out yet, but for your second question, I have a pretty rough draft of what I think you're looking for:
CODE
#============================================================================== # ** Scene_Item #------------------------------------------------------------------------------ # This class performs item screen processing. #==============================================================================
class Scene_Item #-------------------------------------------------------------------------- # * Alias Listing #-------------------------------------------------------------------------- alias law_item_variable_update_item update_item #-------------------------------------------------------------------------- # * Frame Update (when item window is active) #-------------------------------------------------------------------------- def update_item law_item_variable_update_item # If C button was pressed if Input.trigger?(Input::C) # Get currently selected data on the item window $game_variables[1] = @item $scene = Scene_Map.new end end end
Just open up your item screen, pick an item, and it should be saved in variable 1. You can change what variable it is stored in the 5th to last line of the script.
This post has been edited by The Law G14: Dec 4 2009, 06:30 PM
"When you first come, no one knows you. When help them out, they all know you. When you leave, they all love you. When you come back, they've already forgotten you." -- copy into your sig if you think this quote speaks true!
If you are one of the very few teenagers that know what real rap is and don't blindly listen to the hate statements (rap is crap), then put this in your sig. I say this in the name of Common, Mos Def, Lupe Fiasco, 2Pac, Nas, Talib Kweli, Eminem, and many others. -Exiled One
Group: +Gold Member
Posts: 1,528
Type: Scripter
RM Skill: Undisclosed
Darkreaper? I remember Charlie Lee & Ty tried answering your question..... Basically, Sephiroth's script isn't what you're after, it lets you make events, not make copies of them. Charlie's Auto Populate script hosted here only lets you create copies of events. Unfortunately, I think you need to sign up to RMVXP to see the post, but you won't be able to understand what's going on without Charlie's instructions... I don't think charlie's script lets you just put the event's clone at a position, but I've got an edited version I can PM you if you want (I got the impression he wouldn't appreciate me posting it here).
2) If you go into the Script Editor, and scroll down to the bottom there should be Main, just right click and insert The Law's script before Main, but Scene_Debug
Oh well, I've made a script for your question 3, read through the instructions a the start, but basically have an event run:
CODE
event_at(7, 8, 9)
and it will look in variable #7 for the x, variable #8 for the y, and return the event at (x, y) in variable #9
#============================================================================== # ** Night_Runner's Event_At Script #------------------------------------------------------------------------------ # Date Created: 5/Dec/09 # Version: 1.0 # Created for Darkreaper # @> http://www.rpgrevolution.com/forums/index.php?showtopic=37119 # # DESCRIPTION: # This script is designed to find the event at a certain x and y coordinates, # and return the event's ID number, or 0 if no events are present. # # USAGE: # Have an event run the script: # event_at(3, 4, 5) # and this script will look in the game variable 3 for the x coordinate, the # game variable 4 for the y coordinate, and will return the event's ID in the # game variable 5. # #==============================================================================
#============================================================================== # ** Interpreter #------------------------------------------------------------------------------ # Edited to have the event_at command #==============================================================================
class Interpreter #---------------------------------------------------------------------------- # * Event at (x-coordinate-variable, y-coordinate-variable, # event_id-variable) #---------------------------------------------------------------------------- def event_at(x_var, y_var, ret_var) # Get the x & y from the variable x = $game_variables[x_var] y = $game_variables[y_var] # Set the variable to 0 by default $game_variables[ret_var] = 0 # For each event for event in $game_map.events.values # If the event's x & y match if event.x == x and event.y == y # Set the variable to the event ID $game_variables[ret_var] = event.id # Break the for loop break end end end end
#============================================================================== # END OF SCRIPT #==============================================================================
__________________________
K.I.S.S. Want help with your scripting problems? Upload a demo! Or at the very least; provide links to the scripts in question.
"When you first come, no one knows you. When help them out, they all know you. When you leave, they all love you. When you come back, they've already forgotten you." -- copy into your sig if you think this quote speaks true!
If you are one of the very few teenagers that know what real rap is and don't blindly listen to the hate statements (rap is crap), then put this in your sig. I say this in the name of Common, Mos Def, Lupe Fiasco, 2Pac, Nas, Talib Kweli, Eminem, and many others. -Exiled One
@Darkreaper: I don't have your first or third questions figured out yet, but for your second question, I have a pretty rough draft of what I think you're looking for:
CODE
#============================================================================== # ** Scene_Item #------------------------------------------------------------------------------ # This class performs item screen processing. #==============================================================================
class Scene_Item #-------------------------------------------------------------------------- # * Alias Listing #-------------------------------------------------------------------------- alias law_item_variable_update_item update_item #-------------------------------------------------------------------------- # * Frame Update (when item window is active) #-------------------------------------------------------------------------- def update_item law_item_variable_update_item # If C button was pressed if Input.trigger?(Input::C) # Get currently selected data on the item window $game_variables[1] = @item $scene = Scene_Map.new end end end
Just open up your item screen, pick an item, and it should be saved in variable 1. You can change what variable it is stored in the 5th to last line of the script.
So i think it kinda works, but not how i need it. What im using it for is for cooking: Say you have an apple and a fish, you make a fire and want to cook some food. So you "use" the fire and it pulls up your inventory screen and lets you choose what you want to cook. You pick the fish, it removes the fish item and after a little bit gives you a "Cooked Fish" item
This post has been edited by Darkreaper: Jan 24 2010, 09:30 AM
Group: Local Mod
Posts: 1,346
Type: Scripter
RM Skill: Skilled
Rev Points: 5
Sorry for the late response, but does this item screen only inlcdue items that can be cooked or just any item in your inventory inlcuding weapons and armor?
"When you first come, no one knows you. When help them out, they all know you. When you leave, they all love you. When you come back, they've already forgotten you." -- copy into your sig if you think this quote speaks true!
If you are one of the very few teenagers that know what real rap is and don't blindly listen to the hate statements (rap is crap), then put this in your sig. I say this in the name of Common, Mos Def, Lupe Fiasco, 2Pac, Nas, Talib Kweli, Eminem, and many others. -Exiled One
"When you first come, no one knows you. When help them out, they all know you. When you leave, they all love you. When you come back, they've already forgotten you." -- copy into your sig if you think this quote speaks true!
If you are one of the very few teenagers that know what real rap is and don't blindly listen to the hate statements (rap is crap), then put this in your sig. I say this in the name of Common, Mos Def, Lupe Fiasco, 2Pac, Nas, Talib Kweli, Eminem, and many others. -Exiled One
Group: Local Mod
Posts: 1,346
Type: Scripter
RM Skill: Skilled
Rev Points: 5
This is a rough draft of what I have so far. Just make an event and go to the third page of the list of event commands and click Script. Type in this code:
CODE
$scene = Scene_Cooking.new
To change what variable the item is stored in, go to line 81 of the script.
#============================================================================== # ** Scene_Cooking #------------------------------------------------------------------------------ # This class performs cooking screen processing. #==============================================================================
class Scene_Cooking #-------------------------------------------------------------------------- # * Main Processing #-------------------------------------------------------------------------- def main # Make help window, item window @help_window = Window_Help.new @cooking_window = Window_Cooking.new # Associate help window @cooking_window.help_window = @help_window # Execute transition Graphics.transition # Main loop loop do # Update game screen Graphics.update # Update input information Input.update # Frame update update # Abort loop if screen is changed if $scene != self break end end # Prepare for transition Graphics.freeze # Dispose of windows @help_window.dispose @cooking_window.dispose end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update # Update windows @help_window.update @cooking_window.update # If cooking window is active: call update_cooking if @cooking_window.active update_cooking return end end #-------------------------------------------------------------------------- # * Frame Update (when item window is active) #-------------------------------------------------------------------------- def update_cooking # If B button was pressed if Input.trigger?(Input::B) # Play cancel SE $game_system.se_play($data_system.cancel_se) # Switch to menu screen $scene = Scene_Map.new return end # If C button was pressed if Input.trigger?(Input::C) # Get currently selected data on the item window @item = @cooking_window.item # If not a use item unless @item.is_a?(RPG::Item) # Play buzzer SE $game_system.se_play($data_system.buzzer_se) return end # If it can't be used unless $game_party.item_can_use?(@item.id) # Play buzzer SE $game_system.se_play($data_system.buzzer_se) return end # Play decision SE $game_system.se_play($data_system.decision_se) $game_variables[1] = @item $scene = Scene_Map.new # If command event ID is valid if @item.common_event_id > 0 # Command event call reservation $game_temp.common_event_id = @item.common_event_id # Play item use SE $game_system.se_play(@item.menu_se) # If consumable if @item.consumable # Decrease used items by 1 $game_party.lose_item(@item.id, 1) # Draw item window item @item_window.draw_item(@item_window.index) end # Switch to map screen $scene = Scene_Map.new return end end return end end
#============================================================================== # ** Window_Cooking #------------------------------------------------------------------------------ # This window displays cooking items in possession. #==============================================================================
class Window_Cooking < Window_Selectable #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize super(0, 64, 640, 416) @column_max = 2 refresh self.index = 0 end #-------------------------------------------------------------------------- # * Get Item #-------------------------------------------------------------------------- def item return @data[self.index] end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh if self.contents != nil self.contents.dispose self.contents = nil end @data = [] # Add item for i in 1...$data_items.size if $game_party.item_number(i) > 0 @data.push($data_items[i]) end end # If item count is not 0, make a bit map and draw all items @item_max = @data.size if @item_max > 0 self.contents = Bitmap.new(width - 32, row_max * 32) for i in 0...@item_max draw_item(i) end end end #-------------------------------------------------------------------------- # * Draw Item # index : item number #-------------------------------------------------------------------------- def draw_item(index) item = @data[index] case item when RPG::Item number = $game_party.item_number(item.id) end if item.is_a?(RPG::Item) and $game_party.item_can_use?(item.id) self.contents.font.color = normal_color else self.contents.font.color = disabled_color end x = 4 + index % 2 * (288 + 32) y = index / 2 * 32 rect = Rect.new(x, y, self.width / @column_max - 32, 32) self.contents.fill_rect(rect, Color.new(0, 0, 0, 0)) bitmap = RPG::Cache.icon(item.icon_name) opacity = self.contents.font.color == normal_color ? 255 : 128 self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity) self.contents.draw_text(x + 28, y, 212, 32, item.name, 0) self.contents.draw_text(x + 240, y, 16, 32, ":", 1) self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2) end #-------------------------------------------------------------------------- # * Help Text Update #-------------------------------------------------------------------------- def update_help @help_window.set_text(self.item == nil ? "" : self.item.description) end end
"When you first come, no one knows you. When help them out, they all know you. When you leave, they all love you. When you come back, they've already forgotten you." -- copy into your sig if you think this quote speaks true!
If you are one of the very few teenagers that know what real rap is and don't blindly listen to the hate statements (rap is crap), then put this in your sig. I say this in the name of Common, Mos Def, Lupe Fiasco, 2Pac, Nas, Talib Kweli, Eminem, and many others. -Exiled One
This is a rough draft of what I have so far. Just make an event and go to the third page of the list of event commands and click Script. Type in this code:
CODE
$scene = Scene_Cooking.new
To change what variable the item is stored in, go to line 81 of the script.
#============================================================================== # ** Scene_Cooking #------------------------------------------------------------------------------ # This class performs cooking screen processing. #==============================================================================
class Scene_Cooking #-------------------------------------------------------------------------- # * Main Processing #-------------------------------------------------------------------------- def main # Make help window, item window @help_window = Window_Help.new @cooking_window = Window_Cooking.new # Associate help window @cooking_window.help_window = @help_window # Execute transition Graphics.transition # Main loop loop do # Update game screen Graphics.update # Update input information Input.update # Frame update update # Abort loop if screen is changed if $scene != self break end end # Prepare for transition Graphics.freeze # Dispose of windows @help_window.dispose @cooking_window.dispose end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update # Update windows @help_window.update @cooking_window.update # If cooking window is active: call update_cooking if @cooking_window.active update_cooking return end end #-------------------------------------------------------------------------- # * Frame Update (when item window is active) #-------------------------------------------------------------------------- def update_cooking # If B button was pressed if Input.trigger?(Input::B) # Play cancel SE $game_system.se_play($data_system.cancel_se) # Switch to menu screen $scene = Scene_Map.new return end # If C button was pressed if Input.trigger?(Input::C) # Get currently selected data on the item window @item = @cooking_window.item # If not a use item unless @item.is_a?(RPG::Item) # Play buzzer SE $game_system.se_play($data_system.buzzer_se) return end # If it can't be used unless $game_party.item_can_use?(@item.id) # Play buzzer SE $game_system.se_play($data_system.buzzer_se) return end # Play decision SE $game_system.se_play($data_system.decision_se) $game_variables[1] = @item $scene = Scene_Map.new # If command event ID is valid if @item.common_event_id > 0 # Command event call reservation $game_temp.common_event_id = @item.common_event_id # Play item use SE $game_system.se_play(@item.menu_se) # If consumable if @item.consumable # Decrease used items by 1 $game_party.lose_item(@item.id, 1) # Draw item window item @item_window.draw_item(@item_window.index) end # Switch to map screen $scene = Scene_Map.new return end end return end end
#============================================================================== # ** Window_Cooking #------------------------------------------------------------------------------ # This window displays cooking items in possession. #==============================================================================
class Window_Cooking < Window_Selectable #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize super(0, 64, 640, 416) @column_max = 2 refresh self.index = 0 end #-------------------------------------------------------------------------- # * Get Item #-------------------------------------------------------------------------- def item return @data[self.index] end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh if self.contents != nil self.contents.dispose self.contents = nil end @data = [] # Add item for i in 1...$data_items.size if $game_party.item_number(i) > 0 @data.push($data_items[i]) end end # If item count is not 0, make a bit map and draw all items @item_max = @data.size if @item_max > 0 self.contents = Bitmap.new(width - 32, row_max * 32) for i in 0...@item_max draw_item(i) end end end #-------------------------------------------------------------------------- # * Draw Item # index : item number #-------------------------------------------------------------------------- def draw_item(index) item = @data[index] case item when RPG::Item number = $game_party.item_number(item.id) end if item.is_a?(RPG::Item) and $game_party.item_can_use?(item.id) self.contents.font.color = normal_color else self.contents.font.color = disabled_color end x = 4 + index % 2 * (288 + 32) y = index / 2 * 32 rect = Rect.new(x, y, self.width / @column_max - 32, 32) self.contents.fill_rect(rect, Color.new(0, 0, 0, 0)) bitmap = RPG::Cache.icon(item.icon_name) opacity = self.contents.font.color == normal_color ? 255 : 128 self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity) self.contents.draw_text(x + 28, y, 212, 32, item.name, 0) self.contents.draw_text(x + 240, y, 16, 32, ":", 1) self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2) end #-------------------------------------------------------------------------- # * Help Text Update #-------------------------------------------------------------------------- def update_help @help_window.set_text(self.item == nil ? "" : self.item.description) end end
Works perfectly up until i pick an item in the inventory prompt, then it errored out. Also the icon for the item showed up but not the name
@Dummy: Assuming you mean whether it's possible to activate/deactive scripts dynamically in-game then I am afraid it's in the general case impossible. I believe that problem is undecidable. If it is, then it is impossible to write an algorithm which solves the problem in the general case. In that case I would suggest dealing with it application specific. I.e. customizing the scripts so they can be turned on and off dynamically.
If you are talking about statically say not evaluating certain sections, then that is very much possible.
Group: Local Mod
Posts: 1,346
Type: Scripter
RM Skill: Skilled
Rev Points: 5
@Darkreaper: Did you put weapons or armor in there? I only made it so that it included items only but I can add weapons and armor if you want. Also, do you have any other custom scripts?
"When you first come, no one knows you. When help them out, they all know you. When you leave, they all love you. When you come back, they've already forgotten you." -- copy into your sig if you think this quote speaks true!
If you are one of the very few teenagers that know what real rap is and don't blindly listen to the hate statements (rap is crap), then put this in your sig. I say this in the name of Common, Mos Def, Lupe Fiasco, 2Pac, Nas, Talib Kweli, Eminem, and many others. -Exiled One