Author Topic: if %cmd.mudcommand%==get  (Read 14436 times)

0 Members and 1 Guest are viewing this topic.

Offline Tocharaeh

  • Sr. Member
  • ****
  • Posts: 283
    • View Profile
    • 4Dimensions on Facebook!
if %cmd.mudcommand%==get
« on: July 06, 2009, 06:30:02 pm »
Okay, so here is the question. I have two scripts working in a single room. One being the function script, and the other being the meat and potatos:

1)

Name: 'The function',  VNum: [xxxxx], RNum: [ xxxx]
Trigger Intended Assignment: Rooms
Trigger Type: CommandFUNCTION
, Numeric Arg: 0, Arg list: get
Commands:
if %cmd.mudcommand%==get
  function xxxxx
else
  return 0
end

2) the Meat and potatos

Name: 'meat 'n potatos',  VNum: [xxxxx], RNum: [ xxxx]
Trigger Intended Assignment: Rooms
Trigger Type: Command, Numeric Arg: 100, Arg list: get
Commands:
if %actor.is_pc%
  if %arg% == something somewhere
    %load% obj xxxxx %actor%
    %send% %actor% Something good happens
  elseif %arg% == something somewhere1
    %load% obj xxxxx %actor%
    %send% %actor% Something good happens
  elseif %arg% == something somewhere2
    %load% obj xxxxx %actor%
    %send% %actor% Something good happens
  elseif %arg% == something somewhere3
    %load% obj xxxxx %actor%
    %send% %actor% Something good happens
  elseif %arg% == something somewhere4
    %load% obj xxxxx %actor%
    %send% %actor% Something good happens
  elseif %arg% == something somewhere5
    %load% obj xxxxx %actor%
    %send% %actor% Something good happens
  elseif %arg% == something somewhere6
    %load% obj xxxxx %actor%
    %send% %actor% Something good happens
  elseif %arg% == something somewhere7
    %load% obj xxxxx %actor%
    %send% %actor% Something good happens
  elseif %arg% == something somewhere8
    %load% obj xxxxx %actor%
    %send% %actor% Something good happens
  elseif %arg% == something somewhere9
    %load% obj xxxxx %actor%
    %send% %actor% Something good happens
  else
    return 0
  end
else
  return 0
end
--------------------
The script works perfectly, however if a player were to just type GET on its own they would have You don't see a }12 here..
What would be a good way to improve the script and/or prevent the error return taht I am getting?

Thanks!
-Toch
-Tocharaeh D'Araesth
The Dirty Ol'' Drow that time left behind in fear of obliteration!

Offline Tocharaeh

  • Sr. Member
  • ****
  • Posts: 283
    • View Profile
    • 4Dimensions on Facebook!
Re: if %cmd.mudcommand%==get
« Reply #1 on: July 07, 2009, 01:59:19 am »
I'm having another problem. If mort gives correct item, nothing happens. If mort then gives wrong item, the trigger kicks in, and runs BOTH correct item trigger, and it's else.


if (%object.vnum% != 29353)
  if !%actor.varexists(ThoseWhoHarp)%
    set ThoseWhoHarp 1
    remote ThoseWhoHarp %actor.id%
    wait 1 s
    say Hmm..
    emote examines %object% carefully and closes his eyes for a short time.
    wait 2 s
    emote smiles happily, and opens his eyes.
    say Yes, this is indeed the item He sent me for.
    mjunk %object%
    emote carefully removes a small jeweled trinket, and places it carefully on the dressing table.
    say A card of my calling.
    wait 2 s
    %echo% The room becomes very cold suddenly, and without notice a dark shadow with red eyes hovers near the ceiling.
    wait 1 s
    %echo% The shadow stretches outward and begins to solidify, taking the shape of a deadly looking creature.
    wait 1 s
    say Dark and empty! Hide, hide! It's a bloody grey! oh Dark and empty, we're done for. Quick, hide!
    wait 6 s
    say psst! Hide!
    wait 7 s
    say Hurry!
    wait 4 s
    %echo% The demon solidifies completely, and begins to lurk around the room.
    %load% mob 29352
    wait 4 s
    function 29356
  else
    wait 1 s
    %send% %actor% Jak examines it carefully, then shakes his head slowly.
    wait 1 s
    say No no, this isn't it. But it should fetch a raven or two...
    egrin
    wait 1 s
    rdelete ThoseWhoHarp %actor.id%
    wink %actor.name%
    mjunk %object%
  endif
endif

The result of this script if correct should tell the player to hide, who hides and is concealed from the loaded mob who will otherwise slay the unflagged player. if it is the wrong item, the halfling pockets it, and that's that.

