Enig wrote:1) Is it possible to use > or < with an if check? Ie.
if quest (0, 4, $n)>1
Yup, that's possible to use >, >=, <, <=, and != (for "is not").
2) Does each object and mob have a full set of 32 bits to be used for quests?
Each character has a set of 32 bits (numbered from 0 up to 31) for each area (or, more precisely, for each 100-vnum block).
That means that an area with 100 vnums has 32 bits for quests. An area with 50 vnums has 16 bits for quests (either numbered from 0 up to 15, or from 16 up to 31, depending if it uses vnums ending in 00 up to 49 - that is, the first half of a 100 vnum block -, or vnums ending in 50 up to 99 - that is, the second half of a 100 vnum block).
Areas with more than 100 vnums have more than 32 bits for quests.
[More on that later]
Mobiles have 32 bits of their own, not associated to any area, and those vnums are shared by ALL mobs with the same vnums. For example, if you set "mpmset m123 quest 0 1 1" on a mob #123 (let's say, an orc soldier), then ALL orc soldiers of vnum 123 will have their quest bit 0 1 set to 1. Mobs only have ONE set of 32 bits, not one set per area.
Here's my attempt to fix my programs!
Perfect! The program as it is will work fine!
Here's just an option to improve some parts: The condition of an "if" can be a complex condition like "Condition1 AND Condition2", or "Condition1 OR Condition2"; this can sometimes shorten the program.
For example, you could safely replace
Code: Select all
if quest (0, 4, $n)==11
if perm_dex($n) > 10
if perm_con($n) > 10
mpechoat $n {60}The gnomish chef looks you over critically.
mpechoaround $n {60}The gnomish chef looks @N over critically.
sayto $n You look like you've been working out!
sayto $n You know, I think you might be a good fit for my kitchen.
sayto $n You could become an apprentice chef of the Blue Fountain Cafe.
sayto $n Being a chef requires dedication and isn't a job for the faint hearted,
sayto $n but I think you have potential! So, what do you say?
mpmset $n 0 4 2
else
mpechoaround $n {60}The gnomish chef doesn't spare @N a second glance.
mpechoat $n {60}The gnomish chef doesn't spare you a second glance.
endif
else
mpechoaround $n {60}The gnomish chef doesn't spare @N a second glance.
mpechoat $n {60}The gnomish chef doesn't spare you a second glance.
endif
endif
with
Code: Select all
if quest (0, 4, $n)==11
if perm_dex($n) > 10
and perm_con($n) > 10
mpechoat $n {60}The gnomish chef looks you over critically.
mpechoaround $n {60}The gnomish chef looks @N over critically.
sayto $n You look like you've been working out!
sayto $n You know, I think you might be a good fit for my kitchen.
sayto $n You could become an apprentice chef of the Blue Fountain Cafe.
sayto $n Being a chef requires dedication and isn't a job for the faint hearted,
sayto $n but I think you have potential! So, what do you say?
mpmset $n 0 4 2
else
mpechoaround $n {60}The gnomish chef doesn't spare @N a second glance.
mpechoat $n {60}The gnomish chef doesn't spare you a second glance.
endif
endif
Thanks again for your time

You are welcome! It's always a great pleasure to see that, after a few words of explanations, new builders can create working programs!
Just an additional word about quest bits and how they depend on the area.
As I wrote above, each character has a set of 32 bits for each area in the game (or each 100-vnum block). When you want to state which set of 32 bits you are modifying/checking, you need to use questr instead of quest. Here's how they work:
"Quest" versions:
Code: Select all
mpmset $n quest 0 1 1
if quest(0,1,$n) == 1
"Questr" versions:
Code: Select all
mpmset $n questr 8000 0 1 1
if questr(8000,0,1,$n) == 1
(where I used 8000 as an example; if you do not have your vnums set yet, you can use QQ00, so we can perform a file-wide search and replace on QQ to turn them into your effective vnums once they have been chosen)
Code: Select all
mpmset $n questr QQ00 0 1 1
if questr(QQ00,0,1,$n) == 1
When to use quest or questr?
Well, obviously, when you need to check or modify quest bits "belonging to"/associated with another area, you need to use questr. But there are other cases when it's better to use questr instead of quest.
How does the mud determines what set of 32 bits to use? When a program uses quest (not questr), how does the mud determine what area to use? In those cases, it uses the area where the player is. It could have used the area where the object/room/mobile who is running the program is defined, but that's not what it does.
What does it mean? It means that, if a wandering mobile uses "quest" instead of "questr", its program will behave differently (will use different areas) as the wandering mobile moves from one area to another area. Thus, for wandering mobiles, it's always safer to use "questr" instead of "quest".
Now, from time to time, imms also move mobiles out of their starting area, or mobs sometimes move on their own (to report a crime or chase an attacker for example). Thus ... as a rule of thumb, it's always safer to use "questr" for mobile programs.
Objects ... well, objects that can be carried and moved around certainly need to use "questr" since they can be brought to other areas. Objects that cannot be picked up (e.g., fountains) can use "quest" ... though, once again, imms might load them up in another area. So, there too, it's safer to use "questr".
The only place where it's 100% safe to use "quest" is in room programs (programs attached to a room), because we know for sure that a room is not going to be "pulled out" of its area.
Hope that helps. Good to see you making good progress!