DragonPrime - LoGD Resource Community

Coding Support => Coding Support Desk => Topic started by: sixf00t4 on November 24, 2005, 05:52:49 AM



Title: stable addon
Post by: sixf00t4 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


Title: Re:stable addon
Post by: XChrisX 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"));


Title: Re:stable addon
Post by: sixf00t4 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...


Title: Re:stable addon
Post by: sixf00t4 on November 24, 2005, 06:40:44 AM
err, wait.

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


Title: Re:stable addon
Post by: XChrisX 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...


Title: Re:stable addon
Post by: sixf00t4 on November 24, 2005, 07:11:22 AM
yeah, that's what I was trying to avoid...

eh, we'll split it up.


Title: Re:stable addon
Post by: sixf00t4 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...


Title: Re:stable addon
Post by: XChrisX 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... :) )

© 2018 DragonPrime - LoGD Resource Community
Email Talisman: talisman -at- gmail.com
&oeXs)2U7=V BmܲV.U e=;p\}eG )Jj} C5EH7ˤH=j } mo|*Ŋw{drV_@IV>/- TFQJ׀̀Ve}l1,V O iNYx͘$e$;
Forums: Powered by SMF 1.1.21 | SMF © 2006-2007, Simple Machines