Obj Progs

For builders to discuss and ask building questions.
Post Reply
Derax
Sword Bumbler
Sword Bumbler
Posts: 8
Joined: Wed Jul 30, 2003 4:21 pm
Location: Waterdeep/Golden Oaks

Obj Progs

Post by Derax » Tue Jun 14, 2005 1:48 am

Hi I need help with a object prog. What im trying to make is a basic FK version of a water balloon. I figured it would be an intercept prog with a mpechoat for the one who throws it. A mpecho around for those in the room other than the one who is soaked and the one who threw it. But then I can figure how to exclude the player who gets it thrown at them from the mpechoaround and how to echo to that player only that they got soaked.
User avatar
Japcil
Sword Grand Master
Sword Grand Master
Posts: 1143
Joined: Fri Jun 17, 2005 5:32 pm
Location: Golden Oaks
Contact:

Post by Japcil » Sat Jul 23, 2005 12:52 am

Can an obj load another obj based off its prog? Basically what im trying to do...

Code: Select all

>intercept_prog use~
if wear_loc($0) !=-1
  mpechoat $n You throw a vial of stinktar at the ground.
  mpechoaround $n $N throws a vial of stinktarat the ground.
  mpecho A vial of stinktar shatters on impact.
  mpecho It begins to smell horrible
  mpload iQQ27 (smelly ooze)
  mpquiet on
  drop iQQ27
  mpquiet off
  mpjunk iQQ26 (vial of stinktar)
else
  mpechoat $n Perhaps you should hold it first.
endif
~
|
Then on the item that got loaded and droped...

Code: Select all

>rand_prog 100~
mpecho A pile of black ooze smells horrible.
mpecho You feel as if you are about to vomit.
~
|
Image
Dalvyn
Sword Grand Master
Sword Grand Master
Posts: 4708
Joined: Tue Jul 15, 2003 9:26 pm
Location: House of Wonder, Waterdeep

Post by Dalvyn » Sat Jul 23, 2005 2:01 am

For the water balloon, you might also try to replace the first three echoes with:

Code: Select all

