DragonPrime - LoGD Resource Community
Welcome Guest
  • Good evening, Guest.
    Please log in, or register.
  • July 27, 2017, 11:51:01 PM
Home Forums News Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Login
 
 
Resource Pages
Search

Pages: 1 [2]   Go Down
  Print  
Author Topic: Abigail - Core Module  (Read 483 times)
0 Members and 1 Guest are viewing this topic.
TGTarheel
Militia
**
Offline Offline

Posts: 81


View Profile
« Reply #15 on: July 05, 2017, 12:12:11 PM »

I will try your changes, thank you.

And I agree with you about allorefs.  It just plain flummoxes me, it does.

i guess I am just stupid.

Anyway, your changes now incoroorated.
Thank you, I will report back if there is a problem.
« Last Edit: July 05, 2017, 12:15:14 PM by TGTarheel » Logged
MarcTheSlayer
Mod God
*****
Offline Offline

Posts: 1738


View Profile
« Reply #16 on: July 05, 2017, 08:30:47 PM »

You're basically just putting all the prefs into an array which then only requires 1 pref to be stored in the database.
Logged

TGTarheel
Militia
**
Offline Offline

Posts: 81


View Profile
« Reply #17 on: July 05, 2017, 09:34:24 PM »

You're basically just putting all the prefs into an array which then only requires 1 pref to be stored in the database.

Just not used to it.  I avoid allprefs in my own coding, lol.

The module I coded from scratch myself, nost recently...probably an experienced coder would have used allprefs, but I just don't like them because it's unfamiliar to me.

Anyway, abilgail seems to be working right now...I turned on rawchance, so I could see the rawchance on village events, and she went to zero after I bought something.  So I think we got this.
Logged
MarcTheSlayer
Mod God
*****
Offline Offline

Posts: 1738


View Profile
« Reply #18 on: July 06, 2017, 07:46:04 AM »

There are positives and negatives to using any method. A big negative to allprefs is if you hook into a place like the village, it already has a large amount of modules loading and sql requests. The last thing you want to do is have a module load in a large array for 1 value.

Always try to remember that the host server has resource limits and you want pages to load fast. Smiley
Logged

TGTarheel
Militia
**
Offline Offline

Posts: 81


View Profile
« Reply #19 on: July 06, 2017, 10:13:18 AM »

There are positives and negatives to using any method. A big negative to allprefs is if you hook into a place like the village, it already has a large amount of modules loading and sql requests. The last thing you want to do is have a module load in a large array for 1 value.

Always try to remember that the host server has resource limits and you want pages to load fast. Smiley

Does allprefs actually make that mmuch difference in load speed, positive or negative?  Just curious.  Because I really don't like allprefs because it confuses me.
Logged
MarcTheSlayer
Mod God
*****
Offline Offline

Posts: 1738


View Profile
« Reply #20 on: July 06, 2017, 02:02:40 PM »

It does make a difference when used correctly, which can be said for any piece of code. And there's always more than one way to do a task, so when you write something, see if there's a more efficient way of doing it.

An example. The newday-runonce hook is probably the biggest hook there is as practically all modules will hook into it to reset something or other. A module could query the accounts table to get all the player ID's and then cycle through each one and use get_module_pref() to get data and then set_module_pref() to save it.

Nice and simple yes?

If there were 200 players then that would be 401 sql queries for just that one module.

Can't do much with saving, but getting the data you can ignore get_module_pref() and write your own query using "inner join" and reduce the query count by 200.

Think I might have gone off-topic, but I'll end with saying that splitting a module into multiple files is another gray area. By not having the whole file loading into memory then you use less server memory which is good, but some would argue against. Two and half a dozen. Smiley
Logged

Pages: 1 [2]   Go Up
  Print  
 
Jump to:  


*
DragonPrime Notices
Welcome to DragonPrime - The LoGD Resource Community!

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