DragonPrime - LoGD Resource Community
Welcome Guest
  • Good evening, Guest.
    Please log in, or register.
  • September 05, 2010, 08:20:34 PM
Home Forums News Links Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Login
 
 
Resource Pages
IRC Channels
Search

Pages: [1]   Go Down
  Print  
Author Topic: Spelling Bee Forest Specials by DaveS V 3.12  (Read 3476 times)
0 Members and 1 Guest are viewing this topic.
DaveS
Mod God
*****
Offline Offline

Posts: 1543


Dfly... you know, as in DaveFly


View Profile
« on: August 01, 2005, 02:11:20 PM »

Module Name:  Spelling Bee
Category:  Forest Specials
Worktitle:  spellingbee
Version: 3.12
Author:  DaveS

Description:
This mod is a fun forest special with several options.

A random event pulls the player onto a stage to participate in a spelling bee officiated by a bee. The player has to answer 3 questions correctly to win the contest.  They always have the option of attacking the bee.

Here are the consequences of each action:
1.  Winning the Spelling Bee:  Gain 200+50/level gold + 2 ffs + news
2.  Lose the Spelling Bee:  Lose 1 ff + news
3.  Attack Bee and Win:  Gain exp, gain 1 gold, lose 1 ff, and gain the buff "Speling Powre". + news
4.  Attack Bee and Lose:  Die, Lose 10% exp, and lose all gold.  + news

In addition, the spelling words are randomized with 4 different words for each of the 3 rounds.

The Spelling Bee ends with one of four animal based jokes.

Available for Download at:
http://dragonprime.net/index.php?module=Downloads;sa=dlview;id=178

See my other modules here:
http://dragonprime.net/index.php?topic=3038.0
« Last Edit: January 28, 2008, 02:08:24 PM by 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
Sichae
iMod God
SVN Users
Mod God
*
Offline Offline

Posts: 3458


If ya didn't get it by now... you're hopeless...


View Profile WWW
« Reply #1 on: August 01, 2005, 02:19:32 PM »

You should post links...
Logged

If you didn't understand anything in the above post, don't try to attempt anything suggested.

DaveS
Mod God
*****
Offline Offline

Posts: 1543


Dfly... you know, as in DaveFly


View Profile
« Reply #2 on: August 01, 2005, 02:37:04 PM »

Links added to all of them Smiley!
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
umk
Member
Militia
**
Offline Offline

Posts: 97


PHP Student


View Profile WWW
« Reply #3 on: November 16, 2005, 10:22:24 PM »

i think i found a bug.

for some reason the player name does not get included in the news page?

Quote
won the First Annual Spelling Bee in the forest!
Logged

DaveS
Mod God
*****
Offline Offline

Posts: 1543


Dfly... you know, as in DaveFly


View Profile
« Reply #4 on: November 16, 2005, 10:47:34 PM »

V3.01 Updated

Hey! you're right about that!

Dang, can't believe i was missing that one...

i'll fix that right away.

Thanks!!
« Last Edit: November 16, 2005, 10:49:19 PM by 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
umk
Member
Militia
**
Offline Offline

Posts: 97


PHP Student


View Profile WWW
« Reply #5 on: November 16, 2005, 10:51:57 PM »

no problem, i found the bug a few weeks ago, but didn't have the time to post here and i kinda forgot about it till i saw it in the news in my game again Smiley
« Last Edit: November 17, 2005, 10:55:07 PM by umk » Logged

DaveS
Mod God
*****
Offline Offline

Posts: 1543


Dfly... you know, as in DaveFly


View Profile
« Reply #6 on: November 30, 2005, 10:33:01 PM »

Version 3.1:

Several changes:

1.  Fixed a couple minor bugs
2.  Cleaned up a little for translation
3.  Split into folder
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
DaveS
Mod God
*****
Offline Offline

Posts: 1543


Dfly... you know, as in DaveFly


View Profile
« Reply #7 on: February 10, 2006, 08:24:48 AM »

v3.11

Not a major upgrade... but I decided that the news would keep a running total for what number spelling bee the player just won.  I mean, it seemed silly that everyone kept winning the "First Annual Spelling Bee".  Instead, players now win the "xth Interspecies Spelling Bee".

Doesn't that just make life so much better?
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
pearl
Guest
« Reply #8 on: March 28, 2006, 02:21:51 PM »

I installed it, but it still says it's version 3.1
Logged
DaveS
Mod God
*****
Offline Offline

Posts: 1543


Dfly... you know, as in DaveFly


