News:

Join the Facebook Fan Page.

Main Menu

ST Shop

Started by Diego Andrés, June 13, 2009, 06:06:35 AM

Previous topic - Next topic

Chen Zhen

One of my members had mentioned something about this mod which I thought was a request but it seems he was trying to tell me this mod already includes integration with SMF Arcade. I just looked at the change log & can see that it was implemented back in November of 2020. I think you requested that I add custom hooks to SMF Arcade over 4 years ago which I'll assume this uses "integrate_arcade_score".

I'm not familiar with ST Shop just yet as I just installed it on a local. It doesn't seem to be adding any shop credits from arcade scores when I test it. The hook is working as it's shouting scores in EhPortal (which also uses the hook) but I can't seem to get it to work with this mod. Perhaps I'm not seeing an admin setting that needs to be set/triggered? Also I see something about including code via php file modules.. am I missing a module to get this to work with the Arcade?
 
I'll have to poke around with it to figure things out.

Nice work with this btw, I like it.. this looks like a fun mod.

My SMF Mods & Plug-Ins

WebDev

"Either you repeat the same conventional doctrines everybody is saying, or else you say something true, and it will sound like it's from Neptune." - Noam Chomsky

Diego Andrés

Thanks.

I haven't poked around with this MOD in a while. There should be a section in the settings area with integrations and it will display arcade settings which I believe are 3.

The default values are probably zero, so all you'd need to do is set them to the desired amount of credits. Let me know if it is not longer working as expected and I'll have a look.

Quote from: Chen Zhen on June 09, 2024, 11:28:01 PMAlso I see something about including code via php file modules.. am I missing a module to get this to work with the Arcade?
No such thing for the arcade. Only the available modules (not included by default) could be loaded/uploaded manually. Perhaps you saw the one for SA Battle. Modules are just 'functional' items that offer either a functionality or a reward when used.
https://github.com/SMFTricks/ST-Shop-Modules

SMF Tricks - Free & Premium Responsive Themes for SMF.

Chen Zhen


I've set those 3 boxes but it fails to add the credits when saving scores.

My SMF Mods & Plug-Ins

WebDev

"Either you repeat the same conventional doctrines everybody is saying, or else you say something true, and it will sound like it's from Neptune." - Noam Chomsky

Chen Zhen

I took a quick look & found the issue.
Here is a possible solution for you to get your score class to fire:
    /**
     * Arcade::defineHooks()
     *
     * Loads the hooks and languages for this addon
     */
    public static function defineHooks()
    {
        // Shop -> Admin -> Arcade settings
        if (isset($_REQUEST['action']) && isset($_REQUEST['area']) && $_REQUEST['action'] == 'admin' && $_REQUEST['area'] == 'shopsettings')
            add_integration_function('integrate_shop_addons_settings', __CLASS__ . '::settings', false);

        // Arcade -> Score submission
        if (function_exists('Arcade_who_fix'))
            add_integration_function('integrate_arcade_score', __CLASS__ . '::score', false);
    }

Arcade save types (mostly 3rd party) don't use URI's that directly go the arcade (action) page.
The site is directed to a game's high score page after the score is saved to the database.
This is why your class wasn't being fired.. The arcade will fire your class function once a score is saved to the database, Imo just use one of the Arcade's unique function identifiers as a check to see if the Arcade exists prior to adding your hook.

I haven't checked to see if the score class works 100% as intended just yet but it is working with this fix. 

My SMF Mods & Plug-Ins

WebDev

"Either you repeat the same conventional doctrines everybody is saying, or else you say something true, and it will sound like it's from Neptune." - Noam Chomsky

Diego Andrés

It might not even need a conditional to check if it exist. If the hook doesn't exist it should be skipped without errors because it's temporary?

SMF Tricks - Free & Premium Responsive Themes for SMF.

Chen Zhen

The code was posted just as an example. If you wanted to be more thorough you could use the condition to show the admin if the Arcade is detected or not detected in the settings.

These are just suggestions.. whatever you think will work best.

My SMF Mods & Plug-Ins

WebDev

"Either you repeat the same conventional doctrines everybody is saying, or else you say something true, and it will sound like it's from Neptune." - Noam Chomsky

Diego Andrés

public static function defineHooks()
{
add_integration_function('integrate_shop_addons_settings', __CLASS__ . '::settings', false);
add_integration_function('integrate_arcade_score', __CLASS__ . '::score', false);
}

Should work, no need to check anything.
I will test it when I have some more time.

SMF Tricks - Free & Premium Responsive Themes for SMF.

Advertisement: