Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

2 Pages V   1 2 >  
Reply to this topicStart new topic
> RMVX Scene_Menu Patch 1.0, Attn: Scripters!
cmpsr2000
post Jun 17 2008, 11:31 PM
Post #1


Keeper of the Ruby Code of DOOM!
Group Icon

Group: Revolutionary
Posts: 355
Type: Scripter
RM Skill: Masterful




Menu Patch 1.0


Scripters! This script is really for us more than everyone else. The default menu system in VX is a problem for those of us that want to build scripts that can be launched from a menu option. In the past week I've had to troubleshoot no less than 3 different projects where the user was unable to get one of my scripts to work with another script that did a similar menu modification. I posted a tutorial on how to properly edit the menu to get around the problem, but this is not user friendly. The best solution would be to use a better menu system so our scripts are compatible.

So, I have patched the menu system for us:
Attached File  Scene_Menu.txt ( 4.93K ) Number of downloads: 353


Place the code under materials after any other scripts and directly above main.

Now, to add a menu item, all you need to do is push or insert the correct information into the $game_menu array.

Here are the instructions:
CODE

#==============================================================================
# ** Scene_Menu (patched by cmpsr2000 June 18, 2008)
#
# This patch allows scripters to add to the menu using normal array
# commands. Each menu item is an array of the following elements:
#
# menuText: The text to be displayed in the menu. needs to be a string.
# command: The code to execute when the menu item is selected. IT MUST
# BE A STRING! (the script uses eval to run it)
# hideBool: Whether or not to disable this menu item when the party is
# empty. Boolean (true, false).
# actSelCode: If you used "start_actor_selection" to specify an actor, put
# the subsequent code here. IT MUST BE A STRING! (the script
# uses eval to run it).
#
# Check the existing $game_menu above for examples.
#
# TO ADD TO THE END OF THE MENU:
# menuItem = [menuText, command, hideBool, actSelCode]
# $game_menu.push(menuItem)
#
# TO INSERT AT A SPECIFIC POSITION IN THE MENU:
# INDEX = #position where you want to insert (don't forget its 0-based!)
# menuItem = [menuText, command, hideBool, actSelCode]
# $game_menu.insert(INDEX, menuItem)
#
#------------------------------------------------------------------------------
# This class performs the menu screen processing.
#==============================================================================


An example of a "menuItem": [Vocab::skill, "start_actor_selection", true, "$scene = Scene_Skill.new(@status_window.index)"]

Note that the code to run is in quotes! It must be a string or eval won't work, and you'll get build errors. If you have more than one line to run, write a method definition then call the method here.

Please note: calls to push or insert into $game_menu must be made AFTER Scene_Title.create_game_objects has run(or inside it)!

Here's an example of how to modify your script(using ACS as an example):
CODE

class Scene_Title < Scene_Base
alias oldCreateGameObj_SCRIPTNAME create_game_objects
def create_game_objects
oldCreateGameObj_SCRIPTNAME
menuItem = [Vocab::crafting, "$scene = Scene_Crafting.new", true, nil]
$game_menu.insert(4, menuItem)
end
end


This will insert "Crafting" before position 4 (it's 0 based, so that's right before save!) in the menu. If a user were to include several scripts that modify the menu, all the entries would now show up and be functional.

Please feel free to use this patch if you are writing a script that adds a menu item, but do not feel obligated. I will keep a database here of scripts that don't have built-in support for Menu Patch so that users can just copy-paste the correct code into their projects. Also, whether you use it or not it would be awesome if you could go ahead and post the code-snippet for your menuItem so I can add it to the list. Thanks!

Known Menu Items:
CODE

#script: ACS
#Author: cmpsr2000
[Vocab::crafting, "$scene = Scene_Crafting.new", true, nil]

#script: ClassSwitcher
#Author: cmpsr2000
[Vocab::classes, "start_actor_selection", true, "$scene = Scene_Class_Switch.new(@status_window.index)"]


__________________________
Go to the top of the page
 
+Quote Post
   
AmIMeYet
post Jun 18 2008, 07:52 AM
Post #2


new av & (dynamic) sig!
Group Icon

Group: Revolutionary
Posts: 149
Type: Scripter
RM Skill: Undisclosed




This could prove to be verry usefull indeed! smile.gif

A few questions though:
-What happens if two scripts want to get the same index?
-Should we send users of our scripts a link to this topic, or should we make an optional 'spoiler'-box with your code? (+ credits ofcourse wink.gif )

This should be used on a fairly large scale to be affective though...


__________________________

>>Latest EventScripter news: Conditional Branches fully working! Currently working on a documentation site. Topic: EventScripter
>>Portals (yes, in RPG Maker VX!)
>>Working with Sojabird on his Scriptology; I also invented Scriptuzzle.. Try one; make one!
[Show/Hide] USEFULL script snippets:
[Show/Hide] Do require's in VX:
CODE
$LOAD_PATH << Dir.getwd #You only need to call this once
Kernel.require("includable.rb") #replace includable.rb with the name of the file you want to load
[Show/Hide] Invert Dash enabling:
CODE
#=============================================================================#
# # #                            ANTI DASH HACK                           # # #
# # #                              By AmIMeYet                            # # #
# # #                           please credit me                          # # #
#=============================================================================#
class Game_Player < Game_Character
  def dash?
    return false if @move_route_forcing
    return false if in_vehicle?
    return true if Input.press?(Input::A) and $game_map.disable_dash?
  end
