JK_DirectShop - Skip buy/sell window on purchase/sell only

Pirobi

Veteran
Veteran
Joined
Oct 25, 2015
Messages
65
Reaction score
85
First Language
English
Primarily Uses
JK_DirectShop v1.5
Author: Pirobi and JK Software

Introduction
This simple script will, for shop commands where "PurchaseOnly" is checked, go directly to the buy screen. I decided to do this because it seemed redundant to have to still navigate that window if you aren't allowed to sell, and, if I recall correctly, it was like this in previous versions of RPG Maker.

In addition, this script can allow users to have a "SellOnly" shop that works the same way. Plugin commands are used to simulate this(see the Plugin Commands section below).

How to Use
Please save the script below into "JK_DirectShop.js" and put it in your plugins folder.
In the plugins window, place this plugin BELOW any other Shop Plugins.

When you check "PurchaseOnly" in the editor for a shop command, the shop will become a BuyOnly shop. If it is checked when trying to do a SellOnly shop, nothing changes and it will still be a SellOnly shop. Use normal shop processing and uncheck "PurchaseOnly" to function as the default shop. You can also use the plugin commands for the same effect.


Plugin Commands
DirectBuy
- This will make the NEXT shop command called a purchaseOnly shop.
DirectSell
- This will make the NEXT shop command called a sellOnly shop.

If using the plugins, they must be called each time BEFORE the shop processing is called because the shop will "reset" after the processing ends.

Script
JK_DirectShop Plugin

Compatibility
This script will work with other shop plugins, as long as this plugin is placed BELOW any other shop plugins.


Credit and Thanks
- Pirobi and JK Software


Release History

-1.5: PurchaseOnly checkbox in Shop Processing no longer matters DirectSell is called. Using proper aliasing to call shop for normal shop situations. As of 1.5, this should definitely be compatible with other shop systems as a plug and play!

-1.4:
So I don't really remember doing the 1.3 update....Anyway, minor fixes so that the plugin performs as expected.

-1.3: Simplified the code to make it more compatible with other Shop plugins

