What's new
  • Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Visit Resources
  • Visit Downloads
  • Visit Portal

while and if statements

panYama

Community Developer
Joined
Jan 15, 2010
Messages
2,629
Reaction score
49
As the title speaks for itself, I'm looking for a reason when to use If's and While's when do you use a While and when a If, when you are doing quests.

can anyone give any clarification on this?
 
while condition is mainly for those quests that you think you'll need to repeat steps (ie: circumstances change, or you need to compensate for bot)

if's are generally for 1 purpose quest / objectives
 
I want the following: it has to pickup a quest if it's available - it's a repeatable quest but if I already have it it should move on to the next thing if I don't have it it should pick it up. (if this is clear)

how can I accomlish that?
 
PHP:
<!--START - Accept all Quests from an NPC -->
			<While Condition="HasQuestAvailable(MOBID)" >
				<CustomBehavior File="InteractWith"  MobId="MOBID" NumOfTimes="1" CollectionDistance="200" WaitTime="1000" X="XCOORD" Y="YCOORD" Z="ZCOORD" />
				<CustomBehavior File="RunMacro" Macro="/click GossipTitleButton1" NumOfTimes="1" WaitTime="1000" />
				<CustomBehavior File="RunMacro" Macro="/click QuestFrameAcceptButton" NumOfTimes="1" WaitTime="1000" />
			</While>
<!-- END - Accept all Quests from an NPC -->

<!-- START - Do the quest(s) -->
			<If	Condition="((HasQuest(QUESTID)) &amp;&amp; (!IsQuestCompleted(QUESTID)))"> 
<!-- START - Your Questaction here -->
				<Objective QuestName="GQUESTNAME" QuestId="QUESTID" Type="KillMob" MobId="MOBIDTOKILL" KillCount="NUMOFKILLS" />
<!-- END - Your Questaction here -->
			</If>
<!-- END - Do the quest(s) -->

This should be the easiest way to do that.
I know it's not perfect, but to check if the NPC has a specific quest u'll need to do a lot more of work.
This is easier, but maybe u'll get some quests, u don't want to do.

Hope that helps

Normally u would use an if-statement here in this special case, but we can't directly check IF the mob has THE quest we wanna pickup, so we have to pickup all Quest WHILE the NPC has quests for us.

and later in the profile u'll check IF u have the quest, and do this one (or two or three ... whatever)

The following things have to be replaced with IDs
MOBID = ID of NPC
XCOORD = x-Coordinate of the NPC
YCOORD = y-Coordinate of the NPC
ZCOORD = z-Coordinate of the NPC
QUESTID = your questid
QUESTNAME = your questname
MOBIDTOKILL = id of the mob u wanna kill (if it's an killaction)
 
Last edited:
Panyama;

Stormchasing's advise is immaculate.
What I usually do in these cases is take a profile from someone I know can code (generally: Kick) and see how he does it. You can learn a lot by reading the code from people that have already proven to deliver good stuff.
 
Panyama;

Stormchasing's advise is immaculate.
What I usually do in these cases is take a profile from someone I know can code (generally: Kick) and see how he does it. You can learn a lot by reading the code from people that have already proven to deliver good stuff.
Not to sound cocky, but I'm a quite well known profile maker on the forums just have been absent for 5 months so forgot a few things here and there and haven't seen a few new attributes.
Back in the days they where topnotch, so looking at others yeah nice idea but preferably do it my own way so I learn to perfect them and not release a half assed profile.
 
I want the following: it has to pickup a quest if it's available - it's a repeatable quest but if I already have it it should move on to the next thing if I don't have it it should pick it up. (if this is clear)

how can I accomlish that?

check out my tol barad profile
 
Back
Top