se7enet purgatorio

Page 2 of 3 <123>
Topic Options
Rate This Topic
#18577 - 10/27/08 01:19 PM Re: skills [Re: Fayt]
EAL
Grape Nuts


Registered: 07/03/08
Posts: 31

Offline
I finished the fishing skill, but I couldn't get the switch command to work so i had to use the post elseif functions.

elseif ($do[0] == "buybait1") { buybait1(); }
elseif ($do[0] == "buybait2") { buybait2(); }

I read you said the switch commands are a lot smaller. So i was if you could do a example with three cases, and a link how the form action is suppose to look like cause i know how the regular post ones are suppose to look like.

<form action="index.php?do=buybait1" method="post"><input type="submit" name="buybait1 value="Buy Bait" ></form>.

I tried
<form action="index.php?do=buybait1" method="get"><input type="submit" name="buybait1" value="Buy Bait" ></form>

Top
#18580 - 10/27/08 03:22 PM Re: skills [Re: EAL]
Fayt
Crunchberries
***

Registered: 11/08/05
Posts: 1131
Loc: My Computer, USA

Offline
Because you don't know how to use it. That is why it doesn't work.

Here is the correct format which you should be using.

<?php

//If you need to include files do it here

if (isset($_GET["do"])) {
$do = explode(":",$_GET["do"]);

switch($do[0])
{
case 'bait':
bait();
break;

case 'bait2':
bait2();
break;

case 'fishing':
fishing();
break;

}
}

function bait() {
//All your beginning crap here

$page .= 'Welcome to the Bait Shop. Need Bait? I have some wonderful stuff here.';
$page .= 'Or you can return to <a href="index.php">town</a>';

}

function bait2() {
//BLAH BLAH BLAH
}

function fishing() {
// Beginning crap here again

$page .= 'Welcome to the fishing hole. You seem to have bait! so select a spot to fish.';

}
_________________________
MasterFayt - Amara 5 - Manas - Banar

Top
#18581 - 10/27/08 03:24 PM Re: skills [Re: Fayt]
Fayt
Crunchberries
***

Registered: 11/08/05
Posts: 1131
Loc: My Computer, USA

Offline
Also this is the correct link

<form action="fishing.php?do=bait" method="post"><input type="submit" name="buybait1 value="Buy Bait" ></form>

It is the exact same format as the other style. You wouldn't call the function or link it any different.
_________________________
MasterFayt - Amara 5 - Manas - Banar

Top
#18582 - 10/27/08 03:29 PM Re: skills [Re: Fayt]
EAL
Grape Nuts


Registered: 07/03/08
Posts: 31

Offline
thanks for your help.
Top
#18583 - 10/27/08 04:33 PM Re: skills [Re: gamefreak888]
AnmanIndustries
Cookie Crisp
*****

Registered: 03/21/05
Posts: 2876
Loc: Planet Stupid, AKA Earth

Offline
 Originally Posted By: basleijser
You don't need a switch just use functions and add them to index.php. Much easier.


This is standard practice and adding new lines will NOT noticeably slow down load times AT ALL. The index requests lib.php every single time it is accessed. And look at the size of that file. You think a few extra lines is going to damage your speed? Seriously, Fat, you are an idiot. Look at any major forum software. Their files are always massive. I had double the number of index functions in my DK game. Mad a fishes dick of difference.
_________________________
If you want me to punch you in the nuts go to:
http://www.AnmanIndustries.com

I'll do it for free too. Enjoy.

Top
#18587 - 10/27/08 09:42 PM Re: skills [Re: AnmanIndustries]
Fayt
Crunchberries
***

Registered: 11/08/05
Posts: 1131
Loc: My Computer, USA

Offline
I learn from a expert php programmer who has been coding for 10 years and there is not a single thing he doesn't know, he knows all the tricks of the trade. Using a PHP website on shared hosting is bad, it uses alot of queries and bandwidth (unless you have unlimited) and can overload the server quickly. So you need to use every trick possible to save your website from lagging or crashing. THE F'ING END
_________________________
MasterFayt - Amara 5 - Manas - Banar

Top
#18597 - 10/28/08 06:07 PM Re: skills [Re: Fayt]
AnmanIndustries
Cookie Crisp
*****

Registered: 03/21/05
Posts: 2876
Loc: Planet Stupid, AKA Earth

Offline
And Im sure people like George Bush has been doing politics for OVER 10 years too.
_________________________
If you want me to punch you in the nuts go to:
http://www.AnmanIndustries.com

I'll do it for free too. Enjoy.

Top
#18602 - 10/28/08 06:47 PM Re: skills [Re: AnmanIndustries]
Fayt
Crunchberries
***

Registered: 11/08/05
Posts: 1131
Loc: My Computer, USA

Offline
George bush rocks
_________________________
MasterFayt - Amara 5 - Manas - Banar

Top
#18610 - 10/30/08 06:56 AM Re: skills [Re: Fayt]
Justas
Corn Flakes


Registered: 08/30/08
Posts: 63

Offline
Could someone add skills as mod please?
\:\)

Top
#18611 - 10/30/08 08:11 AM Re: skills [Re: Justas]
Fayt
Crunchberries
***

Registered: 11/08/05
Posts: 1131
Loc: My Computer, USA

Offline
I tried teaching how to make them, but nobody listens.
_________________________
MasterFayt - Amara 5 - Manas - Banar

Top
#18616 - 10/30/08 01:38 PM Re: skills [Re: Fayt]
Justas
Corn Flakes


Registered: 08/30/08
Posts: 63

Offline
Maybe, nobody knows php as good as you know..
(Saying "nobody" I mean myself..)

Top
#18617 - 10/30/08 04:29 PM Re: skills [Re: Justas]
EAL
Grape Nuts


Registered: 07/03/08
Posts: 31

Offline
I listened to you and because of that I learned how.
Top
#18619 - 10/30/08 05:29 PM Re: skills [Re: EAL]
Fayt
Crunchberries
***

Registered: 11/08/05
Posts: 1131
Loc: My Computer, USA

Offline
We didn't finish the skill but ok.
_________________________
MasterFayt - Amara 5 - Manas - Banar

Top
#18622 - 10/30/08 07:12 PM Re: skills [Re: Fayt]
EAL
Grape Nuts


Registered: 07/03/08
Posts: 31

Offline
o. what was left?
Top
#18623 - 10/30/08 07:22 PM Re: skills [Re: EAL]
Fayt
Crunchberries
***

Registered: 11/08/05
Posts: 1131
Loc: My Computer, USA

Offline
The whole script
_________________________
MasterFayt - Amara 5 - Manas - Banar

Top
Page 2 of 3 <123>


Hop to:

se7enet

Barack Obama Logo