Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
hishiad
Newbie


Joined: 11 Jan 2016
Posts: 3

PostPosted: Mon Jan 11, 2016 7:56 pm   

Setting a script for hunting with variables
 
I've been mudding for quite awhile, and have mainly used GMUD, Zmud, and of course now CMUD.

I'm familiar with how to setup triggers and such, but this one has baffled me a bit so I'm looking for some assistance hopefully.


Basically the mud I play allows you to hunt so a typically "script" for hunting will often look like this

(player input) hunt goblin

(mud output) A goblin is north from here.

(pattern)
* is %1 from here.

(trigger)
line 1: %1
line 2: hunt goblin


And that tends to work in most areas fairly easily, but what I'm trying to do now is hunt the same mob name in an area where the respawns throw off number. So basically this area the mob is a 'fire widow' I want to initiate a 'hunt fire widow' and when I get the return 'No-one around by that name.' I want my trigger to then 'hunt 2.fire widow' and if it gets the same return jump to the next digit 3, 4, or 5 etc. until it hits again...then I want it to continue hunting whatever "hits" until the generic 'A fire widow has been defeated.' happens after finding and successfully killing the mob. Then I'd want it to reset and start trying to hunt fire widow again.


This is the XML copy of the current script

Code:

-<cmud>


-<class name="Widows">


-<trigger priority="1730">

<pattern>You step into a razorweb! It feels sticky and restraining!</pattern>

<value>kill web</value>

</trigger>


-<trigger priority="1760">

<pattern>* has been defeated!!</pattern>

<value>hunt fire widow</value>

</trigger>


-<trigger priority="1770">

<pattern>* is %1 from here *</pattern>

<value>%1 hunt fire widow</value>

</trigger>


-<trigger priority="1780">

<pattern>No-one around by that name.</pattern>

<value>#WAIT 15000 hunt 2.fire widow</value>

</trigger>

</class>

</cmud>
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4662
Location: Pensacola, FL, USA

PostPosted: Mon Jan 11, 2016 9:35 pm   
 
Sounds simple enough.
You will need a placeholder variable that gets reset to 1 when your prey is defeated/killed.

I also added the need for a @prey to be defined for it to do anything, allowing an easy means of turning it off.

#ALIAS hunt {#IF (@prey) {#IF (@preyNumber=1) {~hunt @prey} {~hunt %concat(@preyNumber, ".", @prey)}}}

#TRIGGER {{@prey} is (%w) from here} {%1;hunt @prey}

#TRIGGER {{@prey} has been defeated!!} {preyNumber=1;hunt @prey}

#TRIGGER {No-one around by that name.} {preyNumber=(@preyNumber+1);#WAIT 1500;hunt @prey}

That should do what you want.
_________________
Discord: Shalimarwildcat
Reply with quote
hishiad
Newbie


Joined: 11 Jan 2016
Posts: 3

PostPosted: Mon Jan 11, 2016 11:59 pm   
 
Okay...more messing around and I got it to work correctly.
Reply with quote
hishiad
Newbie


Joined: 11 Jan 2016
Posts: 3

PostPosted: Sat Feb 27, 2016 3:37 am   
 
shalimar, you're awesome...I've come back to you for a tweak to this epic script you helped me make :)


basically I'm in a leveling area on my Mud that uses the keyword "golem" for all the mobs, although different types of golem exist. Well this thing does wonders, except when I clear all of the mobs before respawn...then the counter numbers just keeps climbing.


I'd like to force it to stop at 10 and reset to start back at 1 once it hits 10...any help would be greatly appreciated! Thanks
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4662
Location: Pensacola, FL, USA

PostPosted: Sat Feb 27, 2016 6:38 am   
 
#TRIGGER {No-one around by that name.} {preyNumber=(@preyNumber+1);#IF (@preyNumber<10) {#WAIT 1500;hunt @prey} {preyNumber=1;#PRINT {Try again later!}}}
_________________
Discord: Shalimarwildcat
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net