end

This snippet basically inverts the dashing.. allowing you to dash only when 'disable dashing' is checked.
This way, normal maps disable dashing, but the ones you set to disable actually allow dashing..

It should be placed where you normally place the scripts ('above main', in the materials section of the scripts window)..
Go to the top of the page
 
+Quote Post
   
cmpsr2000
post Jun 18 2008, 11:27 AM
Post #3


Keeper of the Ruby Code of DOOM!
Group Icon

Group: Revolutionary
Posts: 355
Type: Scripter
RM Skill: Masterful




QUOTE (AmIMeYet @ Jun 18 2008, 10:06 AM) *
A few questions though:
-What happens if two scripts want to get the same index?

As long as you are using $game_menu.insert(INDEX, menuItem) instead of $game_menu[INDEX] = menuItem it will simply insert your item into the array above the previous item. So if multiple scripts in a project try to insert at the same index, they end up in the reverse order they appear in the project.

For example, lets say you have 3 scripts, ACS, that awesome quest script and classSwitcher. They all use $game_menu.insert at index 4 and in the script section they are in this order:
ACS
Quest
ClassSwitcher

When the game starts loading it hits ACS first, so it inserts it at position 4. the menu now looks like this:
Item
Equip
Skills
Status
Crafting
Save
Exit

Then it hits quest and inserts at position 4:
Item
Equip
Skills
Status
Quests
Crafting

Save
Exit

Then it hits the classSwitcher and inserts at position 4:
Item
Equip
Skills
Status
Classes
Quests
Crafting

Save
Exit

So, When scripts use the same index for insertion they show up in the menu in the reverse of the order in the script section

QUOTE (AmIMeYet @ Jun 18 2008, 10:06 AM) *
-Should we send users of our scripts a link to this topic, or should we make an optional 'spoiler'-box with your code? (+ credits ofcourse wink.gif )


Please go ahead and include the code in your demos, but in the "script" section of your posts write: "Requires Cmpsr2000's Menu Patch" and link to this topic. And don't forget to post your menuItems so I can add them to the codebox above ^^b

I'm hoping this will catch on with most, if not all, of the scripts here that modify the menu. All of my scripts are being updated right now to include and *require* this patch. Because of how easy it is to use, and how friendly it is to the users of our scripts, I'm hoping most scripters will support it. thumbsup.gif


__________________________
Go to the top of the page
 
+Quote Post
   
AmIMeYet
post Jun 18 2008, 12:06 PM
Post #4


new av & (dynamic) sig!
Group Icon

Group: Revolutionary
Posts: 149
Type: Scripter
RM Skill: Undisclosed




Thanks for your answers!
I know I'll be using it! biggrin.gif
Now only if I where to make scripts... XD
Nah, I really like this, and how user-friendly it is.... good job!


__________________________

>>Latest EventScripter news: Conditional Branches fully working! Currently working on a documentation site. Topic: EventScripter
>>Portals (yes, in RPG Maker VX!)
>>Working with Sojabird on his Scriptology; I also invented Scriptuzzle.. Try one; make one!
[Show/Hide] USEFULL script snippets:
[Show/Hide] Do require's in VX:
CODE
$LOAD_PATH << Dir.getwd #You only need to call this once
Kernel.require("includable.rb") #replace includable.rb with the name of the file you want to load
[Show/Hide] Invert Dash enabling:
CODE
#=============================================================================#
# # #                            ANTI DASH HACK                           # # #
# # #                              By AmIMeYet                            # # #
# # #                           please credit me                          # # #
#=============================================================================#
class Game_Player < Game_Character
  def dash?
    return false if @move_route_forcing
    return false if in_vehicle?
    return true if Input.press?(Input::A) and $game_map.disable_dash?
  end
end

This snippet basically inverts the dashing.. allowing you to dash only when 'disable dashing' is checked.
This way, normal maps disable dashing, but the ones you set to disable actually allow dashing..

It should be placed where you normally place the scripts ('above main', in the materials section of the scripts window)..
Go to the top of the page
 
+Quote Post
   
Netto
post Jun 19 2008, 06:13 PM
Post #5


芸術家
Group Icon

Group: Revolutionary
Posts: 708
Type: None
RM Skill: Skilled




The tutorial was a long process, this is simple and easy laugh.gif


__________________________
Current Project[RC]: Twilight Realm 3DMMORPG w/dx9, and char creation through mysql after I get a server, now C++ scripting
Current Project[VX]: Obsidian Trilogy just started 08/12/2008
Current Project[XP&RM2K3]: none
Go to the top of the page
 
