EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Quests::Q&A (https://www.eqemulator.org/forums/forumdisplay.php?f=599)
-   -   Looking for a way to make data_bucket increase... (https://www.eqemulator.org/forums/showthread.php?t=43046)

Nerdgasm 08-26-2020 10:49 PM

Looking for a way to make data_bucket increase...
 
Hey all, I'm looking for what to do to make this increase in increments when you hand the NPC another Spell Currency. I have the script working to where she will give you 1 currency, but I can't make it increase, then I guess I would also need the decrease too...

Code:

if(plugin::check_handin(\%itemcount, 2087 => 1))
                {
                        if(!quest::get_data($client->CharacterID() ."Spell_Currency"))
                        {
                                $key = $client->CharacterID() . "Spell_Currency";
                                $client->Message(315,"$npcname whispers to you, 'Thank you for this, $name. You now have 1 spell currency that you can use to buy an ability!'");
                                quest::set_data($key, 1);
                                $client->Message(315,"$npcname whispers to you, 'NOTE! You can only have ONE Spell Currency at a time! Do not turn more then 1 into me or you will NOT get credit.'");
                        }
                        elsif(quest::get_data($client->CharacterID() . "Spell_Currency"))
                        {
                                $key = $client->CharacterID() . "Spell_Currency";
                                $client->Message(315,"$npcname whispers to you, 'This means you have another currency.'");
                                quest::set_data($key, +1);
                        }
                }

I thought that would work, but it does not.

ondaphone 08-27-2020 06:04 AM

Code:

quest::set_data ($key, (quest::get_data ($key) + 1));
I believe is what you're after?

Nerdgasm 08-27-2020 06:13 AM

Quote:

Originally Posted by ondaphone (Post 265394)
Code:

quest::set_data ($key, (quest::get_data ($key) + 1));
I believe is what you're after?

Nice to know I was decently close, the next thing I tried was something similar but to no result.

Now do take one away, as when you 'buy' a spell, should just be

Code:

quest::set_data($key, (quest::get_Data ($key) - 1));
I mean, right?

Nerdgasm 08-27-2020 06:21 AM

Sure is, here is the script, so people can see examples if they need help, like I did!

Code:

if($class eq "Warrior")
                {
                        if($text=~/hail/i)
                        {
                                $client->Message(315,"$npcname whispers to you, 'My name is $npcname, I can help you [$train] in some spells if you have the required [$currency].'");
                        }       
                        elsif($text=~/train/i)
                        {
                                $client->Message(315,"$npcname whispers to you, 'As a Brawler you can learn abilities from three different [$trees].'");
                        }
                        elsif($text=~/currency/i)
                        {
                                $client->Message(315,"$npcname whispers to you, 'When you level up you get a new currency. Bring that to me and you will be able to buy a ability. Do you want to see how many spell token you [$have]?'");
                        }
                        elsif($text=~/trees/i)
                        {
                                $client->Message(315,"$npcname whispers to you, 'Yes, you can learn abilities from [$melee], [$warcries] or you can learn abilities from the [$combat] tree.'");
                        }
                        elsif($text=~/have/i)
                        {
                                if(quest::get_data($client->CharacterID() ."-Spell-Currency"))
                                {
                                        $key = $client->CharacterID() . "-Spell-Currency";
                                        $client->Message(315,"$npcname whispers to you, 'You have " . quest::get_data($key) . " spell currencies.'");
                                }
                                elsif(!quest::get_data($client->CharacterID() ."-Spell-Currency"))
                                {
                                        $client->Message(315,"$npcname whispers to you, 'You do not have a currency, level up and give one to me.'");
                                }
                        }
                        if(quest::get_data($client->CharacterID() ."-Spell-Currency"))
                        {
                                if($text=~/melee/i)
                                {
                                        $client->Message(315,"'Select Level'");
                                        $client->Message(315,"'[$L2] - [$L6] - [$L11]");
                                }
                                if($text=~/Level Two/i)
                                {
                                        $client->Message(315,"$npcname whispers to you, 'I can give you [$WW] at Level Two.'");
                                }
                                if($text=~/Whirlwind/i)
                                {
                                        $client->Message(315,"$npcname whispers to you, 'To make sure, you are Level Two, and you want Whirlwind R. I, if so, please say [$so]. These currencies are non-refundable and if you get a spell higher level then you, you will not be able to refund it for a spell your level. Please make sure you are the correct level.'");
                                }
                                if($text=~/so/i)
                                {
                                        $client->Message(315,"$npcname whispers to you, 'Alright, here you go, $name.'");
                                        quest::set_data ($key, quest::get_data ($key) - 1);
                                        quest::summonitem(447);
                                }
                        }
                }
                                else
                                {
                                        $client->Message(315,"$npcname whispers to you, '$name, you are not of the classes that I can help, please obtain server files from the MOTD link of Discord and come back. You won't regret it!'");
                                }
}

sub EVENT_ITEM
{
$npcname = "Raj";

        if($class eq "Warrior")
        {
                if(plugin::check_handin(\%itemcount, 2087 => 1))
                {
                        if(!quest::get_data($client->CharacterID() ."-Spell-Currency"))
                        {
                                $key = $client->CharacterID() . "-Spell_Currency";
                                $client->Message(315,"$npcname whispers to you, 'Thank you for this, $name. You now have 1 spell currency that you can use to buy an ability!'");
                                quest::set_data($key, 1);
                                $client->Message(315,"$npcname whispers to you, 'NOTE! You can only have ONE Spell Currency at a time! Do not turn more then 1 into me or you will NOT get credit.'");
                        }
                        elsif(quest::get_data($client->CharacterID() . "-Spell-Currency"))
                        {
                                $key = $client->CharacterID() . "-Spell-Currency";
                                $client->Message(315,"$npcname whispers to you, 'This means you have another currency.'");
                                quest::set_data ($key, quest::get_data ($key) + 1);
                        }
                }
        }
}

Probably an easier way to write it, but hey it works!


All times are GMT -4. The time now is 05:27 PM.

Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.