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
Cronos
Beginner


Joined: 06 Sep 2004
Posts: 20

PostPosted: Sun Jan 08, 2023 5:52 pm   

CMUD Help File on Identify
 
I was going through the CMUD help section and was interested in the topic below but then noticed the Help File for this topic was never finished.

Quote:
Adding data from the MUD

Because the CMUD database can be controlled from the CMUD scripting language, you can set up triggers and aliases to automatically capture the result of an "identify" spell on the MUD and create a new record with this data. For information on how to do this, see the help section on Scripting the Database.


The link is here:
http://forums.zuggsoft.com/modules/mx_kb/kb.php?mode=doc&page=3&refpage=3&a=cmud_Programming_the_Database

I am wondering if anyone can give some instructions on how to program this. I would like to store this into my own cmud database once I recite an "identify" scroll and get results back on armor or weapons or other items. Below is a sample of what the results of an identify scroll looks like.

Object 'an indigo blade', Item type: WEAPON
Item is wielded: one-handed
Item is: GLOW MAGIC !EVIL !NEUTRAL !SORCERER !DRUID !SHAMAN !ASSASSIN !NECROMANCER !CONJURER
Weight: 12.00, Effective Weight: 12.00, Value: 3700, Level: 70
Damage Dice is '2D8' for an average per-round damage of 9.0.
Apply: +3 to DAMROLL

Object 'a leopard helm', Item type: ARMOR
Item is worn: HEAD
Item is: HUM !SORCERER !ROGUE !MONK !BARD
Weight: 5.00, Effective Weight: 5.00, Value: 400, Level: 40
AC-apply is 4
Apply: +1 to DAMROLL

Object 'a feathered helm', Item type: ARMOR
Item is worn: HEAD
Item is: MAGIC !SORCERER !ROGUE !RANGER !MONK
Weight: 4.80, Effective Weight: 4.80, Value: 1000, Level: 20
AC-apply is 6
Apply: +1 to INT
Apply: +2 to WIS

Object 'a hide shield', Item type: ARMOR
Item is worn: SHIELD
Item is: !MONK
Weight: 1.90, Effective Weight: 1.90, Value: 100, Level: 10
AC-apply is 3
Apply: +1 to CON

Object 'a dark cloak', Item type: ARMOR
Item is worn: ABOUT
Item is: !GOOD !NEUTRAL FLOAT
Weight: 3.00, Effective Weight: 3.00, Value: 200, Level: 20
AC-apply is 4
Apply: -1 to HITROLL
Apply: +1 to DEX


Thanks!
Reply with quote
shalimar
GURU


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

PostPosted: Mon Jan 09, 2023 5:59 am   
 
The sql database implementation in CMUD is a bit kludgey at best.

I would suggest making use of a database variable instead.

Here is a mockup I made that should cover all the armor type items.
Some edits will be needed to cover weapons or other item types since the output changes a bit:

Code:
<trigger priority="494290" id="49429">
  <pattern>Object '(*)', Item type: (%w)</pattern>
  <value>$name=%1
$type=%2
thisItem=%db($name, @itemDB)
#ADDKEY thisItem Name $name
#ADDKEY thisItem Type $type</value>
  <trigger type="Within Lines" param="1">
    <pattern>Item is worn: (*)</pattern>
    <value>$worn=%1
#ADDKEY thisItem Worn $worn</value>
  </trigger>
  <trigger type="Within Lines" param="1">
    <pattern>Item is: (*)</pattern>
    <value>$this=%replace(%1, " ", "|")
#ADDKEY thisItem Restriction $this</value>
  </trigger>
  <trigger type="Within Lines" param="1">
    <pattern>Weight: (*), Effective Weight: (*), Value: (%d), Level: (%d)</pattern>
    <value>#ADDKEY thisItem Weight %1
#ADDKEY thisItem eWeight %2
#ADDKEY thisItem Value %3
#ADDKEY thisItem Level %4</value>
  </trigger>
  <trigger type="Within Lines" param="1">
    <pattern>AC-apply is (%d)</pattern>
    <value>#ADDKEY thisItem AC %1</value>
  </trigger>
  <trigger type="Within Lines" param="1">
    <pattern>*</pattern>
    <value>#IF %match( %line, "Apply: (%n) to (%w)", $val, $stat) {
  $stat=%proper( $stat)
  #ADDKEY thisItem $stat $val
  #STATE 5
  } {
  $name=%db( @thisItem, Name)
  #SAY $name has been recorded
  #DELKEY thisItem Name
  #SHOWDB @thisItem
  #ADDKEY itemDB $name @thisItem
  }</value>
  </trigger>
</trigger>


This would go on the XML tab of a new trigger.
Replace what is already there.
_________________
Discord: Shalimar#3679
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