DragonPrime - LoGD Resource Community
Welcome Guest
  • Good evening, Guest.
    Please log in, or register.
  • November 19, 2018, 10:04:23 PM
Home Forums News Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Login
 
 
Resource Pages
Search

Pages: [1] 2   Go Down
  Print  
Author Topic: Removing Charstats  (Read 8700 times)
0 Members and 1 Guest are viewing this topic.
RaynDarren
Mod God
*****
Offline Offline

Posts: 732


View Profile WWW
« on: September 28, 2016, 03:11:27 PM »

So, I'm working on a template for my new site. What I need to do is block all char stats completely. I've managed to get the actual char stats blocked using the htm file, but, all the data is still there in several long lines. How do I get rid of them?

Additionally, I need to block navs where are you do not have the option to chat, but ONLY on this theme, Is that possible? if so, how?

Any help would be greatly appreciated.
Thanks,
~Rayn
Logged

MarcTheSlayer
Mod God
*****
Offline Offline

Posts: 1747


View Profile
« Reply #1 on: October 13, 2016, 08:00:30 AM »

Removing the char stats isn't easy as they're coded to always show, even when you're in the grotto. I wouldn't know where to begin after all these years.

To block navs based on a person's template is easy though as the template name is stored in a cookie. Get said cookie and if the name is what you're looking for then block the navs.

Code:
$_COOKIE['template']

Smiley
Logged

Check My Modules for the latest versions.
Maverick
Captain of the Guard
***
Offline Offline

Posts: 122


View Profile
« Reply #2 on: October 13, 2016, 12:18:54 PM »

I've managed to get the actual char stats blocked using the htm file, but, all the data is still there in several long lines. How do I get rid of them?

I'm confused with what you mean? Can you post a picture of the 'several long lines' so I can get a better idea of what you're trying to accomplish?
Logged
Aeolus
Mod God
*****
Offline Offline

Posts: 1906


You're welcome.


View Profile WWW
« Reply #3 on: October 13, 2016, 02:43:58 PM »

Have you looked at using the wipe_charstats() function? If you hook into the charstats hook with a high priority number (i.e. so it runs last), you'll remove all of your charstats.

It's what some sites use when they hide the charstats when a new MotD is posted, so players are forced to read it.
Logged

RaynDarren
Mod God
*****
Offline Offline

Posts: 732


View Profile WWW
« Reply #4 on: October 14, 2016, 03:03:37 PM »

Removing the char stats isn't easy as they're coded to always show, even when you're in the grotto. I wouldn't know where to begin after all these years.

To block navs based on a person's template is easy though as the template name is stored in a cookie. Get said cookie and if the name is what you're looking for then block the navs.

Code:
$_COOKIE['template']

Smiley

Thanks Afkamm!

I've managed to get the actual char stats blocked using the htm file, but, all the data is still there in several long lines. How do I get rid of them?

I'm confused with what you mean? Can you post a picture of the 'several long lines' so I can get a better idea of what you're trying to accomplish?

I'm afraid I can't, but, if you go to http://testbox.rpglink.in/home.php?, create a character and select the mythrp template you'll see right off what I'm talking about.


Have you looked at using the wipe_charstats() function? If you hook into the charstats hook with a high priority number (i.e. so it runs last), you'll remove all of your charstats.

It's what some sites use when they hide the charstats when a new MotD is posted, so players are forced to read it.

I haven't tried that no, haven't ever heard of it actually, I've never looked at the code in the force read MotD module. Thanks so much for the suggestion, it's been driving me crazy.
« Last Edit: October 14, 2016, 03:43:12 PM by RaynDarren » Logged

Sunday
Codemeister
****
Offline Offline

Posts: 399


So meme'd up.


View Profile
« Reply #5 on: October 17, 2016, 10:36:51 AM »

Removing the char stats isn't easy as they're coded to always show, even when you're in the grotto. I wouldn't know where to begin after all these years.

To block navs based on a person's template is easy though as the template name is stored in a cookie. Get said cookie and if the name is what you're looking for then block the navs.

Code:
$_COOKIE['template']

Smiley

Thanks Afkamm!

I've managed to get the actual char stats blocked using the htm file, but, all the data is still there in several long lines. How do I get rid of them?

I'm confused with what you mean? Can you post a picture of the 'several long lines' so I can get a better idea of what you're trying to accomplish?

I'm afraid I can't, but, if you go to http://testbox.rpglink.in/home.php?, create a character and select the mythrp template you'll see right off what I'm talking about.


Have you looked at using the wipe_charstats() function? If you hook into the charstats hook with a high priority number (i.e. so it runs last), you'll remove all of your charstats.

It's what some sites use when they hide the charstats when a new MotD is posted, so players are forced to read it.

I haven't tried that no, haven't ever heard of it actually, I've never looked at the code in the force read MotD module. Thanks so much for the suggestion, it's been driving me crazy.

Sorry that it took you this long to receive answers. I am not sure if wipe_charstats() would work here - there are no hooks to intercept $charstat_info before getcharstats() is ran, I believe. Don't quote me there, because I haven't used it at all.

