26 Aug, 2009, teknozwizard wrote in the 1st comment:
Votes: 0
Alrighty! Head Builder from Chaos Ring back again with another mprog problem. I've got a couple of progs set up in my new and improved mudschool and for some reason, this new one has stopped working altogether. Well, Coder/Owner feels that he's fairly certain he knows what's wrong with the SPEECH triggering that I was having trouble with the other day. I'd still like him to take a look at it, but I found another way around it by using ACT triggers. Anyway, todays new prog problem follows!!!


(1) here's the mob created to host the prog:

Name:        [drunk noble dwarf]
Area: [ 48] The Training Grounds
Act: [npc sentinel]
Vnum: [ 215] Sex: [neutral] Race: [hilldwarf]
Level: [102] Align: [ 0] Hitroll: [ 0] Dam Type: [none]
Hit dice: [ 1d1 + 0] Damage dice: [ 1d1 + 0] Mana dice: [ 0d0 + 0]
Affected by: [infrared]
Armor: [pierce: 0 bash: 0 slash: 0 magic: 0]
Form: [edible sentient biped mammal]
Parts: [head arms legs heart brains guts hands feet fingers ear eye]
Imm: [none]
Res: [none]
Vuln: [none]
Off: [none]
Size: [medium]
Material: [unknown]
Start pos. [standing]
Default pos [standing]
Wealth: [900000]
Short descr: a drunk dwarf noble
Long descr:
A drunken dwarf noble sits here singing to himself as he hiccups and tries to keep his balance.
Description:
A stocky dwarf with a large heart and horrible singing voice. This
dwarfs black beard is matted with drink and he smells of hard alcohol. His
cloths are silk and lustrous and his jewelery extravegant!

MOBPrograms for [ 215]:
Number Vnum Trigger Phrase
—— —- ——- ——
[ 0] 215 GRALL 100
[ 1] 200 ACT nod


(2) Here's the mpdump for prog 215:

mpdump 215
emote stumbles about for a moment before catching himself on the wall.
emote looks up at you and smiles drunkenly.
emote slurs, 'Hey there little buddy! Would you like some coins? Just nod your head, I can't hear you anyway!'
emote roars with laughter as he stumbles over drunkenly.


(3) Here's the mpdump for prog 200:

mpdump 200
if $n ispc
and if $n money > 10
say Sorry friend, you're just as wealthy as I am!
emote hiccups hard and stumbles back against the wall after clapping you heartly
on the back!
else
if $n money <= 10
say Ha! You're poor! You need some silver! Take this!
emote throws a coin purse filled with silver at you as he stumbles back and
falls to the ground roaring with laughter!
give $n 3000 silver
endif


Please bear in mind I know the above prog is syntactically incorrect!

(4) Here's the original mpdump from the first prog I wrote (for prog 200):

if ispc $n
and if money $n > 10
say {mSorry friend, you're just as wealthy as I am!{x
emote hiccups hard and stumbles back against the wall after clapping you heartly
on the back!
else
if money $n <= 10
say {mHa! You're poor! You need some silver! Take this!{x
emote throws a coin purse filled with silver at you as he stumbles back and
falls to the ground roaring with laughter!
give 3000 silver $n
endif


NOTE: I am not, nor do I claim to be an expert at mprogs, but something here tells me that the real error is between the keyboard and the chair. Can anyone give me some advice because neither the original or the modified prog I wrote works at all…….

Now, the other night, I had it working just fine. The addmprog was still set to ACT nod, but the prog itself wasn't…..as much….Instead of the if checks and the checking, I had the mob set to just "give 300 silver $n" after the nod. The problem here is that new players would be able to abuse this slight quark and become rich very quickly! So, not seeing (or truly understanding) how the mob function "remember" really worked, I opted to just run some quick ifchecks…..And, like I said, I think I really jacked it up.
26 Aug, 2009, Ssolvarain wrote in the 2nd comment:
Votes: 0
Needs moar endifs.

(Working on it, hold on. Those code tags suck for mprogs -.-)


Actually, for abuse-prevention, you need to design something better… I would just drop my silver and do it again >.>

If you wanted to forge ahead anyways…

if $n ispc
if $n money <= 10
give money and stuff
else
say gtfo!
endif
endif

The best way, I think, would be to include variable functionality (like myVar = 10) and make it a 1-shot deal. But that requires some code, prolly.
26 Aug, 2009, teknozwizard wrote in the 3rd comment:
Votes: 0
Unfortunately, our Coder is hardcore into specific things other than mprogs, so I'm trying to work with the stock mprog code from QuickMUD so he's got time to finish the priority projects so….here we go..!

Modified it by adding in another endif because I did notice that I left one out. According to my understanding, for each "if" function (if, and, or, then, else), you need to include 1 endif per word. So, that's what I did.

(1) Here's the mpdump after adding in the other endif:
mpdump 200
if ispc $n
and if money $n > 10
say Sorry friend, you're just as wealthy as I am!
emote hiccups hard and stumbles back against the wall after clapping you heartly
on the back!
else
if money $n <= 10
say Ha! You're poor! You need some silver! Take this!
emote throws a coin purse filled with silver at you as he stumbles back and
falls to the ground roaring with laughter!
give 3000 silver $n
endif
endif


(2) Here's the mpdump after I modified it again just to see if I'm writing it out incorrectly…
if $n ispc
and if $n money > 10
say {mSorry friend, you're just as wealthy as I am!{x
emote hiccups hard and stumbles back against the wall after clapping you heartly
on the back!
else
if $n money <= 10
say {mHa! You're poor! You need some silver! Take this!{x
emote throws a coin purse filled with silver at you as he stumbles back and
falls to the ground roaring with laughter!
give $n 3000 silver
endif
endif


And I'll be buggered if neither one of them worked the way they were supposed to! I'm like 3 inches away from giving up on mprogs but I really don't want to because I feel they're so cool and help a mud come alive, even if just in the alpha-numeric 2D variety….(sigh)…..


[EDIT]====================
noticed I only had 2 endifs in there and dropped in a third endif for line #2 (and if) and it's still not working with either variation…..God…I suck at this….

[SECOND EDIT]========================
Noticed I copied out of my notepade instead of the mpdump for the 2nd dump, edited it to make it the right dump. I still suck at this, I'm sorry.
26 Aug, 2009, Ssolvarain wrote in the 4th comment:
Votes: 0
Try it without adding the "if money <= 10" after the else, and remove the "and". I start getting a headache when multiple if checks are combined several times in the same prog.
26 Aug, 2009, teknozwizard wrote in the 5th comment:
Votes: 0
Ssolvarain said:
Try it without adding the "if money <= 10" after the else, and remove the "and". I start getting a headache when multiple if checks are combined several times in the same prog.


You're a freaking genious!!!!! Thanks dude! ….I mean…

<shifty eyes> I knew that. I was just testing you guys for potential builders </end shifty eyes>

:redface:
26 Aug, 2009, Ssolvarain wrote in the 6th comment:
Votes: 0
Hah! Good luck in the future.

if ispc $n
if money $n <= 10
say Wow, you're poor, man.
else
say Dude!
mob damage $n 2000
endif
endif


I gotta paste this somewhere >.>
0.0/6