|
|
 |
 |
 |
 |
|
 |
 |
|
 |
 |
|
 |
|
Quests::Q&A This is the quest support section |

04-01-2008, 09:54 PM
|
Discordant
|
|
Join Date: May 2006
Posts: 356
|
|
Try adding $max_level=undef; in the script at the end.
__________________
Random Segments of Code....
|

04-01-2008, 10:52 PM
|
Demi-God
|
|
Join Date: May 2007
Posts: 1,032
|
|
Quote:
Originally Posted by Aramid
Try adding $max_level=undef; in the script at the end.
|
won't this reset the variable every time script runs?
|

04-01-2008, 11:11 PM
|
|
Why even use the globals in this case seems to be overkill?
a simple if level 70 and you turn in the item the npc does a #level 71
if level 71 and you turn in the items the npc does #level 72
etc etc
dont feel like writing it up but you get the idea.
|

04-01-2008, 11:31 PM
|
Demi-God
|
|
Join Date: May 2007
Posts: 1,032
|
|
Quote:
Originally Posted by mattmeck
Why even use the globals in this case seems to be overkill?
a simple if level 70 and you turn in the item the npc does a #level 71
if level 71 and you turn in the items the npc does #level 72
etc etc
dont feel like writing it up but you get the idea.
|
yeah I was thinking the same thing, but still it is educational to know why the code won't work anyway.
btw I consulted the popular "credit card" code, and it indeed uses things such as $max_level=undef; after each adjustment statement.
I do not uderstand the processing logic behind it, but apperently this is how it supose to work
|
 |
|
 |

04-02-2008, 12:02 AM
|
 |
Developer
|
|
Join Date: Aug 2006
Location: USA
Posts: 5,946
|
|
Actually, in my real quest scripts, I do have:
Code:
{
$max_level=undef;
}
I only cut out the main part I was working on. I added in the sub EVENT_ITEM part before posting it.
The reason I want globals for this is mainly for my de-level quests. My server has quests to de-level characters to any level they want. Since my server's max level is 70, the quested levels have to be remembered so people can return to their previous level if it is higher than level 70. If I don't use globals on this quest, I will just have to use them on both different types of de-level quests (one is permanent and one is temporary). I figured I might as well define them here if possible.
Also, in reply to Mattmeck; I have a feeling that if qglobals doesn't work when turning in 1 item and having multiple different requirements for the same hand in, I am willing to bet that checking for character level would have the same problem. I will test it tonight. But, I think the issue is with the item check, and it won't let it be checked again for the other IFs. Actually, maybe it is the plugin. Maybe I can try it without it, but those plugins are handy.
Last edited by trevius; 04-02-2008 at 08:06 AM..
|
 |
|
 |

04-02-2008, 02:40 AM
|
Discordant
|
|
Join Date: May 2006
Posts: 356
|
|
2 Things that will make it work using the If statements.
1st, use different items for each handin. Using the SAME item each time for each level seems to confuse the program. If there is a way to clear the items after handing them in and setting the new setglobal, before the next if statememt, then it may work.
To make it properly return the items if they are not correct, add a return;.
Code:
else
{
plugin::return_items(\%itemcount);
return;
}
__________________
Random Segments of Code....
|
 |
|
 |