Is this usage in just one template, or the entire site? If it is just for one template, I advise to use CSS to hide the stats, and maybe JavaScript after to destroy it after the page has loaded entirely. That would just require your template to be edited. Otherwise the easiest way would be through the everyfooter hook, manipulating the $footer global before page_footer() does in lib/pageparts.php (forget the line #). All you have to do in that hook is a simple str_replace() of {stats} in $footer. Keep in mind that you need to not have any CSS rules for your stats section, and move the {paypal} template part for this to look right. If you are running this on any core template, it will look odd!

I will attach an example to get you started, good luck with your customization. Smiley
Logged

Slowly progressing fork with PHP 7 support: https://github.com/stephenKise/Legend-of-the-Green-Dragon
Cheap VPS Hosting (10$ credit!): https://m.do.co/c/acde75b086c5

A new server in the making...
RaynDarren
Mod God
*****
Offline Offline

Posts: 732


View Profile WWW
« Reply #6 on: October 17, 2016, 05:21:10 PM »

I've loaded the module you posted Stephen, thank you. Now, to get it to work for only that one template. I've tried a prefs hook, which didn't work.

Code:
    'prefs'=>array(
'Template,title',
'mythrp' => 'Use MythRP template?,bool|1',
),

The getmoduleinfo function is set up in a way I'm unfamiliar with, so I'm not even sure if I set the pref correctly.

It did wipe the nearly three pages of "WARNING! XXXXX does not exist" that I was getting though, so that's good.

Should I use a pref?
« Last Edit: November 10, 2016, 04:55:07 PM by RaynDarren » Logged

RaynDarren
Mod God
*****
Offline Offline

Posts: 732


View Profile WWW
« Reply #7 on: November 10, 2016, 04:56:31 PM »

::Bump::
Logged

Sunday
Codemeister
****
Offline Offline

Posts: 399


So meme'd up.


View Profile
« Reply #8 on: November 12, 2016, 10:29:02 AM »

I've loaded the module you posted Stephen, thank you. Now, to get it to work for only that one template. I've tried a prefs hook, which didn't work.

Code:
    'prefs'=>array(
'Template,title',
'mythrp' => 'Use MythRP template?,bool|1',
),

The getmoduleinfo function is set up in a way I'm unfamiliar with, so I'm not even sure if I set the pref correctly.

It did wipe the nearly three pages of "WARNING! XXXXX does not exist" that I was getting though, so that's good.

Should I use a pref?

Well, you could check if the $_COOKIE['template'] value is set to 'MythRP'.
Logged

Slowly progressing fork with PHP 7 support: https://github.com/stephenKise/Legend-of-the-Green-Dragon
Cheap VPS Hosting (10$ credit!): https://m.do.co/c/acde75b086c5

A new server in the making...
RaynDarren
Mod God
*****
Offline Offline

Posts: 732


View Profile WWW
« Reply #9 on: November 12, 2016, 11:17:28 AM »

Thanks! Might there be somewhere in the code I could look at that would have this set already? Examples are good, Smiley.
Logged

Maverick
Captain of the Guard
***
Offline Offline

Posts: 122


View Profile
« Reply #10 on: November 13, 2016, 06:58:24 AM »

Thanks! Might there be somewhere in the code I could look at that would have this set already? Examples are good, Smiley.

Might be something in lib/pageparts.php.

However, if you use debug($_COOKIE['template']); in RawPHP it will return something like 'jade.htm'

So if you want to set something for a specific template, you could use:

if ($_COOKIE['template'] == 'MythRP.htm') { }
Logged
RaynDarren
Mod God
*****
Offline Offline

Posts: 732


View Profile WWW
« Reply #11 on: November 14, 2016, 12:04:21 PM »

Awesome! Thanks!
Logged

Mr-Coincidental
Militia
**
Offline Offline

Posts: 8


View Profile
« Reply #12 on: December 10, 2016, 08:05:45 AM »

in the html file for template

find <td class="stats">

and replace with <td class="stats" style="display: none;">

that will hide all the stats
Logged
Sunday
Codemeister
****
Offline Offline

Posts: 399


So meme'd up.


View Profile
« Reply #13 on: December 10, 2016, 10:37:35 AM »

in the html file for template

find <td class="stats">

and replace with <td class="stats" style="display: none;">

that will hide all the stats
Templates shouldn't be in tables, and it is better to modularize it rather than editing all templates.
Logged

Slowly progressing fork with PHP 7 support: https://github.com/stephenKise/Legend-of-the-Green-Dragon
Cheap VPS Hosting (10$ credit!): https://m.do.co/c/acde75b086c5

A new server in the making...
Mr-Coincidental
Militia
**
Offline Offline

Posts: 8


View Profile
« Reply #14 on: December 10, 2016, 11:30:29 AM »

i dunno, for mine i just edited the html for the template i wanted to do it on, the template already had tables in it, so i just added that to hide the whole thing..

The original post says that he just wants to do it for a new template he is making, so surely that's the easiest way?
« Last Edit: December 10, 2016, 11:35:38 AM by Mr-Coincidental » Logged
Pages: [1] 2   Go Up
  Print  
 
Jump to:  


*
DragonPrime Notices
Play LoGD on Dragonprime

Support Us
No funds raised yet this year
Your help is greatly appreciated!
Recent Topics
DragonPrime LoGD
Who's Online
47 Guests, 0 Users
Home Forums News Downloads Login Register Advanced Search