View Profile
« Reply #9 on: March 28, 2006, 08:44:17 PM »

The version that you had there is correct; the only thing I didn't do was update the version number.

I decided that I would not tempt the Gods of Irony by making a newer version to fix the lack of noting the older new version.

So I fixed that little itty bitty thingy but no new version number.

Thanks for pointing it out though!
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
sixf00t4
Mod God
*****
Offline Offline

Posts: 1916



View Profile WWW
« Reply #10 on: January 28, 2008, 10:19:13 AM »

from a petition:

Quote
Shouldn't that be 21st? It's in the news.

Farmboy Jeromiah won the 21th Interspecies Spelling Bee in the forest!
Logged

DaveS
Mod God
*****
Offline Offline

Posts: 1543


Dfly... you know, as in DaveFly


View Profile
« Reply #11 on: January 28, 2008, 01:59:17 PM »

V3.12

Welll... this is going to take a bit more wit than I have to solve the problem.  I've added the code to make it so the first 110 spelling bees have the appropriate modifier... however I'm struggling with how to make the X11th, X12th, and X13th spelling bees work.

The challenge:  Any integer that has 11, 12, or 13 violates the rest of the number series:  1st, 11th, 21st, 31st, 41st, etc.  Come up with code so that the number is called correct for ALL integers.

Here's what I did for the first 110 numbers:
Code:
$numberpost=array("th","st","nd","rd","th");
$numbwin=get_module_setting("annualnumb");
if ($numbwin>10 && $numbwin<14) $numbwin=4;
else $numbwin=$numbwin-((floor($numbwin/10))*10);
if ($numbwin>=4) $numbwin=4;

Who can do it??
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
sixf00t4
Mod God
*****
Offline Offline

Posts: 1916



View Profile WWW
« Reply #12 on: January 30, 2008, 09:36:58 AM »

http://www.talkphp.com/tips-tricks/204-tutorial-getting-th-st-rd-ordinal-suffixes-numbers-dates.html
Logged

Afkamm
Mod God
*****
Offline Offline

Posts: 975


View Profile WWW
« Reply #13 on: August 02, 2008, 07:36:18 AM »

Got some code off of the internet (where else? heh).

Code:
#
#-----[ FILE ]-----
#
modules/spellingbee.php

#
#-----[ FIND ]-----
#
$numberpost=array("","st","nd","rd","th");

#
#-----[ REPLACE WITH ]-----
#
if( substr($value, -2, 2) == 11 || substr($value, -2, 2) == 12 || substr($value, -2, 2) == 13 )
{
$suffix = 'th';
}
elseif( substr($value, -1, 1) == 1 )
{
$suffix = 'st';
}
elseif( substr($value, -1, 1) == 2 )
{
$suffix = 'nd';
}
elseif( substr($value, -1, 1) == 3 )
{
$suffix = 'rd';
}
else
{
$suffix = 'th';
}

#
#-----[ FIND ]-----
#
addnews("`@%s won the `^%s%s Interspecies Spelling Bee `@in the forest!",$session['user']['name'],get_module_setting("annualnumb"),$numberpost[$numbwin]);

#
#-----[ REPLACE WITH ]-----
#
addnews("`@%s won the `^%s%s Interspecies Spelling Bee `@in the forest!",$session['user']['name'],get_module_setting("annualnumb"),$suffix);

Logged

Buck
Militia
**
Offline Offline

Posts: 8


View Profile
« Reply #14 on: September 26, 2008, 03:29:00 AM »

Pardon me, but:

Code:
elseif( substr($value, -1, 1) == 3 )

is terrible! it's ugly and inefficient.

Better is:

Code:
elseif( $value % 10 == 3 )

Leading to:

Code:
<?
    $number = rand(0,200000);

    echo $number . getnumbersuffix( $number );

    function getnumbersuffix( $number ) {

        if (! is_numeric($number)) { return; };

        $numberpost=array("","st","nd","rd","th");

        if( ($number % 100 < 21) && ($number % 100 > 3) ) {
            $suffix = "th";
        } else {
            if( ($number % 10 > 0) && ($number % 10 < 4) ) {
                $suffix = $numberpost[$number % 10];
            } else {
                $suffix = "th";
            }
        }

        return $suffix;
    }
?>
« Last Edit: September 26, 2008, 03:30:43 AM by Buck » Logged
Pages: [1]   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!
Who's Online
28 Guests, 4 Users
Rawr_mel, Iori, Cory2, Oak
DragonPrime LoGD
Recent Topics
Home Forums News Links Downloads Login Register Advanced Search