mpforce $n smote throws a water balloon at $1
For your intercept_prog use, yes, you can load a new object like you did. What you have to remember those is that object programs (and room programs) are actually run by an invisible mob in the room. This invisible mob will load iQQ27 (by the way, it's mpoload, not mpload, and you can omit the i: mpoload QQ27) and drop it. This special invisible mob (which is called the supermob) is always secretive, meaning that its actions do not generate any echo. The "mpquiet on" and "mpquiet off" are thus not necessary: it's always in "mpquiet on" mode.

One problem in your program though is the "mpjunk iQQ26". This will make the invisible mob to look for an object to junk in its inventory. And it won't find any iQQ26 there, since it's not in the invisible mob's inventory, but in $n's inventory. You need to replace that line with "mpjunk iQQ26 $n" to tell the invis mob to go take a look in $n's inventory. As a short-cut, if you want to designate the objet that has triggered the program, you can use $o; you can thus use "mpjunk $o $n" (always as the last line of the program) to junk it from $n's inventory.

Something else you might want to consider is adding {xx} colour codes to your echoes (mpecho, mpechoat, mpechoaround).


Hope that helps. If that's not clear or you have further questions, do not hesitate to post them.
Image
Scylere
Sword Master
Sword Master
Posts: 179
Joined: Fri Jul 14, 2006 2:48 pm

Post by Scylere » Sun Nov 05, 2006 11:47 pm

I can't get this object program to load in fkbuilder, so I can't find out what's wrong with it. Could someone help me out?

Here's the coding:
#OBJECTS
#QQ00
altar Umberlee~
{F0}an altar of Umberlee~
{F0}An altar of Umberlee rests here.~
~
ITEM_TYPE_FURNITURE
FLAG_GLOW|FLAG_MAGIC
0
QUALITY_SUPERIOR MATERIAL_PEARL COND_PERFECT SIZE_MEDIUM
0 0 FURNITURE_ALTAR 0 0 0
>intercept_prog tribute~
if goldamt > 500
mpecho {E0}The water below angrily hisses and spits as water splashes on everyone.
mpecho {90}The coins laid on the altar are consumed with a liquid flame.
mpcast curse $n
mpjunk all.coin $n
else
if goldamt > 1000
mpecho {90}The coins laid on the altar are consumed with a liquid flame.
mpcast bless $n
mpjunk all.coin $n
else
if goldamt > 1500
mpecho {90}The coins laid on the altar are consumed with a liquid flame.
mpcast bless $n
mpjunk all.coin $n
else
if goldamt > 2000
mpecho {90}The coins laid on the altar are consumed with a liquid flame.
mpcast bless $n
mpjunk all.coin $n
else
if goldamt > 2500
mpecho {90}The coins laid on the altar are consumed with a liquid flame.
mpcast bless $n
mpjunk all.coin $n
else
endif
endif
endif
endif
endif
~
|

#0
EDIT: the ifs and endifs were spaced out, but the spaces don't seem to be showing up...
User avatar
Japcil
Sword Grand Master
Sword Grand Master
Posts: 1143
Joined: Fri Jun 17, 2005 5:32 pm
Location: Golden Oaks
Contact:

Post by Japcil » Mon Nov 06, 2006 12:12 am

Try with the code flag instead of quote.
Image
User avatar
Japcil
Sword Grand Master
Sword Grand Master
Posts: 1143
Joined: Fri Jun 17, 2005 5:32 pm
Location: Golden Oaks
Contact:

Post by Japcil » Mon Nov 06, 2006 12:24 am

First if goldamt only checks how much they have, as far as i know it doesnt take the coin from them as well. Use mptakecash to take the value of coin and mpdeposit to put the money into the economy. Here is how it should look:

Code: Select all

#OBJECTS 
#QQ00 
altar Umberlee~ 
{F0}an altar of Umberlee~ 
{F0}An altar of Umberlee rests here.~ 
~ 
ITEM_TYPE_FURNITURE 
FLAG_GLOW|FLAG_MAGIC 
0 
QUALITY_SUPERIOR MATERIAL_PEARL COND_PERFECT SIZE_MEDIUM 
0 0 FURNITURE_ALTAR 0 0 0 
>intercept_prog tribute~ 
if goldamt > 500 
  mpecho {E0}The water below angrily hisses and spits as water splashes on everyone. 
  mpecho {90}The coins laid on the altar are consumed with a liquid flame. 
  mpcast curse $n 
  mptakecash $n 500
  mpdeposit 500 
else 
  if goldamt > 1000 
    mpecho {90}The coins laid on the altar are consumed with a liquid flame. 
    mpcast bless $n 
    mptakecash $n 1000
    mpdeposit 1000 
  else 
    if goldamt > 1500 
      mpecho {90}The coins laid on the altar are consumed with a liquid flame. 
      mpcast bless $n 
      mptakecash $n 1500 
      mpdeposit 1500 
    else 
      if goldamt > 2000 
        mpecho {90}The coins laid on the altar are consumed with a liquid flame. 
        mpcast bless $n 
        mptakecash $n 2000
        mpdeposit 2000 
      else 
        if goldamt > 2500 
          mpecho {90}The coins laid on the altar are consumed with a liquid flame. 
          mpcast bless $n 
          mptakecash $n 2500
          mpdeposit 2500  
        else 
          mpnothing
        endif 
      endif 
    endif 
  endif 
endif 
~ 
| 

#0
Edit: I dont think this will work all under one prog. You may have to add progs like tribute 500, tribue 100 and seperate them into their own programs. If goldamt doesnt quite work like I think you want it to. Either that or you should try starting with the larger amount and work your way to the 500 copper last. <- That may be the answer. So it would look like this:

Code: Select all

#OBJECTS 
#QQ00 
altar Umberlee~ 
{F0}an altar of Umberlee~ 
{F0}An altar of Umberlee rests here.~ 
~ 
ITEM_TYPE_FURNITURE 
FLAG_GLOW|FLAG_MAGIC 
0 
QUALITY_SUPERIOR MATERIAL_PEARL COND_PERFECT SIZE_MEDIUM 
0 0 FURNITURE_ALTAR 0 0 0 
>intercept_prog tribute~ 
if goldamt > 2500 
  mpecho {90}The coins laid on the altar are consumed with a liquid flame.
  mpcast bless $n
  mpecho {F0} You have been blessed by Umberlee! 
  mptakecash $n 2500
  mpdeposit 2500 
else 
  if goldamt > 2000 
    mpecho {90}The coins laid on the altar are consumed with a liquid flame. 
    mpcast bless $n 
    mpecho {F0} You have been blessed by Umberlee! 
    mptakecash $n 2000
    mpdeposit 2000 
  else 
    if goldamt > 1500 
      mpecho {90}The coins laid on the altar are consumed with a liquid flame. 
      mpcast bless $n 
      mpecho {F0} You have been blessed by Umberlee! 
      mptakecash $n 1500 
      mpdeposit 1500 
    else 
      if goldamt > 1000 
        mpecho {90}The coins laid on the altar are consumed with a liquid flame. 
        mpcast bless $n 
        mpecho {F0} You have been blessed by Umberlee! 
        mptakecash $n 1000
        mpdeposit 1000 
      else 
        if goldamt > 500 
          mpecho {E0}The water below angrily hisses and spits as water splashes on everyone. 
          mpecho {90}The coins laid on the altar are consumed with a liquid flame. 
          mpcast curse $n 
          mpechoat $n {90}The waves crash around you as you are cursed.
          mptakecash $n 500
          mpdeposit 500  
        else 
          mpechoat $n {90}Don't bother cheapskate!
        endif 
      endif 
    endif 
  endif 
endif 
~ 
| 

#0
Note I added an echo so that if they do not even have 500 copper with them to not even bother and call them a cheapskate. Also added echos so that when the person is blessed they know it along with the curse. :)
Image
Dalvyn
Sword Grand Master
Sword Grand Master
Posts: 4708
Joined: Tue Jul 15, 2003 9:26 pm
Location: House of Wonder, Waterdeep

