Oprogs

From ProphWiki

Jump to: navigation, search

Some oprogs are slightly buggy, so be careful when using them. If uncertain, consult the builder immortal, a foreman or a fellow builder. As you can see, they can be useful in the right circumstances. However, unless you need something to which an mprog would be unsuited, use a mprog.

[edit] Commands that can be used in oprogs (in pedit):

test 
to test if a check works.
say 
Object will 'say'
emote 
Object will emote
cast 
Object will cast a spell. Be careful, limited checks on this.
damage 
Object will do x amount of damage
echo 
Object echo - BUGGED, DO NOT USE.
gecho 
Object gecho, don't use
zecho 
Object zecho, does an echo to the entire zone (area)
asound 
object will display the string to all in nearby rooms
oload 
object will load an object
mload 
object will load a mob
purge 
object will purge
transfer 
object will transfer a char/mob
force 
object will force a char
Checks that can be used with oprogs in the code (made in pedit):
If check Argument(s) Meaning
rand number Is random percentage less than or equal to number
mobhere vnum Is a mobile with this vnum in the room
name Is a mobile with this name in the room
objhere vnum Is an object with this vnum in the room
name Is an object with this name in the room
mobexists name Does NPC 'name' exist somewhere in the world
objexists name Does object 'name' exist somewhere in the world
     
people == integer Is the number of people in room equal to integer
players == integer Is the number of PCs in the room equal to integer
mobs == integer Is the number of NPCs in the room equal to integer
clones == integer Is the number of objects in the room with the same vnum as the objects who activated the program equal to integer
hour == integer Is the hour (game time) equal to integer
     
isnpc $* Is $* an NPC
ispc $* Is $* a PC
isgood $* Does $* have a good alignment
isneutral $* Does $* have a neutral alignment
isevil $* Does $* have an evil alignment
isimmort $* Is $* an immortal (level of $* > LEVEL_HERO)
ischarm $* Is $* affected by charm
isfollow $* Is $* a follower with their master in the room
isactive $* Is $*'s position > POS_SLEEPING
isdelay $* Does $* have a delayed MOBprogram pending
hastarget $* Does $* have a MOBprogram target in the room
istarget $* Is $* the target of NPC who activated the program
isquested $* Is $* quested
exists $* Does $* exist in game
     
affected $* affect Is $* affected by affect
act $* act Is $*'s ACT set to act
off $* off Is $*'s OFF set to off
imm $* imm Is $*'s IMM set to imm
carries $* name Is $* carrying object name
wears $* name Is $* wearing object name
has $* type Does $* have object of item_type type
uses $* type Is $* wearing object of item_type type
name $* name Is $*'s name name
pos $* position Is $*'s position position (sleeping etc.)
clan $* name Does $* belong to clan name
race $* name Is $* of race name
class $* name Is $*'s class name
objtype $* type Is $*'s item_type type
     
vnum $* == integer Is $*'s virtual number equal to integer
hpcnt $* == integer Is $*'s hippoint percentage equal to integer
room $* == integer Is vnum of the room $* is in equal to integer
sex $* == integer Is $*'s sex equal to integer
level $* == integer Is $*'s level equal to integer
align $* == integer Is $*'s align equal to integer
money $* == integer Does $* have money (in silver) equal to integer
grpsize $* == integer Is group size of $* equal to integer

[edit] Triggers (used in oedit with addoprog)

      • NOTE*** Do NOT use the triggers 'examine' or 'use'
wear 
when object is worn
remove 
when object is removed
sac 
when object is sacrificed
get 
when someone gets the object
drop 
when object is dropped
act 
when someone performs an specific action (see examples)
grall 
when someone enters the room

[edit] Examples

Suppose you wanted a sword to shimmer with godly might when worn by a member if the guardian clan. The code would be; Lets suppose the program was vnum 111 and the object is vnum 100. You would type

pedit create 111
then type 'code' to enter the editer
if clan $n guardian
obj emote shimmers with godly might.
endif

This oprog would then be added to the object in question.

oedit 100
addoprog 111 wear 100

How about an oprog for a fountain to bubble when someone enters the room. The code would be:

obj emote bubbles up from the ground in spurts of mist.

and would then be added to an object (same vnums as above example) with;

addoprog 111 grall 100

How about we get a little more involved. I don't recommend getting complicated with oprogs unless you know *EXACTLY* what you are doing. Lets make an oprog that could be used as a clan guard in conjunction with a mob, for say... the AoA clan with Angarak, Grolim, Dagashi, and disciple subclans. The object this is on will be a trip wire object with a 'grall' trigger.

if clan $n Angarak
obj emote shimmers to nothing as you pass and reforms behind you.
break
else
if clan $n Dagashi
obj emote shimmers to nothing as you pass and reforms behind you.
break
else
if clan $n Grolim
obj emote shimmers to nothing as you pass and reforms behind you.
break
else
if clan $n Torak
obj emote shimmers to nothing as you pass and reforms behind you.
break
else
obj emote snaps with a loud twang.
obj trans "aoa clan guard"
obj force "aoa clan guard" emote screams with rage as his blades fall upon
intruders!
obj force "aoa clan guard" kill $n
obj emote reforms behind the intruder, $n
endif
endif
endif
endif
Personal tools
general