-1.2: Added functionality for a "SellOnly" option, which is missing from the default shop options(I'm 99% sure this was a thing in past makers). A plugin command is available to do that (I even added a command for the purchase only).

-1.1: Moved the gold window to below the status window(the window on the right side), and moved the buy and status windows up to fill in the space left by removing the buy/sell window. As this rewrites the original Scene_Shop and related windows, it is NOT recommended to use this plugin in conjunction with other scripts that also modify the shop scene, due to unforeseen behavior.

-1.0: Initial release
 
Last edited:

Joronjo

Veteran
Veteran
Joined
Sep 17, 2015
Messages
155
Reaction score
29
First Language
English Spanish
Primarily Uses
This feels like it would be perfect for a vending machine
 

AnnTenna

Villager
Member
Joined
Jan 14, 2016
Messages
24
Reaction score
12
First Language
Russian
Primarily Uses
Thanks for a great plugin!
Do you want to make Direct Sell?
I find it would be very useful for my game. ^_^
 

Pirobi

Veteran
Veteran
Joined
Oct 25, 2015
Messages
65
Reaction score
85
First Language
English
Primarily Uses
Thanks for a great plugin!
Do you want to make Direct Sell?
I find it would be very useful for my game. ^_^
Direct Sell would be a little harder to implement, but I can see what I can do. 
 

AnnTenna

Villager
Member
Joined
Jan 14, 2016
Messages
24
Reaction score
12
First Language
Russian
Primarily Uses
Many thanks for the quick response!


I am happy and I hope that it does not have much more difficult.  I tried to do it myself, I did not succeed. 
 

Pirobi

Veteran
Veteran
Joined
Oct 25, 2015
Messages
65
Reaction score
85
First Language
English
Primarily Uses
Many thanks for the quick response!


I am happy and I hope that it does not have much more difficult.  I tried to do it myself, I did not succeed. 


Okay, so I did it haha. I will modify my original post, so please be sure to look at that for more details on the update. 


Essentially, I added a plugin command to allow for Direct Sell (Since there's no box in the shop command for that)(I also added a command for DirectBuy for consistency). You will need to call this plugin every time you want to call the shop where you want to Sell only.


If there are any issues that come up with using it, please let me know!
 

AnnTenna

Villager
Member
Joined
Jan 14, 2016
Messages
24
Reaction score
12
First Language
Russian
Primarily Uses
Yes !!!!


This is what I need! Thank you! I add this plugin to the game.


Just have small problem: the plugin don't seem compatible with "No Item Categories"




I don't know, if you can see it .... In any case, please take my big respect!


PS 1% - Previously, it was similarly! 0_0
 

Pirobi

Veteran
Veteran
Joined
Oct 25, 2015
Messages
65
Reaction score
85
First Language
English
Primarily Uses
Yes !!!!


This is what I need! Thank you! I add this plugin to the game.


Just have small problem: the plugin don't seem compatible with "No Item Categories"





I don't know, if you can see it .... In any case, please take my big respect!


PS 1% - Previously, it was similarly! 0_0


It would be more difficult to make our scripts compatible, unfortunately, since we are overriding the same functions :(  
 

AnnTenna

Villager
Member
Joined
Jan 14, 2016
Messages
24
Reaction score
12
First Language
Russian
Primarily Uses
Ok.  :)  I will not use No Item Categories, because JK_DirectShop more necessary for my game.
 

AnnTenna

Villager
Member
Joined
Jan 14, 2016
Messages
24
Reaction score
12
First Language
Russian
Primarily Uses
My friend made a plugin that provides compatibility.
View attachment DE79_DirectShopNoCategoriesComposer.js
 

//=============================================================================
// DE79_DirectShopNoCategoriesComposer.js
//=============================================================================

/*:
* @plugindesc fix compatibility between JK_DirectShop and NoItemCategories
* @author DE79
* *
* @help This plugin does not provide plugin commands.
* Version 1.0
*
*/

(function() {

Scene_Shop.prototype.createCategoryWindow = function() {
this._categoryWindow = new Window_ItemCategory();
this._categoryWindow.setHelpWindow(this._helpWindow);
this._categoryWindow.y = (this._sellOnly) ? this._helpWindow.y + this._helpWindow.height : this._dummyWindow.y;
this._categoryWindow.hide();
this._categoryWindow.deactivate();
this._categoryWindow.setHandler('ok', this.onCategoryOk.bind(this));
this._categoryWindow.setHandler('cancel', this.onCategoryCancel.bind(this));
this.addWindow(this._categoryWindow);
};

Scene_Shop.prototype.createSellWindow = function() {
var wy = (this._sellOnly) ? this._helpWindow.height : this._helpWindow.height + this._categoryWindow.height;
var wh = (this._sellOnly) ? Graphics.boxHeight - wy - this._goldWindow.height : Graphics.boxHeight - wy;
this._sellWindow = new Window_ShopSell(0, wy, Graphics.boxWidth, wh);
this._sellWindow.setHelpWindow(this._helpWindow);
this._sellWindow.hide();
this._sellWindow.setHandler('ok', this.onSellOk.bind(this));
if (this._sellOnly) {
this._sellWindow.setHandler('cancel', this.popScene.bind(this));
this._sellWindow.activate();
this._sellWindow.select(0);
} else {
this._sellWindow.setHandler('cancel', this.onSellCancel.bind(this));
this._sellWindow.select(0);
}
this.addWindow(this._sellWindow);
};

})();



But I have another problem. In Firefox (only) bug when entering the store:


fox.png
 

Pirobi

Veteran
Veteran
Joined
Oct 25, 2015
Messages
65
Reaction score
85
First Language
English
Primarily Uses
@AnnTenna, at first glance, that error looks like it is in the core JS file, not in my plugin. Could you send me a picture of your debug console when the error occurs?
 

AnnTenna

Villager
Member
Joined
Jan 14, 2016
Messages
24
Reaction score
12
First Language
Russian
Primarily Uses
I apologize for the delay. The error occurs only in browser. I don't understand what is required. Perhaps you would like to see this.


oaa.png


ss2jpg_3954648_20937807.jpg
 
Last edited by a moderator:

Liquidize

Caffeine Overload
Developer
Joined
Nov 1, 2015
Messages
466
Reaction score
459
First Language
English
Primarily Uses
RMMV
I would need to attempt to reproduce this, I'm not sure why it is happening.
 

Henryetha

Veteran
Veteran
Joined
Jan 14, 2016
Messages
387
Reaction score
206
First Language
german
Primarily Uses
Hi! 


This error occured when I clicked an unsellable Item (0 Gold), which - however - appeared in the sell windows (a sell only shop).

sell shop.png
 
Last edited by a moderator:

Pirobi

Veteran
Veteran
Joined
Oct 25, 2015
Messages
65
Reaction score
85
First Language
English
Primarily Uses
@Henryetha I have tried to reproduce your issue but it seems to work on my end...could you please send me a demo containing your issue?
 

queenchrom

Villager
Member
Joined
Mar 30, 2016
Messages
9
Reaction score
3
First Language
English
Primarily Uses
Do you know if this plugin will conflict with Yanfly's Shop Core?
 

Pirobi

Veteran
Veteran
Joined
Oct 25, 2015
Messages
65
Reaction score
85
First Language
English
Primarily Uses
@queenchrom I do not believe so, since this plugin rewrites and sets some of the windows to fixed positions, but I could investigate more/find a way to make the two compatible.
 

Pirobi

Veteran
Veteran
Joined
Oct 25, 2015
Messages
65
Reaction score
85
First Language
English
Primarily Uses
Do you know if this plugin will conflict with Yanfly's Shop Core?


I have updated the script to that it will (hopefully, only testing by users will find out for sure!) be compatible with any shop plugins. The only condition is that this script be listed AFTER the other shop plugin. For example, if you use Yanfly's Shop core, list that script BEFORE this one in the plugin list. And it should work :D
 

Pirobi

Veteran
Veteran
Joined
Oct 25, 2015
Messages
65
Reaction score
85
First Language
English
Primarily Uses
@queenchrom With the new update, this plugin should no longer conflict with Yanfly's Shop plugin. All I did was make the buy/sell screen active when the shop is called, so that the shop itself can be created using anyone's plugins(so long as this plugin is placed below it).
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

So, uh, has anyone tried buying any resources from KokoroReflections? Because I've been looking for a 'buy' button on the site for like 10 minutes now and can't find one.
Any also thought it's too cringy to put the word "and you" in your credit as a special thanks?
Cause that's what I thought...
Everyone in the US right now: Please stay safe.
Symphony Celestia: Prophecy of the Falling Stars RPG Maker music pack WIP. Symphony Celestia is a new series that focuses on symphonic and orchestrated music to tell a story. Each story will include compositions that make up that story from beginning to end. Themes include: Battles, adventures, character themes, etc. Below is a video preview to the first story.

Jumping and gravitation 0.1 build - RPG Maker MV

Forum statistics

Threads
97,979
Messages
948,296
Members
129,240
Latest member
Gamer4500
Top