04-02-2008, 03:06 AM
|
Discordant
|
|
Join Date: May 2006
Posts: 356
|
|
I'm SLOW but persistant... LOL
The following is working perfectly on my system.... As you can see, you only can have 1 if for the items and then do your multiple checks for the max_level. Even returns multiple incorrect items.
Code:
sub EVENT_ITEM {
if (plugin::check_handin(\%itemcount, 2835 => 4)){
if ($max_level ==undef) {
quest::say("These are in excellent shape! They will be trophies in my collection!");
$client->Message(6, "Maximus Serilious rewards you with a new level!" );
quest::exp(9999999);
quest::setglobal("max_level", 71, 0, "F");
quest::level(71);
}
elsif ($max_level == 71) {
quest::say("These are in excellent shape! They will be trophies in my collection!");
$client->Message(6, "Maximus Serilious rewards you with a new level!" );
quest::exp(9999999);
quest::setglobal("max_level", 72, 0, "F");
quest::level(72);
}
elsif ($max_level == 72) {
quest::say("These are in excellent shape! They will be trophies in my collection!");
$client->Message(6, "Maximus Serilious rewards you with a new level!" );
quest::exp(9999999);
quest::setglobal("max_level", 73, 0, "F");
quest::level(73);
}
elsif ($max_level == 73) {
quest::say("These are in excellent shape! They will be trophies in my collection!");
$client->Message(6, "Maximus Serilious rewards you with a new level!" );
quest::exp(9999999);
quest::setglobal("max_level", 74, 0, "F");
quest::level(74);
}
elsif ($max_level == 74) {
quest::say("These are in excellent shape! They will be trophies in my collection!");
$client->Message(6, "Maximus Serilious rewards you with a new level!" );
quest::exp(9999999);
quest::setglobal("max_level", 75, 0, "F");
quest::level(75);
}
}
else
{
quest::emote("I have no use for this item");
plugin::return_items(\%itemcount);
return;
}
}
I'm too tired to do it now, but you will want to have a check for the last max_level to give back the items when they are AT the max_level of 75!
__________________
Random Segments of Code....
Last edited by Aramid; 04-02-2008 at 11:09 AM..
Reason: Check for max_level 75.
|
 |
|
 |
 |
|
 |

04-02-2008, 03:18 AM
|
Developer
|
|
Join Date: Mar 2007
Location: Ohio
Posts: 648
|
|
Quote:
Originally Posted by Aramid
Using the SAME item each time for each level seems to confuse the program.
|
That's because plugin::check_handin removes the items from the %itemcount array. I believe this is why it only gets through the first check in the second set of code in the first post.
Then again, there looks to be a syntax error in the 1st set of code, which should do what you're trying to do:
Code:
if (plugin::check_handin(\%itemcount, 2835=>4) {
should be
Code:
if (plugin::check_handin(\%itemcount, 2835=>4)) {
Quote:
Originally Posted by Aramid
If there is a way to clear the items after handing them in and setting the new setglobal, before the next if statememt, then it may work.
|
I think this would do the trick:
Code:
sub EVENT_ITEM {
if ($itemcount{2835} == 4 && $qglobals{max_level} == undef) {
quest::say("These are in excellent shape! They will be trophies in my collection!");
$client->Message(6, "Maximus Serilious rewards you with a new level!" );
quest::exp(9999999);
quest::setglobal("max_level", 71, 5, "F");
quest::level(71);
$itemcount{2835} = undef;
}
if ($itemcount{2835} == 4 && $qglobals{max_level} == 71) {
quest::say("These are in excellent shape! They will be trophies in my collection!");
$client->Message(6, "Maximus Serilious rewards you with a new level!" );
quest::exp(9999999);
quest::setglobal("max_level", 72, 5, "F");
quest::level(72);
$itemcount{2835} = undef;
}
Etc...
Etc...
Etc...
}
Something else you could do to really trim the code down:
Code:
sub EVENT_ITEM {
if (plugin::check_handin(\%itemcount, 2835 => 4)) {
quest::say("These are in excellent shape! They will be trophies in my collection!");
quest::exp(9999999);
if ($qglobals{max_level} == undef) {
quest::setglobal("max_level", 71, 0, "F");
quest::level(71);
} elsif ($qglobals{max_level} >= 75) {
plugin::return_items(%itemcount);
} else {
quest::setglobal("max_level", $qglobals{max_level}++, 0, "F"
quest::level($qglobals{max_level})
}
} else {plugin::return_items(%itemcount);}
}
|
 |
|
 |
Thread Tools |
|
Display Modes |
Hybrid Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 10:47 AM.
|
|
 |
|
 |
|
|
|
 |
|
 |
|
 |