DragonPrime - LoGD Resource Community
Welcome Guest
  • Good evening, Guest.
    Please log in, or register.
  • July 21, 2018, 12:32:00 AM
Home Forums News Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Login
 
 
Resource Pages
Search

Pages: [1]   Go Down
  Print  
Author Topic: Addhook to a if ($op == "" ) line  (Read 4319 times)
0 Members and 1 Guest are viewing this topic.
DaveS
Mod God
*****
Offline Offline

Posts: 1544


Dfly... you know, as in DaveFly


View Profile
« on: September 08, 2005, 01:24:38 PM »

Okay, here's the situation:

I want to add a hook to Petra's tattoo parlor.  However, the location that i want to hook to is this line:

    if ($op == "" && $lasttat==0)

So in my module, I have

function quarry_install(){
    module_addhook("petra");


But what do I add to this section:

function quarry_dohook($hookname,$args){
 



It would SEEM like i should have:
        case "":

but i'm pretty darn sure that's not working.

Thanks!

DaveS
Logged

Check out my Last Module:
The Dragon Eggs Expansion
http://dragonprime.net/index.php?topic=8474.0

About my Retirement:
http://dragonprime.net/index.php?topic=9080

See my complete module list here:
http://dragonprime.net/index.php?topic=3038.0
GenmaC
Moderator
Codemeister
*****
Offline Offline

Posts: 430

Coder


View Profile WWW
« Reply #1 on: September 08, 2005, 02:32:11 PM »

You need to figure out whether you want the hook within the if statement or not.

Once you have done that, add this line:

modulehook("petra");

This will create a new hook.

However putting a new hook into a core module (is it a core module?) is never a good idea, as it will be overwritten when you upgrade.

Nextly, in your dohook function you need a switch statement like so:
Code:
switch($hookname){

case "petra":
              // do whatever
              break;

}
« Last Edit: September 08, 2005, 02:34:01 PM by GenmaC » Logged



Castle Siege - a work in progress
XChrisX
Global Moderator
Mod God
*****
Offline Offline

Posts: 4647

Be aware of the squirrel!


View Profile WWW
« Reply #2 on: September 08, 2005, 11:23:11 PM »

It is ABSOLUTELY NOT necessary to add this hook!

Simply hook into "footer-runmodule"

ind the dohook you have to check
Code:
if (httpget('module') == 'petra')
and then check for all the other conditions you want to have... No core editing necessary...
Logged

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

Posts: 2238


I'm a good girl.


View Profile WWW
« Reply #3 on: September 09, 2005, 03:53:19 AM »

Essentially, it is very rare that you ever need to add hooks to core modules or even edit core modules at all.

It's not that we want to discourage you from changing core modules - on the contrary, XChrisX has made changes to Petra that I want to go into the core (I just need a chance to edit out the pieces relating to houses). It's just that if there is a *very* good reason you can't do what you want to do, with the existing hooks, we would probably add it in the core file. Usually this means there is a better way to do what you're trying to do =)
Logged

SaucyWench
Owner of GemDust.com and Darton City proudly hosted by LunarPages
XChrisX
Global Moderator
Mod God
*****
Offline Offline

Posts: 4647

Be aware of the squirrel!


View Profile WWW
« Reply #4 on: September 09, 2005, 04:00:19 AM »

on the contrary, XChrisX has made changes to Petra that I want to go into the core (I just need a chance to edit out the pieces relating to houses).
I have? Petra was that nice young lady, painting tattoos on your body... Abigail was that nasty old thing, wandering around the village square, selling nonsense stuff to hard-working people Grin
Maybe my alter-ego has done things again without telling me, but I'm sure that the currently active part of me hasn't harmed Petra in any way... *lol*
Logged

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

Posts: 2238


I'm a good girl.


View Profile WWW
« Reply #5 on: September 09, 2005, 04:23:27 AM »

Lips Sealed

You know what? I cannot ever keep my own modules straight. I constantly mistake Petra for Heidi. Ask the Central staff how many times I have made a remark about new tattoos that Heidi is offering... and Petra's orange candle... somebody throw something at me. Preferably not the useless gifts that hawker Azrael keeps trying to sell you for Violet.
« Last Edit: September 09, 2005, 04:25:20 AM by SaucyWench » Logged

SaucyWench
Owner of GemDust.com and Darton City proudly hosted by LunarPages
XChrisX
Global Moderator
Mod God
*****
Offline Offline

Posts: 4647

Be aware of the squirrel!


View Profile WWW
« Reply #6 on: September 09, 2005, 04:33:52 AM »

And I thought I was going to punish myself for not telling me for what I have done...

You should try some male NPCs... It's more obvious if you make mistakes then...  Tongue
Logged

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

Posts: 2238


I'm a good girl.


View Profile WWW
« Reply #7 on: September 09, 2005, 04:45:53 AM »

Azrael is male Grin And not the one selling stuff... I have male NPCs, but they don't make it to core (well, except Azrael and Vernon, oh and probably others I have forgotten).
Logged

SaucyWench
Owner of GemDust.com and Darton City proudly hosted by LunarPages
XChrisX
Global Moderator
Mod God
*****
Offline Offline

Posts: 4647

Be aware of the squirrel!


View Profile WWW
« Reply #8 on: September 09, 2005, 04:54:41 AM »

Oh, yes... Vernon... Okay... Forgot about him... (Don't have this module running... )
Logged

Running for more than three years now:
Booger
Captain of the Guard
***
Offline Offline

Posts: 126


I'm a llama!


View Profile
« Reply #9 on: September 13, 2005, 03:54:22 AM »

* Booger throws fuirt at Saucy
Logged
CortalUX
Dwellings Project
Mod God
*****
Offline Offline

Posts: 796


Wogga! Meep!


View Profile WWW
« Reply #10 on: September 13, 2005, 06:11:32 AM »

* Booger throws fuirt at Saucy
* CortalUX throws fruity fuirt at Booger.
Logged
XChrisX
Global Moderator
Mod God
*****
Offline Offline

Posts: 4647

Be aware of the squirrel!


View Profile WWW
« Reply #11 on: September 13, 2005, 06:25:34 AM »

* Booger throws fuirt at Saucy
* CortalUX throws fruity fuirt at Booger.
* XChrisX joins the happy throwing and throws several smelly apples at anyone who likes...

 Roll Eyes

 Grin
Logged

Running for more than three years now:
Pages: [1]   Go Up
  Print  
 
Jump to:  


*
DragonPrime Notices
Please take the time to read the FAQ and browse the DragonPedia

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