+Quote Post
   
cmpsr2000
post Jun 19 2008, 06:34 PM
Post #6


Keeper of the Ruby Code of DOOM!
Group Icon

Group: Revolutionary
Posts: 355
Type: Scripter
RM Skill: Masterful




QUOTE (Netto @ Jun 19 2008, 08:27 PM) *
The tutorial was a long process, this is simple and easy laugh.gif


hooray for user friendly code laugh.gif


__________________________
Go to the top of the page
 
+Quote Post
   
SojaBird
post Jun 23 2008, 04:26 AM
Post #7


Level 51
Group Icon

Group: Revolutionary
Posts: 1,573
Type: Scripter
RM Skill: Advanced




Not sure how to use this actualy...


__________________________
Art from the highest shelf?

Scriptology, scripting podcast



HUD's Request Lobby (multiple hud-scripts)


------------------------------------------------------------------

Random Stuff
OMG, it's Hab!!


This is a crazy drawing application! (by me)

How did I learned to script
QUOTE
Hey pim! I'm the Law G14!

For the past couple of months I've been learning RGSS and I've got the basic stuff down such windows, variables, conditional statements, ect. But, I can't see myself making big scripts such as a jumping system or a side view battle system. I was wondering how you learned to script because I really want to know how to script really well.

Thanks in advance.


Hey there,

Well I don't make battle neither though I can still teach you some things :)...
The way I've learned to script is by reading other scripts for the most part.
I've allways been interested in other peoples work but this time I though I had to try to make something myself...and it worked!!
The most importand thing when you go scripting is (at least in my case) that you want to make something to help an other wich can't script.
You also need to feel the competition that's around in the scripting-community.
Cause, I have to say, if you get pushed to get a sertain request done before an other scripter does, you feel POWERFULL!! :P
So that's an other thing...
You also don't need to be afraid to learn from others or helpfiles.
When I write my scripts, I actualy always have the helpfiles open to look things up I don't know or remember.
Then, you must be calm, cause you need to try the script a lot of times.
When I write a script, I test it after almost every changes.
First I set up the major structure.
Like when I make a window-script or part of a script I start with something like this:
CODE
class Window_Name < Window_Base
def initialize(x,y,width,height)
super(x,y,width,height)
refresh
end

def refresh
self.contents.clear
draw_contents
end

def draw_contents
draw_something(with, some, parameters)
end

def update
refresh if @something != @what_it_should_be
end
end
So that's also very important.
Then, the biggest thing I learned scripting from is TRIAL AND ERROR.
That's the most irritating way to learn something, cause it's more ERROR than TRIAL, but it does the trick realy good.

