Read and Write to Your Own Item Stats File

January 23, 2013 07:08AM
These are a pair of aliases I wrote to access an items.txt file on my hard drive from my cMud prompt.

WHAT THEY DO:

You can grab a starter file off the Diku page. This will let you search for any line that has a key word. So, if you're running around with a warrior and want to remember the stats on a pair of gloves you find you could type: item gloves

and you'd see this echoed to you on cMUD:

black gloves L18, 3 4 4 0, hit 2, cloth, w3
black leather gloves +E-G L35, 11 10 10 0, hit 1, arm -4, w1
blackened leather gloves L51, 1 1 1 0, arm -5, sbreath -5, dam 3, giant_only, w15
blademaster's gloves L48, 5 8 5 0, age 10, int 1, dex 1, dam 3, hit 3, leather, w1, Blademaster, Palace in Seantryn

If you find a new pair of gloves and learn the stats on them and want to add it to your file, you'd type this:
additem {studded leather work gloves L6, 4 4 4 4, dam 1, str 1, leather, w3, Middle-aged Man, Camelot}

Then next time you typed 'item gloves' you'd get this echoed....

black gloves L18, 3 4 4 0, hit 2, cloth, w3
black leather gloves +E-G L35, 11 10 10 0, hit 1, arm -4, w1
blackened leather gloves L51, 1 1 1 0, arm -5, sbreath -5, dam 3, giant_only, w15
blademaster's gloves L48, 5 8 5 0, age 10, int 1, dex 1, dam 3, hit 3, leather, w1, Blademaster, Palace in Seantryn
studded leather work gloves L6, 4 4 4 4, dam 1, str 1, leather, w3, Middle-aged Man, Camelot


ADD THESE TO cMUD as aliases...

#alias item {
#file 2 "C:\...REPLACE WITH YOUR PATHWAY...\ZmudItems.txt"
#var tmp_list %grep( 2, %1)
#loop 0,%numitems(@tmp_list) {#echo %item( @tmp_list, %i)}
#unvar tmp_list
#close 2
#GAG Opened "C:\...REPLACE WITH YOUR PATHWAY...\ZmudItems.txt" as file 2;
#GAG Closed "C:\...REPLACE WITH YOUR PATHWAY...\ZmudItems.txt" on file 2
#GAG Variable tmp_list removed.
}


#alias additem {
#file 2 "C:\...REPLACE WITH YOUR PATHWAY...\ZmudItems.txt"
#wri 2 %1
#echo %1
#close 2
#GAG Opened "C:\...REPLACE WITH YOUR PATHWAY...\ZmudItems.txt" as file 2;
#GAG Closed "C:\...REPLACE WITH YOUR PATHWAY...\ZmudItems.txt" on file 2
#GAG Variable tmp_list removed.
}
Subject Author Posted

My Recent Cmud Lessons...Tips and Questions

JimmyDean January 10, 2013 06:50AM

Fixed Mystery No-Fire Trigger Problem

JimmyDean January 30, 2013 07:11AM

Read and Write to Your Own Item Stats File

JimmyDean January 23, 2013 07:08AM

Useful stuff

daurwyn(VIP) January 26, 2013 07:48AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 40
Record Number of Users: 59 October 25, 2015
Record Number of Guests: 143 August 28, 2015