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
palio
Novice


Joined: 30 Jul 2003
Posts: 36

PostPosted: Wed Jul 30, 2003 8:42 pm   

Text Input box/Needed script
 
First question:
In my old client I could type say the alias mm for magic missile and then hit the up arrow key and enter to repeat the command. In zmud I find I can only do that with 3 or more letters. Is there a way to make this work with 2 possibly even 1 character?


Second Question;
When I identify an item I would like an easy way to send it to the database but I know this can happen but my script writting abilities are not top of the line yet and I would like it as soon as possible. Can someone help me do this? The ID would look similar to this (standard rom mud different objects would have different fields)

Object 'manacles' is type armor.
Wear flags take hands, extra flags hum.
Weight is 2, value is 15, condition is 99, level is 19.
Armor class is 10 pierce, 10 bash, 10 slash, and 9 vs. magic.
Affects hp by -25.
Affects constitution by -3.
Affects strength by -3.
zone underdark
location slaver


Third question;

I have a database of about 2000 items in it in the above mentioned format. Is there an easy way to import that into the database? ro do i have to do it by hand?

Any and all answers would be appreciates. Correct answers even more so. Thanks for everyones help in advance.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Thu Jul 31, 2003 1:19 am   
 
This looks to be a relatively standard ROM type mud ID output. As such I can donate the script I had going for this. There are still some minor bugs in it, just hadn't gotten around to fixing em. You will have to tweak it to match your DB fields and create the initial DB.

#CLASS {ID}
#ALIAS StoreID {CapturingID=%query((&Name=@Affects));#DBRESET;Affects="";#FORALL @CapturingID {#DBGET {%i};#IF ((&TStats=@IDedItem.TStats)&(&Affects=@IDedItem.Affects)) { #ADDITEM Affects {%i}}};#IF (@Affects="") {#NEW All {Where=New Item};#LOOPDB @IDedItem {#ADDKEY %rec %key %val};#DBSAVE} { #ECHO Item appears to duplicate records @Affects .}}
#VAR CapturingID {} {}
#VAR Affects {} {}
#VAR IDedItem {} {}
#VAR IDsPending {}
#TRIGGER "IDCapture" {^You recite a scroll of identify.$} {CapturingID=""} "" {case}
#COND {} {#IF ((%ascii(%line)>64)&(%ascii(%line)<91)) { CapturingID=%concat(@CapturingID,%line)} {#STATE IDCapture 2;#SET IDCapture 2 1}} {looplines|param=99}
#COND {} {CapturingID=%replace(@CapturingID,"Object '","KeyWords=");CapturingID=%replace(@CapturingID,"' is type ","|Type=");CapturingID=%replace(@CapturingID,", extra flags ","|Flags=");CapturingID=%replace(@CapturingID,".Weight is ","|Weight=");CapturingID=%replace(@CapturingID," is ","=");CapturingID=%replace(@CapturingID," by ","=");CapturingID=%replace(@CapturingID,"Armor class","TStats=AC");CapturingID=%replace(@CapturingID,"Damage","TStats=Dam");CapturingID=%replace(@CapturingID," to ","-");CapturingID=%replace(@CapturingID," (average ","A");CapturingID=%replace(@CapturingID,"("," ");CapturingID=%replace(@CapturingID,")","");CapturingID=%replace(@CapturingID,".","|");CapturingID=%replaceitem(%word(%item(@CapturingID,4),1,","),4,@CapturingID);#DELITEM CapturingID {};Affects="";#FORALL @CapturingID { #IF ((%begins("%i","Affects"))|(%begins("%i","Causes"))) {CapturingID=%delitem("%i",@CapturingID);Affects=%additem(%trim(%remove(%word("%i",1),"%i")),@Affects)} { #IF (%begins("%i","Has")) {CapturingID=%delitem("%i",@CapturingID);Affects=%additem(%concat(%word("%i",3)," of L",%word("%i",7)," ",%copy("%i",%pos(%word("%i",8),"%i"),255)),@Affects)}}};#IF (@Affects) { CapturingID=%concat(@CapturingID,"|(Affects=",@Affects,")")};IDedItem="";#ADDKEY IDedItem @CapturingID;Affects="";#WHILE (@Affects="") {#LOOPDB @ItemsOnHand { #IF (%word(%val,1)) {#ADDITEM Affects {%key}}};#FORALL @Affects { #IF (%pos(%lower(%word(%db(@IDedItem,"KeyWords"),1)),%lower("%i"))) {#DELITEM Affects {%i};Affects=%push("%i",@Affects)}};Affects=%pick("p:Item Name","o:1",@Affects)};#ADDKEY IDedItem Name @Affects;#ADDKEY IDedItem Wear %db(@WearLocations,@Affects);#LOOPDB @IDedItem { #IF (%pos("=",%val)) { #ADDKEY IDedItem {%key} {%concat(%char(34),%val,%char(34))}}};#DBLOAD ID;#VIEW All;#DBFIRST;#IF (%rec!="") { StoreID} {CapturingID=%concat("ID",%secs);#VAR @CapturingID @IDedItem {_nodef} {ID};#ADDITEM IDsPending @CapturingID}} {manual}
#BUTTON 999 {IDsPending:%numitems(@IDsPending)} {#IF (%numitems(@IDsPending)) {#DBOFFLINE;#DBLOAD ID;#VIEW All;#DBFIRST;#IF (%rec="") {#MENU {Windows|Database};#WHILE (%rec="") {#DBLOAD ID;#VIEW All;#DBFIRST}};IDedItem=@{%item(@IDsPending,1)};#UNVAR %pop(IDsPending) ID;Affects=%db(@IDedItem,"Name");StoreID}} {} {} {%numitems(@IDsPending)} {} {} {} {} {} {Pos} {1} {880} {32800} {} {Gauge||10|5|0|11} {} "" {Explore|Inset} {} {StoreIDs}
#CLASS 0
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