So that's it how I did it.
Now it's up to you.
Do some requests (if I didn't do it allready :P) and learn from them.

Hope that helped you out a little.
If not, keep your eye on the Scriptology-topic (see my sig) where I'll be updating for my scripting(video)tutorials.
Perhaps they're going to be usefull for you one day ;)


Greatzz,
SojaBird.
Go to the top of the page
 
+Quote Post
   
cmpsr2000
post Jun 23 2008, 06:26 AM
Post #8


Keeper of the Ruby Code of DOOM!
Group Icon

Group: Revolutionary
Posts: 355
Type: Scripter
RM Skill: Masterful




QUOTE (pim321 @ Jun 23 2008, 06:40 AM) *
Not sure how to use this actualy...

If you are adding an item to the menu you add the Menu Patch script file in at the end of the project right before main. Then, instead of re-writing the Scene_Menu, you build a menuItem array (see above) then insert it into $game_menu. This part has to be done after the $data_ objects are loaded, so the best place is create_game_objects in scene_title. Anywhere in your code after materials you would add:
CODE

class Scene_Title < Scene_Base
alias oldCreateGameObj_SCRIPTNAME create_game_objects
def create_game_objects
oldCreateGameObj_SCRIPTNAME
menuItem = YOUR_MENU_ITEM
$game_menu.insert(INSERTION_POINT, menuItem)
end
end


__________________________
Go to the top of the page
 
+Quote Post
   
SojaBird
post Jun 23 2008, 08:25 AM
Post #9


Level 51
Group Icon

Group: Revolutionary
Posts: 1,573
Type: Scripter
RM Skill: Advanced




cool, thanks


__________________________
Art from the highest shelf?

Scriptology, scripting podcast



HUD's Request Lobby (multiple hud-scripts)


------------------------------------------------------------------

Random Stuff
OMG, it's Hab!!


This is a crazy drawing application! (by me)

How did I learned to script
QUOTE
Hey pim! I'm the Law G14!

For the past couple of months I've been learning RGSS and I've got the basic stuff down such windows, variables, conditional statements, ect. But, I can't see myself making big scripts such as a jumping system or a side view battle system. I was wondering how you learned to script because I really want to know how to script really well.

Thanks in advance.


Hey there,

Well I don't make battle neither though I can still teach you some things :)...
The way I've learned to script is by reading other scripts for the most part.
I've allways been interested in other peoples work but this time I though I had to try to make something myself...and it worked!!
The most importand thing when you go scripting is (at least in my case) that you want to make something to help an other wich can't script.
You also need to feel the competition that's around in the scripting-community.
Cause, I have to say, if you get pushed to get a sertain request done before an other scripter does, you feel POWERFULL!! :P
So that's an other thing...
You also don't need to be afraid to learn from others or helpfiles.
When I write my scripts, I actualy always have the helpfiles open to look things up I don't know or remember.
Then, you must be calm, cause you need to try the script a lot of times.
When I write a script, I test it after almost every changes.
First I set up the major structure.
Like when I make a window-script or part of a script I start with something like this:
CODE
class Window_Name < Window_Base
def initialize(x,y,width,height)
super(x,y,width,height)
refresh
end

def refresh
self.contents.clear
draw_contents
end

def draw_contents
draw_something(with, some, parameters)
end

def update
refresh if @something != @what_it_should_be
end
end
So that's also very important.
Then, the biggest thing I learned scripting from is TRIAL AND ERROR.
That's the most irritating way to learn something, cause it's more ERROR than TRIAL, but it does the trick realy good.

So that's it how I did it.
Now it's up to you.
Do some requests (if I didn't do it allready :P) and learn from them.

Hope that helped you out a little.
If not, keep your eye on the Scriptology-topic (see my sig) where I'll be updating for my scripting(video)tutorials.
Perhaps they're going to be usefull for you one day ;)


Greatzz,
SojaBird.
Go to the top of the page
 
+Quote Post
   
danesopeezy89
post Jul 7 2008, 12:37 PM
Post #10


Level 7
Group Icon

Group: Revolutionary
Posts: 108
Type: Artist
RM Skill: Skilled




so does this mean we can remove a menu option too?
Go to the top of the page
 
+Quote Post
   
cmpsr2000
post Jul 7 2008, 11:34 PM
Post #11


Keeper of the Ruby Code of DOOM!
Group Icon

Group: Revolutionary
Posts: 355
Type: Scripter
RM Skill: Masterful




QUOTE (danesopeezy89 @ Jul 7 2008, 02:51 PM) *
so does this mean we can remove a menu option too?


Yes, you can use all the standard array methods, so you can use $game_menu.delete_at(INDEX) or $game_menu.delete(OBJECT) for deleting objects from the array.


__________________________
Go to the top of the page
 
+Quote Post
   
dougman0988
post Aug 15 2008, 07:58 PM
Post #12


Level 6
Group Icon

Group: Member
Posts: 80
Type: None
RM Skill: Skilled




I keep getting this error after I've put in the Menu Patch:

Script 'Menu Patch' line 28: SyntaxError occurred.

This is what I have written there:

#menu item 4
menuItem = ["Quests", "Quest Script", true, nil]
$game_menu.insert(4, menuItem)

I'm trying to use the Quest script and the Crafting script but I can't get this to work. I'm new to scripting so I'm having trouble with it. Can someone help me out please? Thanks!


__________________________
"Jecht saw his first shoopuf here. Surprised, he drew his blade and struck it." -Auron
Go to the top of the page
 
+Quote Post
   
jens009
post Aug 15 2008, 08:25 PM
Post #13


L Did you know? Death gods... only eat apples
Group Icon

Group: +Gold Member
Posts: 2,976
Type: Scripter
RM Skill: Skilled




Very useful indeed! Now we can adapt an extra menu command option simply by using this.'

Another question if you don't mind. Say for example I'm using a custom menu. So long as I'm using a command window everything would be fine correct? But suppose the script adds on to a picture oriented menu, then a problem would occur. (I think).

It's really useful to make our scripts more user-friendly but it can also have its limitation. And when it comes to that, it doesn't hurt to do it the old fashion way. XD

Thanks for this nice patch. Hopefully many scripters would use it.

QUOTE (dougman0988 @ Aug 15 2008, 08:20 PM) *
I keep getting this error after I've put in the Menu Patch:

Script 'Menu Patch' line 28: SyntaxError occurred.

This is what I have written there:

#menu item 4
menuItem = ["Quests", "Quest Script", true, nil]
$game_menu.insert(4, menuItem)

I'm trying to use the Quest script and the Crafting script but I can't get this to work. I'm new to scripting so I'm having trouble with it. Can someone help me out please? Thanks!


Well, it's not really calling on anything. You've written it yourself, call nil.
But in any case, this script is meant to be a scripter's tool.


__________________________

My RMXP Project:


Farewell RRR. =]
Go to the top of the page
 
+Quote Post
   
cmpsr2000
post Aug 15 2008, 09:30 PM
Post #14


Keeper of the Ruby Code of DOOM!
Group Icon

Group: Revolutionary
Posts: 355
Type: Scripter
RM Skill: Masterful




QUOTE (dougman0988 @ Aug 15 2008, 10:20 PM) *
I keep getting this error after I've put in the Menu Patch:

Script 'Menu Patch' line 28: SyntaxError occurred.

This is what I have written there:

#menu item 4
menuItem = ["Quests", "Quest Script", true, nil]
$game_menu.insert(4, menuItem)

I'm trying to use the Quest script and the Crafting script but I can't get this to work. I'm new to scripting so I'm having trouble with it. Can someone help me out please? Thanks!


"quest script" needs to be evaluatable code, not a simple string. You need to follow the instructions above to determine the proper code.


__________________________
Go to the top of the page
 
+Quote Post
   
dougman0988
post Aug 16 2008, 12:46 PM
Post #15


Level 6
Group Icon

Group: Member
Posts: 80
Type: None
RM Skill: Skilled




"Quest Script" is the name of the script I've put in my script editor. Does that string need to reference something else?
The syntax error is on line 28, which was this part:

$game_menu.insert(4, menuItem)

I'm not sure which code is the proper code. Thanks for putting up with me ^^;


__________________________
"Jecht saw his first shoopuf here. Surprised, he drew his blade and struck it." -Auron
Go to the top of the page
 
+Quote Post
   
dougman0988
post Aug 16 2008, 01:19 PM
Post #16


Level 6
Group Icon

Group: Member
Posts: 80
Type: None
RM Skill: Skilled




QUOTE (jens009 @ Aug 15 2008, 07:47 PM) *
Very useful indeed! Now we can adapt an extra menu command option simply by using this.'

Another question if you don't mind. Say for example I'm using a custom menu. So long as I'm using a command window everything would be fine correct? But suppose the script adds on to a picture oriented menu, then a problem would occur. (I think).

It's really useful to make our scripts more user-friendly but it can also have its limitation. And when it comes to that, it doesn't hurt to do it the old fashion way. XD

Thanks for this nice patch. Hopefully many scripters would use it.

QUOTE (dougman0988 @ Aug 15 2008, 08:20 PM) *
I keep getting this error after I've put in the Menu Patch:

Script 'Menu Patch' line 28: SyntaxError occurred.

This is what I have written there:

#menu item 4
menuItem = ["Quests", "Quest Script", true, nil]
$game_menu.insert(4, menuItem)

I'm trying to use the Quest script and the Crafting script but I can't get this to work. I'm new to scripting so I'm having trouble with it. Can someone help me out please? Thanks!


Well, it's not really calling on anything. You've written it yourself, call nil.
But in any case, this script is meant to be a scripter's tool.



If I'm trying to use the Quest Script what should I put in place of nil?


__________________________
"Jecht saw his first shoopuf here. Surprised, he drew his blade and struck it." -Auron
Go to the top of the page
 
+Quote Post
   
Ninja Commander
post Aug 17 2008, 02:10 AM
Post #17


Level 1
Group Icon

Group: Member
Posts: 10
Type: Developer
RM Skill: Skilled




Cmpsr, I am not a scripter at all, so what you do seems like magic to me, but I have looked at alot of your scripts (and used a few, as well), and I think you are a genius, and I am very impressed by the rate at which you crank these things out. Keep up the good work, sir!


__________________________
...he says, furrowing his brow.
Go to the top of the page
 
+Quote Post
   
cmpsr2000
post Aug 18 2008, 12:30 AM
Post #18


Keeper of the Ruby Code of DOOM!
Group Icon

Group: Revolutionary
Posts: 355
Type: Scripter
RM Skill: Masterful




QUOTE (dougman0988 @ Aug 16 2008, 03:08 PM) *
"Quest Script" is the name of the script I've put in my script editor. Does that string need to reference something else?
The syntax error is on line 28, which was this part:

$game_menu.insert(4, menuItem)

I'm not sure which code is the proper code. Thanks for putting up with me ^^;


I'm honestly not sure, I'd have to take a look in the script. Basically you are looking for the custom scene call. Inside the code for the quest script, find the Scene_Menu redefinition and look for a line that says "$scene =" followed by something quest-related. If the scripter followed standard conventions, it should be something like "$scene = Scene_Quest.new"

QUOTE (Ninja Commander @ Aug 17 2008, 04:32 AM) *
Cmpsr, I am not a scripter at all, so what you do seems like magic to me, but I have looked at alot of your scripts (and used a few, as well), and I think you are a genius, and I am very impressed by the rate at which you crank these things out. Keep up the good work, sir!


Thanks dude b^^b Unfortunately I've been a bit slow lately due to too many real life responsibilities. I'm hoping that things are a little more settled now, and I hope to be updated most of my scripts within the next month to address issues.


__________________________
Go to the top of the page
 
+Quote Post
   
dougman0988
post Aug 18 2008, 09:18 AM
Post #19


Level 6
Group Icon

Group: Member
Posts: 80
Type: None
RM Skill: Skilled




Here is the entire script for the Quest Script:

=begin

Quest Script v2.2 Free of Bugs by Samo, the thief.
Ported to RPG Maker VX by Mecha (aka. MechaGS)

(This has been ported fully so that it doesn't require the RPG Maker XP
Compatibility Script.)


I removed the Enournmous header and there is a more simple one.

Ok, this is posted because there was too much people that had the version 2.1 and it had too much bugs.
The thing is that that version was my first script. Now i have advanced greatly much in scripting, and
there is this new and refixed v.

~I see the script at the same than last v., what does it have of new?

-Bugs removed when saving and loading
-Advanced Text Paragrapher included, now you only do a long line and it will
be automatically paragraphed.
-More simple way to create quests.
-Removed stupid global variables
-Faster.


~How to install this? (Edited by MechaGS for RPG Maker VX Installation)

-Add the following script to a new slot above Main
-Go to Scene_Title and add after the line:

$game_player = Game_Player.new

#----------------ADD BEGIN------------------------
$quest = {}
#-----------------ADD END-------------------------

~How to create a quest?

At the start of your game in a call script, you can set up your quests or
on the fly using the same method but on events, player interactions, etc.

Make sure you go in increments of 1, so stars with the number being 0, then
1, 2, 3 etc.


~Call Code:

$quest[x] = Quest.new(name, image, line, difficulty, state)
x will be a number.

An example being:-
$quest[0] = Quest.new("New Title", "Image Name" ,"Line 1", "Line 2",
"Line 3", Line4", 3, 1)

If there's lines you don't need, just leave them as blank "" so it doesn't
register.

~Great, but, the Quest is always the same, I want to update it, how?
$quest[x].parameter = value

parameter will be one of these values:

name
image
state_number
difficulty_level
line1
line2
line3
line4

The value you choose from above will be the next value of the parameter.

An example of usage would be:-
$quest[0].state_number = 4

That would update the Quests state number to show that the Quest had been
completed.


~What Resources Do I Need?
There are images in the Graphics/Pictures folder of this demo you will need
for the script to work.


~Saving / Loading Quests
In this build, saving Quests is different on game save then the RPG Maker XP
Method. You need to add 2 Commands to the Scene_File Script in order
for Saving / Loading to work.

Go to Scene_File and add after the line:-

Marshal.dump($game_player, file)

#----------------ADD BEGIN------------------------
Marshal.dump($quest, file)
#-----------------ADD END-------------------------

Then, also in Scene_File, add after the line:-

$game_player = Marshal.load(file)

#----------------ADD BEGIN------------------------
$quest = Marshal.load(file)
#-----------------ADD END-------------------------

Now, you can save your Quest Activities!


~Do you have something more to say?
-Yes, if you find a bug report it.
-If you like this new version, please, say it.
-If you have a suggestion, please, post it.

Good luck!
Samo, the thief. <-- Original Creator --> (Creation Asylum)
Mecha (aka. MechaGS) <-- Ported to VX --> (GameSkank)
=end

#8 and 9 colors were done by me, and i replaced the def in window_base.
# if you want a new color, just add another when statement and copy the line.
#the color can be created more easily whith the script generator of Dubealex.

#Samo's Quest script begins

#==============================================================================
# ■ Window_Command_Quest
# created for complete color feature
#------------------------------------------------------------------------------

class Window_Command_Quest < Window_Selectable
#--------------------------------------------------------------------------
def initialize(width, commands)
super(0, 0, width, commands.size * 32 + 32)
@item_max = commands.size
@commands = commands
self.contents = Bitmap.new(width - 32, @item_max * 32)
refresh
self.index = 0
end
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i, normal_color)
end
end
#--------------------------------------------------------------------------
def draw_item(index, color)
self.contents.font.color = color
rect = Rect.new(4, 24 * index, self.contents.width - 8, 24)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[index])
end
#--------------------------------------------------------------------------
def disable_item(index)
draw_item(index, text_color(7))
end
#-----------------ADDED-----------------------------------------------
def complete_item(index)
draw_item(index, text_color(10))
end
#---------------------------------------------------------------------
def just_finish_item(index)
draw_item(index, text_color(6))
end
end
#Command_Quest ends here, it doesn't replace the original window_command.

