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

Discussion in 'JS Plugin Releases (RMMV)' started by Pirobi, Jan 31, 2016.

  1. Pirobi

    Pirobi Veteran Veteran

    Messages:
    58
    Likes Received:
    81
    First Language:
    English
    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: Apr 30, 2018
    #1
    Chaos17, Mistral, AnnTenna and 2 others like this.
  2. Joronjo

    Joronjo Veteran Veteran

    Messages:
    155
    Likes Received:
    29
    First Language:
    English Spanish
    This feels like it would be perfect for a vending machine
     
    #2
    Pirobi likes this.
  3. AnnTenna

    AnnTenna Villager Member

    Messages:
    20
    Likes Received:
    9
    Location:
    Russia
    First Language:
    Russian
    Thanks for a great plugin!
    Do you want to make Direct Sell?
    I find it would be very useful for my game. ^_^
     
    #3
  4. Pirobi

    Pirobi Veteran Veteran

    Messages:
    58
    Likes Received:
    81
    First Language:
    English
    Direct Sell would be a little harder to implement, but I can see what I can do. 
     
    #4
    AnnTenna likes this.
  5. AnnTenna

    AnnTenna Villager Member

    Messages:
    20
    Likes Received:
    9
    Location:
    Russia
    First Language:
    Russian
    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. 
     
    #5
  6. Pirobi

    Pirobi Veteran Veteran

    Messages:
    58
    Likes Received:
    81
    First Language:
    English


    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!
     
    #6
    AnnTenna likes this.
  7. AnnTenna

    AnnTenna Villager Member

    Messages:
    20
    Likes Received:
    9
    Location:
    Russia
    First Language:
    Russian
    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
     
    #7
  8. Pirobi

    Pirobi Veteran Veteran

    Messages:
    58
    Likes Received:
    81
    First Language:
    English


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

    AnnTenna Villager Member

    Messages:
    20
    Likes Received:
    9
    Location:
    Russia
    First Language:
    Russian
    Ok.  :)  I will not use No Item Categories, because JK_DirectShop more necessary for my game.
     
    #9
  10. AnnTenna

    AnnTenna Villager Member

    Messages:
    20
    Likes Received:
    9
    Location:
    Russia
    First Language:
    Russian
    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
     
    #10
    Pirobi likes this.
  11. Pirobi

    Pirobi Veteran Veteran

    Messages:
    58
    Likes Received:
    81
    First Language:
    English
    @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?
     
    #11
  12. AnnTenna

    AnnTenna Villager Member

    Messages:
    20
    Likes Received:
    9
    Location:
    Russia
    First Language:
    Russian
    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: Mar 16, 2016
    #12
  13. Pirobi

    Pirobi Veteran Veteran

    Messages:
    58
    Likes Received:
    81
    First Language:
    English
    #13
  14. Liquidize

    Liquidize Caffeine Overload Developer

    Messages:
    466
    Likes Received:
    456
    Location:
    Somewhere.
    First Language:
    English
    Primarily Uses:
    RMMV
    I would need to attempt to reproduce this, I'm not sure why it is happening.
     
    #14
    Pirobi likes this.
  15. Henryetha

    Henryetha Veteran Veteran

    Messages:
    387
    Likes Received:
    205
    Location:
    Germany
    First Language:
    german
    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: Mar 29, 2016
    #15
    Pirobi likes this.
  16. Pirobi

    Pirobi Veteran Veteran

    Messages:
    58
    Likes Received:
    81
    First Language:
    English
    @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?
     
    #16
  17. queenchrom

    queenchrom Villager Member

    Messages:
    9
    Likes Received:
    3
    Location:
    Oregon
    First Language:
    English
    Do you know if this plugin will conflict with Yanfly's Shop Core?
     
    #17
  18. Pirobi

    Pirobi Veteran Veteran

    Messages:
    58
    Likes Received:
    81
    First Language:
    English
    @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.
     
    #18
  19. Pirobi

    Pirobi Veteran Veteran

    Messages:
    58
    Likes Received:
    81
    First Language:
    English


    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
     
    #19
  20. Pirobi

    Pirobi Veteran Veteran

    Messages:
    58
    Likes Received:
    81
    First Language:
    English
    @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).
     
    #20
    Chaos17 likes this.

Share This Page