Post by Dalvyn » Mon Nov 06, 2006 2:31 am

I don't know fkbuilder (never used it), but doesn't it require a complete area file, with all mandatory sections? (mobile, objects, rooms, ...). A single object with a program might not work on its own.
Image
User avatar
Japcil
Sword Grand Master
Sword Grand Master
Posts: 1143
Joined: Fri Jun 17, 2005 5:32 pm
Location: Golden Oaks
Contact:

Post by Japcil » Mon Nov 06, 2006 2:39 am

Yes, it does require all the header flags.
Image
Scylere
Sword Master
Sword Master
Posts: 179
Joined: Fri Jul 14, 2006 2:48 pm

Post by Scylere » Mon Nov 06, 2006 4:07 am

What exactly does the "else" mean in progs?
Valdimyr
Sword Novice
Sword Novice
Posts: 48
Joined: Wed Jul 12, 2006 6:49 am
Location: Golden Oaks

Post by Valdimyr » Mon Nov 06, 2006 5:58 am

The "else" is what the program does if whatever triggers the program doesn't meet the criteria for the ifcheck.

As in
if goldamt > 2500

If they don't have 2500 in gold then whatever you have the else set to will happen. If you have nothing set as else and it is just blank, then nothing will happen at all.

Also, I wanted to ask, because I think you might want to put your ifcheck like this.....

if goldamt >= 2500
Not sure with FK, but if you just have it like "> 2500" they would need 2501 for it to work, but with the >= they can have 2500 and up for that certain part of the program to work. The same goes for the rest of the prices.

You may want to look into that.
Sincerely,
Valdimyr
Scylere
Sword Master
Sword Master
Posts: 179
Joined: Fri Jul 14, 2006 2:48 pm

Post by Scylere » Mon Nov 06, 2006 11:40 am

I have all these different ways of writing this program, and it seems that the only way it doesn't crash fkbuilder is to make each # of coins a separate intercept prog. I got it working though:D Thanks!
Dalvyn
Sword Grand Master
Sword Grand Master
Posts: 4708
Joined: Tue Jul 15, 2003 9:26 pm
Location: House of Wonder, Waterdeep

Post by Dalvyn » Mon Nov 06, 2006 1:50 pm

Just a few random comments.

- It should be goldamt($n) instead of goldamt.

- I wouldn't bother with programs in a first time. First get your area ready with mobiles, objects, and rooms, then you will be able to visit it on the test port, AND introduce your first programs only then, when you can directly test them.

- I am not sure I get the logic of what you are trying to do... no matter how much money they have, they only get blessed, and nothing more; if they have between 501 and 1000 copper coins, they get cursed, but if they have less than 500, they are not cursed?
Image
Post Reply