DragonPrime - LoGD Resource Community
Welcome Guest
  • Good evening, Guest.
    Please log in, or register.
  • July 18, 2018, 08:22:45 PM
Home Forums News Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Login
 
 
Resource Pages
Search

Pages: [1]   Go Down
  Print  
Author Topic: stable addon  (Read 4109 times)
0 Members and 1 Guest are viewing this topic.
sixf00t4
Mod God
*****
Offline Offline

Posts: 1916



View Profile WWW
« on: November 24, 2005, 05:52:49 AM »

ok, inspired from the talk about having a stable in any village, if you wanted them, i created this module.  but i'm having 2 problems that i'm not sure how to go about...so i haven't.

the first...the "fine mount" array.  How can i store an array like that in a pref?  I haven't tried anything yet.  

second, the stableloc hook.  how can i return all the villages there in one swoop?  Right now, you have to go to each village, then to the grotto and go to the add a mount screen, and it will add the location.

so, it all works functionally, but those two things prevent it from being flawless.

http://dragonprime.net/users/sixf00t4/stablesaddon.zip
« Last Edit: November 24, 2005, 08:25:43 AM by sixf00t4 » Logged

XChrisX
Global Moderator
Mod God
*****
Offline Offline

Posts: 4647

Be aware of the squirrel!


View Profile WWW
« Reply #1 on: November 24, 2005, 06:23:04 AM »

storing arrays is quite simple...

set_module_pref("myarray", serialize($myarray));

to get the array back:

$myarray = unserialize(get_module_pref("myarray"));
Logged

Running for more than three years now:
sixf00t4
Mod God
*****
Offline Offline

Posts: 1916



View Profile WWW
« Reply #2 on: November 24, 2005, 06:38:48 AM »

serialize!  thanks!  i couldnt find an example in code anywhere... I am such a copy&paster:)

for the stableloc, i'm thinking of inserting, through sql, each location where the "addstable" is turned on.  not the prettiest way, but it should work.  not sure about getting them out of their though...
Logged

sixf00t4
Mod God
*****
Offline Offline

Posts: 1916



View Profile WWW
« Reply #3 on: November 24, 2005, 06:40:44 AM »

err, wait.

the array should be editable through module prefs, the manager doesnt serialize when saved.....
Logged

XChrisX
Global Moderator
Mod God
*****
Offline Offline

Posts: 4647

Be aware of the squirrel!


View Profile WWW
« Reply #4 on: November 24, 2005, 06:58:35 AM »

err, wait.

the array should be editable through module prefs, the manager doesnt serialize when saved.....

No, serialize turns the array into a string... You *could* edit that string but it's very likely you break something... If you want the values editable, you'll have to either write your own editor OR make multiple prefs...
Logged

Running for more than three years now:
sixf00t4
Mod God
*****
Offline Offline

Posts: 1916



View Profile WWW
« Reply #5 on: November 24, 2005, 07:11:22 AM »

yeah, that's what I was trying to avoid...

eh, we'll split it up.
Logged

sixf00t4
Mod God
*****
Offline Offline

Posts: 1916



View Profile WWW
« Reply #6 on: November 24, 2005, 08:32:12 AM »

hmm, ok, just got rid of the array for the fine beast...

now, the second one, the hook is wanting 1 location value returned in the form of "the village of $cityname"...but i want to return more than one...I uploaded the version that selects all locations that have an added stable turned on...
Logged

XChrisX
Global Moderator
Mod God
*****
Offline Offline

Posts: 4647

Be aware of the squirrel!


View Profile WWW
« Reply #7 on: November 24, 2005, 08:39:12 AM »

racehuman, line 242-246
Code:
   case "stablelocs":
      tlschema("mounts");
      $args[$city]=sprintf_translate("The Village of %s", $city);
      tlschema();
      break;

Now just go:
Code:
$args[$city1] = $bla1;
$args[$city2] = $bla2;

So you can add multiple Cities at once... (In fact... I think, you ONLY need to do this for every city... Nothing else needed...) (and unblocking the stable-nav in *every* city... Smiley )
Logged

Running for more than three years now:
Pages: [1]   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
28 Guests, 0 Users
Home Forums News Downloads Login Register Advanced Search