When it runs correctly you get an error:

Jak Fleet states, 'Hmm..'
Jak Fleet examines }1409672 carefully and closes his eyes for a short time.
-----------------
Also, it will not run when the correct item is given, but WILL run if you give an incorrect item twice. What exactly am I doing wrong, and what should I do to fix this? Once I understand this, I can continue one with the rest of the multistep quest.
« Last Edit: July 07, 2009, 02:01:50 am by Tocharaeh »
-Tocharaeh D'Araesth
The Dirty Ol'' Drow that time left behind in fear of obliteration!

Offline Molly

  • Administrator
  • Hero Member
  • *****
  • Posts: 691
    • View Profile
Re: if %cmd.mudcommand%==get
« Reply #2 on: July 07, 2009, 04:32:03 am »
First script:
add a couple of lines to check for !%arg%, for instance:

  elseif !%arg%
   %send% %actor% <whatever you want the actor to see>.

(A simple else with the same message, should probably fix it too).

Second script:

I am not sure how this script is supposed to work.
Do you really want nothing at all to happen, if they give the right item?

If not, you should just remove the ! and instead make the first line:
if %object.vnum(29353)%

To stop the script from running both options, try adding a halt on a new line just after the line:
    function 29356

Jack should examine %object.shortdesc% not %object%, (which displays the id number of the item).

And there should also be an else option at the end, with a message to match the first if_check, (whether it is set up correctly as it is, or not).






 

Offline Tocharaeh

  • Sr. Member
  • ****
  • Posts: 283
    • View Profile
    • 4Dimensions on Facebook!
Re: if %cmd.mudcommand%==get
« Reply #3 on: July 07, 2009, 02:31:37 pm »
Hey thanks a ton. Somehow I had managed to make the mistake with the item check hehe. I'll add the halt too. Oh and thanks for the item id bit too. Now I know that :)
-Tocharaeh D'Araesth
The Dirty Ol'' Drow that time left behind in fear of obliteration!

Offline Tocharaeh

  • Sr. Member
  • ****
  • Posts: 283
    • View Profile
    • 4Dimensions on Facebook!
Re: if %cmd.mudcommand%==get
« Reply #4 on: July 07, 2009, 03:34:16 pm »
Any chance you could tell me exactly where to insert the couple lines for the first get script? Also, what would be a good way to check if the player has died? I'd like to check if the player has died, all scripts come to a complete halt, and the loaded mob purges itself. How would I go about that?
-Tocharaeh D'Araesth
The Dirty Ol'' Drow that time left behind in fear of obliteration!

Offline Molly

  • Administrator
  • Hero Member
  • *****
  • Posts: 691
    • View Profile
Re: if %cmd.mudcommand%==get
« Reply #5 on: July 08, 2009, 04:34:14 am »
First script:

if %actor.is_pc%
  if %arg% == something somewhere
    %load% obj xxxxx %actor%
    %send% %actor% Something good happens
  elseif %arg% == something somewhere1
    %load% obj xxxxx %actor%
    %send% %actor% Something good happens
  elseif %arg% == something somewhere2
    %load% obj xxxxx %actor%
    %send% %actor% Something good happens
  elseif %arg% == something somewhere3
    %load% obj xxxxx %actor%
    %send% %actor% Something good happens
  elseif %arg% == something somewhere4
    %load% obj xxxxx %actor%
    %send% %actor% Something good happens
  elseif %arg% == something somewhere5
    %load% obj xxxxx %actor%
    %send% %actor% Something good happens
  elseif %arg% == something somewhere6
    %load% obj xxxxx %actor%
    %send% %actor% Something good happens
  elseif %arg% == something somewhere7
    %load% obj xxxxx %actor%
    %send% %actor% Something good happens
  elseif %arg% == something somewhere8
    %load% obj xxxxx %actor%
    %send% %actor% Something good happens
  elseif %arg% == something somewhere9
    %load% obj xxxxx %actor%
    %send% %actor% Something good happens
  elseif !%arg%
   %send% %actor% <whatever you want the actor to see>.
  else
    return 0
  end
else
  return 0
end

Second script
Since players go to the Temple of the Gods when they die, you can just use any of the common checks to see if he still is in the room, for instance:

if %actor.room% == !%self-room%
 halt
else
 <move on with the script>
endif

You need to put that check in front of every command line, of course.
(This is generally a good thing to do with lengthy scripts, in case you use %send% %actor%, tell %actor.name%, or other similar commands that don't require the actor to be in the same room as the script.