Shoveling manure or make 'em earn some gold

Login to reply  Page: « < 1 of 1 > »
17 Oct 2009 - 17:111949
Shoveling manure or make 'em earn some gold
Because I'm a truly sick individual, I'm trying to create a script that requires the player to be holding a shovel and then using it to shovel manure from the room. Afterwards they can see a mob to get paid for their mucking services. This is actually a two part script I'm thinking. I'm working on the "first" part - using the shovel to remove the manure from the room. I'm needing help making the script check the room for manure before continuing on (and some proof-reading overall). I'm placing the "shoveled" manure in the PC's inventory and when they see the mob to get paid they will be paid per object. I'm sure there's a better way (like using a variable), but my trigger-fu is weak. Any suggestions are appreciated. Here's what I have so far

Intended for: Objects
Trigger Types: Command
Argument: shovel
Commands:
if %cmd% == shovel
  if %arg% == manure
    if %actor.eq(*)%
      eval held %actor.eq(held)%
      if %held.vnum != 201
        %send% %actor% You're not holding a shovel!
      elseif 
         * search the room for manure <-- Need help this part
         %send% %actor% There's no manure to shovel!
      else
        %purge% shit
        %load% obj 200 %actor% inv
      end
    end
  end
end

Any thoughts on the second part? I'm thinking using a while loop to search through and remove the objects, nop some gold, but not sure how to go about this. Or if there's a simpler method of doing this.

Thanks!

PS - Just tested what I have and am getting a Huh?! message when you type shovel manure...



Last edited by armitage (17 Oct 2009 - 17:27)
17 Oct 2009 - 17:341950
Use findobj for the first part. HELP FINDOBJ on a tbaMUD.
if %findobj.<room vnum>(<obj vnum>)%

As for finding the item you can use if has_item.
while %actor.has_item(<vnum>)%
  nop %actor.gold(#)%
  * assuming the manure doesn't have any wear flags it will be in inventory.
  %purge% %actor.inventory(obj vnum)%   
done
Try that out and post your results.


__________________
Rumble
The Builder Academy
tbamud.com 9091

Last edited by Rumble (17 Oct 2009 - 17:35)
18 Oct 2009 - 00:091951
Shoveling manure or make 'em earn some gold
Quote armitage:
PS - Just tested what I have and am getting a Huh?! message when you type shovel manure...


Gonna ask the basic questions: Do you have nohassle off and are you lower than...um, I forget how this one goes...level 32?


18 Oct 2009 - 12:241955
Hmm... Thought I had replied to this thread last night... So if this double posts sorry.

Thanks Rumble, that's what I was looking for (should have read the helpfiles, I know!) The code is still not working however. My mortal test character is still getting a Huh message. Here's the current version.

if %cmd% == shovel
  if %arg% == manure
      if %actor.eq(*)%
        eval hold %actor.eq(hold)%
        if %hold.vnum% != 201
          %send% %actor% You're not holding a shovel!
        elseif !%findobj.208(200)%
          %send% %actor% There's nothing to shovel here.
        else
          %purge% manure
          %load% obj 200 %actor% inv
      end
    end
  end
end

I also tried the while expression and not having any luck with it. Here's that code (it's part of another trigger which does work, just not the "trade" in part)

if %cmd% == talk
  if %arg% == herdsman
    %send% %actor% %self.name% says, 'Hey there.'
    %send% %actor% -----------------------------------
    %send% %actor% Option 1) Do you have any work?
    %send% %actor% -----------------------------------
  elseif %arg% /= herdsman && %arg% /= work
    %send% %actor% %self.name% says, 'Start shoveling up some of this manure.'
    %send% %actor% %self.name% says, 'Tell me when you're done and I'll pay you.'
    if !actor.has_item(201)%
    %load% obj 201 %actor%
    %send% %actor% %self.name% says, 'Here, you'll need a shovel.
    %send% %actor% %self.name% gives you a shovel.
  elseif %arg% /= herdsman && %arg% /= done
    while %actor.has_item(200)%
    nop %actor.gold(5)%
    %purge% %actor.inventory(200)%
    done
    %send% %actor% %self.name% says, 'Here you go.'
  end
end

I'm stumped at this point, but will keep plugging away at it. Thanks for the help in advance.



Last edited by armitage (18 Oct 2009 - 12:39)
18 Oct 2009 - 18:481961
I decided to make a similar trig since it is tough to troubleshoot yours over the forums. Though I wasn't
really keen on shoveling manure so I made a panning for gold trigger.
Name: 'Panning for gold',  VNum: [  700], RNum: [  272]
Trigger Intended Assignment: Rooms
Trigger Type: Command , Numeric Arg: 100, Arg list: p
Commands:
* Don't let someone spam the trigger to make money. Take some movement points away every 
* round and stop when they get to 10
if %actor.move% <= 10
  %send% %actor% You are too exhausted to continue.
  halt
end
* Fire on pan gold or abbreviations of each word
if %cmd% /= pan && %arg% /= gold
  eval heldobj %actor.eq(hold)%
  * Make sure they picked up the gold pan in room 703 and are holding it
  if %heldobj.vnum% == 717
    %send% %actor% You dip your pan into the river and begin swirling it in the water.
    %echoaround% %actor% %actor.name% dips a pan into the river and begins panning for gold.
    * Take 10 movement points away, wait 3 seconds and give a 1 in 10 chance of success.
    nop %actor.move(-10)%
    wait 3 sec
    if %random.10% == 1
      %send% %actor% You find a small gold nugget in the bottom of your pan.
      %echoaround% %actor% %actor.name% picks something out of %actor.hisher% pan.
      * Give them a nugget
      %load% obj 718 %actor% inv
    else
      %send% %actor% You find nothing of value
    end
  else
    %send% %actor% You need a pan for that.
  end
end
In the future make sure to paste your entire trig. Since there could be something wrong with Num Arg
or Arguments.


__________________
Rumble
The Builder Academy
tbamud.com 9091

Last edited by Rumble (18 Oct 2009 - 18:50)
18 Oct 2009 - 22:471962
Thanks Rumble! I got it adapted at it works straight out of the gate. I like the idea to take movement. Didn't think about any spamming it.


Login to reply  Page: « < 1 of 1 > »