#---------------------------------------------------
#===================================================
# - CLASS Scene_Quest Begins
#===================================================
#---------------------------------------------------
class Scene_Quest

#---------------------------------------------------------------------------------
#---------------------------------------------------------------------------------
def initialize(quest_index = 0)
@quest_index = quest_index
$MAP_BACKGROUND = true #Map Background. True or false? set it as you wish.
@quest_options = []
end

#------------------------------------------------

def main
if $MAP_BACKGROUND
@spriteset = Spriteset_Map.new
end
@window5 = Window_Quest_Diary.new
@window5.z= 300

for i in 0.. $quest.size - 1
name = $quest[i].name
@quest_options.push(name)
end
@command_window = Window_Command_Quest.new(160, @quest_options)
@command_window.index = @quest_index
@command_window.z = 255
@command_window.height = 150
for i in 0.. $quest.size - 1
if $quest[i].state_number == 1
@command_window.disable_item(i)
elsif $quest[i].state_number == 4
@command_window.complete_item(i)
elsif $quest[i].state_number == 3
@command_window.just_finish_item(i)
end
end
Graphics.transition (20)
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.transition
Graphics.freeze
@command_window.dispose
@quest_options.clear
@window5.dispose
if $MAP_BACKGROUND
@spriteset.dispose
end
$quest_seen = false
end
#---------------------------------------------------------------------------------

