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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Fitzwilliam
Beginner


Joined: 24 Aug 2006
Posts: 11

PostPosted: Mon Sep 04, 2006 5:02 pm   

Working Damaged Equipment Code (Need Help)
 
This is code someone wrote to keep track of damage to equipment on Realms of Despair. When equipment is damaged, this code will keep track and if it gets too damaged it will remove the item before it gets destroyed.

QUESTIONS:

1. The problem is that from the way I am reading it, if you have two items that are named the same it will not work for them. For example, say you have a traveling cloak in both neck slots, because the variable damcon_eq only uses the last word for the item, I do not think it would keep track of both separately.

2. Can this be made more comprehensible? The trigger code uses variables like aaa eee ccc and such and it is hard to follow.

3. Can this be made better, performance wise or efficiency wise by reducing code?

Thank you

VARIABLES

damcon_eq ;items you want to keep an eye on using the LAST WORD of its name, case matters.
Value Example: Lifebane|Wrath|kilt|Shieldbreaker|Whispers|Chaos

damcon_max ;list of the maximum number of hits the items can take before you want them removed,
Value Example: 10|12|14|10|15|13

damcon_rem ;fill the list of keywords for each item. The triggers will remove the items by these keywords.
Value Example: lifebane|veil|kilt|shieldb|whispers|chaos-belt

ALIAS

rep ;this alias is used when you get your equipment repaired by an NPC
remove all
repair all
wear all
#VAR damcon_dam ""
#FORALL @damcon_eq {#VAR damcon_dam %additem("0",@damcon_dam)}

dam ;this alias displays the number of times damaged of all of your equipment
#SHOW *** hit counters: ***
#LOOP 1,%numitems(@damcon_eq) {#SHOW %item(@damcon_dam,%i) %item(@damcon_rem,%i)}

TRIGGER

Pattern: ^~((*) gets damaged~)$
#VAR eee {%1}
#VAR eee %word({@eee},%numwords(@eee))
#VAR aaa %ismember(@eee,@damcon_eq)
#IF (@aaa > 0) {#VAR bbb %item(@damcon_max,@aaa)
#VAR ccc %eval(%item(@damcon_dam,@aaa))
#ADD ccc 1
#VAR ddd %item(@damcon_rem,@aaa)
#DELNITEM damcon_eq @aaa
#VAR damcon_eq %additem(@eee,@damcon_eq)
#DELNITEM damcon_rem @aaa
#VAR damcon_rem %additem(@ddd,@damcon_rem)
#DELNITEM damcon_max @aaa
#VAR damcon_max %additem(@bbb,@damcon_max)
#DELNITEM damcon_dam @aaa
#VAR damcon_dam %additem(@ccc,@damcon_dam)
#IF (@ccc >= @bbb) {#BEEP
#COLOR red
rem @ddd}}
Reply with quote
Vitae
Enchanter


Joined: 17 Jun 2005
Posts: 673
Location: New York

PostPosted: Tue Sep 05, 2006 12:22 pm   
 
You can just rename the vars yourself.
open notepad.
press ctrl-h
type aaa in the 1st box
type whatever you want in the second
press replace all
repeat for all the letters
save
delete old script in zmud
import
That should be it.
_________________
http://www.Aardwolf.com
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD 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