Object Outline - Tattoo

For builders to discuss and ask building questions.
Post Reply
Arnof
Sword Journeyman
Sword Journeyman
Posts: 129
Joined: Wed Oct 22, 2008 8:47 pm
Location: Arizona, USA
Contact:

Object Outline - Tattoo

Post by Arnof » Sun Mar 25, 2018 4:59 am

Hey hey all,

We've got tattoos going in an area presently under construction and I'm wondering if this code will work.

Pastebin

The code is over 60k characters, so I had to post to a Pastebin for visibility. Pay no attention to the echo about permanance. After further consideration, I'll update the objects in the same vein that Harroghty outlines here
Areia
Sword Grand Master
Sword Grand Master
Posts: 493
Joined: Fri Feb 12, 2016 11:11 pm

Re: Object Outline - Tattoo

Post by Areia » Sun Mar 25, 2018 10:11 am

1. mpechoaround is missing $n in many places, and $i in others. Using its first appearance as an example...

Code: Select all

mpechoaround $I cleans a patch on $n readies his needle and ink and sets to inking their tattoo.
mpechoat $n $I cleans a patch on you, readies his needle and ink and sets to inking your tattoo.
should be

Code: Select all

mpechoat $n $I cleans a patch on you, readies his needle and ink, and sets to inking your tattoo.
mpechoaround $n $i cleans a patch on $n, readies his needle and ink, and sets to inking $s tattoo.
Leaving out $n would result in $n seeing two echoes, the mpechoaround as well as the mpechoat, and the mpechoaround itself would be odd, missing the mob's short. I also replaced their with $s, which will make the proper pronoun appear to anyone in the room who's not $n (i.e., "...sets to inking his/her/its tattoo." instead of "...sets to inking their tattoo.").

2. Color codes are missing in all the mposet statements. For instance:

Code: Select all

mposet $o short a red sparrow tattoo
mposet $o short a {90}red {70}dragon tattoo
should be

Code: Select all

mposet $o short {70}a {90}red {70}sparrow tattoo
mposet $o short {70}a {90}red {70}dragon tattoo
Or whatever base color aside from 70 that you want. Or you could just make them all red or whatever with a 90 or whatever in front. But shorts, longs, and extras should always start with a color code.

4. The black tattoos should use color code 80 instead of 07. The latter is a background code.

5. Line 1143 has a misspelling of mpechoat.

To the process itself. It looks like the mob is intended to accept an object given by the PC, change the short desc of that object, then drop it for the PC to retrieve when all is done. If that is the case:

6. I might be wrong on this one, but I'm fairly sure give_prog takes only one argument, a single vnum. If a mob needs to recognize more than one object, it needs a separate give_prog for each vnum.

7. Intercepting say to collect the player's preference probably isn't best practice. Every time someone tries to say anything at all that mob will intercept it, make echoes and whatnot. Maybe an intercept on something like ordertattoo, purchase, or another similar word/phrase that isn't a game command would work better.

8. There seem to be quite a lot of repetitive actorhasobjnum checks after each check on $1 in the intercept_prog. Likely you could wrap all the stringprefix checks inside a single check for those objects to save a lot of room and possible confusion, not to mention ease of readability. For instance:

Code: Select all

if stringprefix($1) == red
  if actorhasobjnum(25506)
  or actorhasobjnum(25507)
  or actorhasobjnum(25508)
  or actorhasobjnum(25509)
  or actorhasobjnum(25510)
  or actorhasobjnum(25511)
  or actorhasobjnum(25512)
    if stringprefix($2) == sparrow
      [so on...]
    endif
  endif
else
  if stringprefix($1) == pink
    if actorhasobjnum(25506)
    or actorhasobjnum(25507)
    or actorhasobjnum(25508)
    or actorhasobjnum(25509)
    or actorhasobjnum(25510)
    or actorhasobjnum(25511)
    or actorhasobjnum(25512)
      if stringprefix($2) == sparrow
        [so on...]
      endif
    endif
  endif
endif
could probably instead be

Code: Select all

if actorhasobjnum(25506)
or actorhasobjnum(25507)
or actorhasobjnum(25508)
or actorhasobjnum(25509)
or actorhasobjnum(25510)
or actorhasobjnum(25511)
or actorhasobjnum(25512)
  if stringprefix($1) == red
    if stringprefix($2) == sparrow
      [so on...]
    endif
  else
    if stringprefix($1) == pink
      if stringprefix($2) == sparrow
        [so on...]
      endif
    endif
  endif
endif
Additionally, if your intent is to check whether the mob is holding one of these objects before doing the mposet, it would probably be better for various reasons not to use the give_prog at all, and just set the short on the PC. actorhasobjnum asks whether $n, not $i, has the vnum far as I know, so it would not work if the mob has the object. You could then just use something like >speech_prog tattoo~ to show the menu of options and not even have to worry about giving, returning, etc.

9.

Code: Select all

mposet $o short {90}a red sparrow tattoo
and every other line like it should be either

Code: Select all

mposet iVNUM short {90}a red sparrow tattoo
if the mob has the object, or

Code: Select all

mposet on $n iVNUM short {90}a red sparrow tattoo
if you decide not to force the PC to hand over the object, replacing VNUM with the tattoo object's vnum. $o is only used in progs on objects to refer to the object itself, otherwise objects are referred to by their vnum.

10. Instead of drop all, which could lead to various problems including dropped money that PCs shouldn't have and the tattoo itself which someone else could then pick up, I would use something like mpgive tattoo $n, though you would probably want to mpjunk all before doing anything at all to avoid targeting mistakes. Again, more reason why setting the object's short on the PC or else simply setting it in a buy_prog might be a nicer way to go about it (not sure which to suggest for lack of knowledge as to the nature of those objects). This thread, especially Harroghty's post thereupon, might be supre helpful if you haven't looked at it already. It gives examples straight out of the game of two different ways to handle this sort of transaction.

Hope that helps, and hope I'm swiftly corrected if I got anything wrong. :)
Nascentes morimur, finisque ab origine pendet.
User avatar
Harroghty
Staff
Staff
Posts: 9695
Joined: Tue Jul 27, 2004 5:38 pm

Re: Object Outline - Tattoo

Post by Harroghty » Sun Mar 25, 2018 9:00 pm

This prog is too long. The game will forget what it's doing if it doesn't just outright tell you it is too long to run. I would break it up by color or by image and therefore make one master prog which feeds into one of many subordinate progs based upon player inputs.

Also, you will want to not just set the $o's short, but its name also so the keywords align. You can also set the description for them if you please. e.g.

Code: Select all

mposet i1234 ed addline 'tattoo' An expertly done tattoo showing a butterfly.
"A man may die yet still endure if his work enters the greater work, for time is carried upon a current of forgotten deeds, and events of great moment are but the culmination of a single carefully placed thought." - Chime of Eons
Post Reply