#---------------------------------------------------------------------------------
def update
@command_window.update
if @command_window.active
update_command
return
end
if Input.trigger?(Input::cool.gif
if @command_window.active == false
Sound.play_cancel
@command_window.active = true
@window1.dispose
@window2.dispose
@window3.dispose
@window4.dispose
else
Sound.play_cancel

#if you want that when you exit it calls the menu, just put a # before
# $scene = Scene_Map.new and delete the # in $scene = Scene_Menu.new
#$scene = Scene_Menu.new
$scene = Scene_Map.new
end

return
end
end
#---------------------------------------------------------------------------------
def update_command
if Input.trigger?(Input::cool.gif
Sound.play_cancel
$scene = Scene_Map.new
return
end
if Input.trigger?(Input::C)

for i in 0.. $quest.size - 1
case @command_window.index
when i
if $quest[i].state_number == 1
Sound.play_buzzer
return
end
Sound.play_decision
$ACTUAL_QUEST = $quest[i]
update_quest
end
end
end
end

def update_quest
@command_window.active = false
@window1 = Window1.new
@window2 = Window2.new
@window3 = Window_Difficulty.new
@window4 = Window_Status_Quest.new
@window1.z= 220
@window2.z= 200
@window3.z= 230
@window4.z= 230
end

end


class Window1 < Window_Base

#---------------------------------------------------------------------------------
def initialize
super(100, 5, 445,100)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Comic Sans MS"
self.contents.font.size = 30
self.contents.font.color = text_color(3) #color of name
self.contents.draw_text(50, 20, 400, 40, $ACTUAL_QUEST.name)
end


#--------------------------------

#--------------------------------
end



class Window2 < Window_Base

#---------------------------------------------------------------------------------
def initialize
super(5, 110, 535,300)


self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Comic Sans MS"
self.contents.font.size = 26
self.contents.font.color = text_color(0) # color of quest lines
src_rect = Rect.new(0, 0, 500, 100) # pictures can be 480x80
image = Cache.picture($ACTUAL_QUEST.image)
self.contents.blt(10, 10, image, src_rect, 255)
self.contents.draw_text(20, 100, 500, 33, $ACTUAL_QUEST.line1)
self.contents.draw_text(20, 120, 500, 33, $ACTUAL_QUEST.line2)
self.contents.draw_text(20, 140, 500, 33, $ACTUAL_QUEST.line3)
self.contents.draw_text(20, 160, 500, 33, $ACTUAL_QUEST.line4)
#paragraph = str_paragraph($ACTUAL_QUEST.line, 800)
#draw_paragraph(20,100,500,33,paragraph)
end

end
#---------------------------------------------------------------------------------
# this window puts the difficulty.
class Window_Difficulty < Window_Base
def initialize
super(5, 340, 240, 70)


self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Comic Sans MS"
self.contents.font.size = 20
self.opacity = 0
self.contents.font.color = system_color
self.contents.draw_text(10, 2, 80, 33, "Difficulty: ")
self.contents.font.color = text_color($ACTUAL_QUEST.difficulty[0])
self.contents.draw_text(100, 2, 100, 33, $ACTUAL_QUEST.difficulty[1])
end

end


#---------------------------------------------------



class Window_Status_Quest < Window_Base
def initialize
super(300, 340, 240, 70)


self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Comic Sans MS"
self.contents.font.size = 20
self.opacity = 0
self.contents.font.color = system_color
self.contents.draw_text(10, 2, 80, 33, "Status: ")
self.contents.font.color = text_color(0)
self.contents.draw_text(100, 2, 100, 33, $ACTUAL_QUEST.state)
end

end
#---------------------------------------------------



class Window_Quest_Diary < Window_Base
def initialize
super(416, 28, 120, 60)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Comic Sans MS"
self.contents.font.size = 20
self.opacity = 255
self.contents.font.color = text_color(4)
self.contents.draw_text(0, 0, 100, 33, "Quest Diary")
end

end


#______________________________________________________________________________
#______________________________________________________________________________
#================================================================
#================================================================
#================================================================
#QUEST CLASS BY SAMO
#The main proccess. This creates the quests and returns their name, lines, etc.
#Only the #EDITABLE can be modified. Don't touch something else.
#================================================================
#================================================================
#================================================================
#______________________________________________________________________________
#______________________________________________________________________________




class Quest

attr_accessor :name
attr_accessor :image
attr_accessor :line1
attr_accessor :line2
attr_accessor :line3
attr_accessor :line4
attr_reader :difficulty_level
attr_reader :state_number
attr_reader :difficulty
attr_reader :state

#-----------------------------------------------------
def initialize(name, image, line1, line2, line3, line4, difficulty_level, state_number)
@name = name
@image = image
@line1 = line1
@line2 = line2
@line3 = line3
@line4 = line4
@difficulty_level = difficulty_level
set_difficulty_name
@state_number = state_number
set_state_name
end

#-----------------------------------------------------
def set_state_name#EDITABLE change the strings and if you want add another
#when statement

case @state_number
when 0
@state = "------"
when 1
@state = "In Progress"
when 2
@state = "Looking for"
when 3
@state = "Just finished"
when 4
@state = "Complete"

end
end
#-----------------------------------------------------
def set_difficulty_name
case @difficulty_level#EDITABLE#case of the level of difficulty. To add another difficulty
#just put another when statement and copy the line. the values are
# [color, "name of difficulty"]
when 0 #Nothing
@difficulty = [0, " "]
when 1 #VERY EASY
@difficulty = [8, "VERY EASY"]
when 2 #EASY
@difficulty = [4, "EASY"]
when 3 #NORMAL
@difficulty = [3, "NORMAL"]
when 4 #HARD
@difficulty = [2, "HARD"]
when 5 #EXTRA HARD
@difficulty = [9, "EXTRA HARD"]
end
end
def name
if @state_number == 1
return '----'
else
return @name
end
end

def state_number=(value)
@state_number = value
set_state_name
end

def difficulty_level=(value)
@difficulty_level = value
set_difficulty_name
end


end


#-----THE FINAL END-------------

class Scene_Save < Scene_File

alias samo_new_save write_save_data

def write_save_data(file)
File.open(Quests, "Quests") { |f|
Marshal.dump(obj, f)
}
end
end


class Scene_Load < Scene_File

alias samo_new_load read_save_data

def read_save_data(file)
File.open(Quests, "Quests") { |f|
obj = Marshal.load(f)
}

end
end


#---------------


=begin

ATP(Advanced Text Paragrapher) V1.0 by Samo, The thief

Ok, Something of The Scripters do normally to draw a text in form of a paragraph is
doing an array [] that contains each line. The Time Has come For
This Microsoft Word Effect!
This Script Just need a Long String and it will paragraph it!

How to call it?

paragraph = str_paragraph(string, width of the paragraph.)

Example :

@my_paragraph = str_paragraph("La la la la la la la la la , This is a Looooong Strriiiing!", 120)


Returns an Array with each line separately.

How to draw it?

draw_paragraph(x,y,width,height, paragraph)

width and height for each line, not for the paragraph.

.::-NOTE-::.

If you put a ' ^ '(must be between spaces), the text will pass to the next line.
This Symbol Won't be drawed.

Reminder: Always use '' instead of ""! It works faster!

=end

class Window_Base < Window
#--------------------------------------------------
def str_paragraph(str_old, width)
temp_str = ''
str = '' + str_old
words = []
size = 0
str_size = 0
#
while ((c = str.slice!(/./m)) != nil)
temp_str += c
str_size += 1
if c == ' '
words.push(temp_str)
temp_str = ''
end
if str.size == 0
words.push(temp_str)
temp_str = ''
end
end
lines = []
for i in 0...words.size
word = words[i]
if word == '^ '
lines.push(temp_str)
temp_str = ''
next
end
temp_str += word
size = contents.text_size(temp_str).width
if size > width - contents.text_size(' ').width
for i in 1..word.size
temp_str = temp_str.chop
end
lines.push(temp_str)
temp_str = ''
temp_str += word
end
end
words = words.compact
if temp_str != ''
lines.push(temp_str)
end
return lines
end
#---------------------------------------------------------------------
def draw_paragraph(x,y,width,height,lines,align = 0)
for i in 0...lines.size
self.contents.draw_text(x, y + i * self.contents.font.size + 1, width, height, lines[i], align)
end
end
#-----------------------------------------------------------------

end


I've looked it all through but I'm not sure I'm finding what I need to find. I did try just plugging in the $scene line you gave me but I'm still getting the same exact syntax error.


__________________________
"Jecht saw his first shoopuf here. Surprised, he drew his blade and struck it." -Auron
Go to the top of the page
 
+Quote Post
   
332211
post Aug 21 2008, 05:27 PM
Post #20


Waiting for an epiphany
Group Icon

Group: Revolutionary
Posts: 180
Type: Scripter
RM Skill: Advanced




@dougman0988 in case you haven't figured it out yet
CODE
class Scene_Title < Scene_Base
alias oldCreateGameObj_Quest_Log create_game_objects
def create_game_objects
oldCreateGameObj_Quest_Log
menuItem = ["Quest Log", "$scene = Scene_Quest.new",false,nil]
$game_menu.insert(4, menuItem) #change the number 4 to change the position in the menu
end
end


@cmpsr2000
this is a really useful tool (I mean it, cause it does save a lot of time) thanks.gif


__________________________
Go to the top of the page
 
+Quote Post
   

2 Pages V   1 2 >
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 18th May 2013 - 06:14 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker