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
hadar
Apprentice


Joined: 30 Aug 2009
Posts: 198
Location: my apt, in california

PostPosted: Tue Jul 19, 2011 4:15 am   

right click on an item
 
like say i have an item in my inventory called item A, its a bag, if i want to right click it and select an option how would i go about that like if i wanted to click and choose to drop it or look in it or sell it or whatever
_________________
if you build it they will come, assuming that they have not already come to build it
Aardwolf Bootcamp
My youtube channel
Reply with quote
Fizgar
Magician


Joined: 07 Feb 2002
Posts: 333
Location: Central Virginia

PostPosted: Tue Jul 19, 2011 5:45 am   
 
You'll want to use MXP to do that. A quick example:
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <class name="MXP_TRIGS" copy="yes">
    <trigger priority="10" copy="yes">
      <pattern>A bag</pattern>
      <value>#t- MXP_TRIGS
#sub {<send 'look in bag|drop bag|sell bag' 'look in|drop|sell'>A bag</send>}
#t+ MXP_TRIGS</value>
    </trigger>
  </class>
</cmud>

Anytime A bag is displayed on the screen the trigger will fire and replace the original text with a hyperlink item you can then click on. If you left click the item the first command will be sent automatically or you can right click on it for the drop down list of other options/commands. It's a good idea to either put the triggers in one class you can disable, do the substitute, and then enable again, or enable/disable the triggers by ID if you are gonna give the item the same name to prevent looping.

In the example above the first command will be sent when you left click the item, look in bag. The actual commands sent to the mud are the first string list with the menu items following in the second string list.

[EDIT] So I forgot this forum and certain things copied directly from the Package Editor in CMUD don't play well together some times. The above code won't paste directly into CMUD but I can't get the forum to display the actual code correctly either. Basically I created a class called MXP_TRIGS. Inside that class I created a trigger to make the item have a MXP hyperlink.

Trigger pattern: A bag

Trigger Script:
#t- MXP_TRIGS
#sub {<send 'look in bag|drop bag|sell bag' 'look in|drop|sell'>A bag</send>}
#t+ MXP_TRIGS


Sorry for the confusion.
_________________
Windows Vista Home Premium SP2 32-bit
AMD Athlon Dual Core 4400+ 2.31 GHz
3 GB RAM
CMUD 3.34
Reply with quote
shalimar
GURU


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

PostPosted: Tue Jul 19, 2011 10:31 am   
 
You could also make use of #MENU to do this.

#MENU look {look %selword}
#MENU drop {drop %selword}
#MENU sell {sell %selword}
_________________
Discord: Shalimarwildcat
Reply with quote
Anaristos
Sorcerer


Joined: 17 Jul 2007
Posts: 821
Location: California

PostPosted: Sun Jul 24, 2011 12:53 pm   
 
A minor modification to the trigger script would be:
Code:

#MXP <expire bags>
#sub {<send expire="bags" 'look in bag|drop bag|sell bag' 'look in|drop|sell'>A bag</send>}

This will reset old entries so that they are no longer clickable. That way accidents won't occur.
_________________
Sic itur ad astra.
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