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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » Finished MUD Scripts
karthic
Wanderer


Joined: 28 Aug 2001
Posts: 86
Location: USA

PostPosted: Thu Jan 03, 2002 4:21 am   

wanna help me shorten this database script?
 
These are the 16 different types of lines that i need to pick up.. and format/store to thier proper variables...
-------------------------------------------
You see FIRSTNAME LASTNAME, a RACE.
You see FIRSTNAME LASTNAME of elanthia, a RACE.
You see FIRSTNAME LASTNAME, a RACE GUILD.
You see FIRSTNAME LASTNAME of elanthia, a RACE GUILD.

You see TITLE FIRSTNAME LASTNAME, a RACE.
You see TITLE FIRSTNAME LASTNAME of elanthia, a RACE.
You see TITLE FIRSTNAME LASTNAME, a RACE GUILD.
You see TITLE FIRSTNAME LASTNAME of elanthia, a RACE GUILD.

then.. you've got others for thieves..
You see a fellow thief, FIRSTNAME LASTNAME, a RACE.
You see a fellow thief, FIRSTNAME LASTNAME of elanthia, a RACE.
You see a fellow thief, FIRSTNAME LASTNAME, a RACE GUILD.
You see a fellow thief, FIRSTNAME LASTNAME of elanthia, a RACE GUILD.
You see a fellow thief, TITLE FIRSTNAME LASTNAME, a RACE.
You see a fellow thief, TITLE FIRSTNAME LASTNAME of elanthia, a RACE.
You see a fellow thief, TITLE FIRSTNAME LASTNAME, a RACE GUILD.
You see a fellow thief, TITLE FIRSTNAME LASTNAME of elanthia, a RACE GUILD.

this catagory the title.. is a fake one.. and the secondtitle is a real title.... both need to be stored.. but this section prolly needs to be different from the others
You see You see TITLE (a thief SECONDTITLE) FIRSTNAME LASTNAME, a RACE.
You see You see TITLE (a thief SECONDTITLE) FIRSTNAME LASTNAME of elanthia, a RACE.
You see You see TITLE (a thief SECONDTITLE) FIRSTNAME LASTNAME, a RACE GUILD.
You see You see TITLE (a thief SECONDTITLE) FIRSTNAME LASTNAME of elanthia, a RACE GUILD.
------------------------------------------------




This is the script i use to do it...


#IG
#var thiefaddin {}
#var ttempclass "None"
#var tempname {}
#var tempname2 {}
#var temprace {}
#var tempcit {}
#var citizen {}
#var firstpersonname {}
#var secondpersonname {}
#var tempclass {}
#var tempcircle {}
#var firsttitle "None"
#var secondtitle "None"
@tempname = %trim( %1)
@tempname2 = %trim( %2)
#if (%ends( @tempname2, Mage)) {
#MATH name2total %numwords( @tempname2)-1
#math name2total %pos( %word( @tempname2, @name2total), @tempname2)-1
@tempclass = %right( @tempname2, @name2total)
} {@tempclass = %item( @classlist, %ismember( %word( @tempname2, %numwords( @tempname2)), @classlist))}
@twoclass = @tempclass
@tempname2 = %trim( %remove( @tempclass, @tempname2))
@temprace = %item( @racelist, %ismember( @tempname2, @racelist))
@tempname2 = %trim( %remove( @temprace, @tempname2))
@citizen = %trim( %item( @citlist, %ismember( %word( @tempname, %numwords( @tempname)), @citlist)))
#if (@citizen <> "None") {
#var citpos %pos( @citizen, @tempname)
#MATH citpos @citpos-1
@tempname = %left( @tempname, @citpos)
@tempname = %remove( "of the", @tempname)
@tempname = %remove( "of Aesry", @tempname)
@tempname = %remove( " of ", @tempname)
@tempname = %remove( " the ", @tempname)
@tempname = %remove( @citizen, @tempname)
@tempname = %trim( @tempname)
}
@secondpersonname = %word( @tempname, %numwords( @tempname))
@tempname = %trim( %remove( @secondpersonname, @tempname))
@firstpersonname = %word( @tempname, %numwords( @tempname))
@tempname = %trim( %remove( @firstpersonname, @tempname))
#if (@tempclass != "None" and @tempclass != "Thief") {#delITEM boxteefs @firstpersonname}
#if (%ismember( @firstpersonname, @boxteefs)) {@tempclass = "Thief"}
#if (%pos( fellow, @firstpersonname)) {} {
#if (%ends( @tempname, ")")) {
@tempclass = "Thief"
@tempname = %trim( %remove( ")", @tempname))
@thiefaddin = %pos( "(a thief", @tempname)
#AD thiefaddin 8
@firsttitle = %trim( %copy( @tempname, @thiefaddin, 20))
@tempname = %trim( %remove( @firsttitle, @tempname))
@tempname = %trim( %remove( "(a thief", @tempname))
@secondtitle = @tempname
#var tempname {}
} {
#if (@tempname) {#if (@tempclass =~ "Thief") {#if (%ismember( @tempname, @thieftitles)) {@firsttitle = @tempname} {@secondtitle = @tempname}} {@firsttitle = @tempname}}
}
#if (%ismember( @firstpersonname, @boxteefs)) {@tempclass = "Thief"}
#if (@tempclass != "None" and @tempclass != "Thief") {#delITEM boxteefs @firstpersonname}
#if (%ismember( @firsttitle, @thieftitles)) {@tempclass = "Thief"}
#if (@tempclass =~ "Thief") {#addITEM boxteefs @firstpersonname}
#if (@firsttitle != "None") {
#if (%ismember( @firsttitle, @barbtitles)) {@tempclass = "Barbarian"}
#if (%ismember( @firsttitle, @bardtitles)) {@tempclass = "Bard"}
#if (%ismember( @firsttitle, @clerictitles)) {@tempclass = "Cleric"}
#if (%ismember( @firsttitle, @empathtitles)) {@tempclass = "Empath"}
#if (%ismember( @firsttitle, @moontitles)) {@tempclass = "Moon Mage"}
#if (%ismember( @firsttitle, @paladintitles)) {@tempclass = "Paladin"}
#if (%ismember( @firsttitle, @rangertitles)) {@tempclass = "Ranger"}
#if (%ismember( @firsttitle, @thieftitles)) {@tempclass = "Thief"}
#if (%ismember( @firsttitle, @tradertitles)) {@tempclass = "Trader"}
#if (%ismember( @firsttitle, @warriortitles)) {@tempclass = "Warrior Mage"}
}
#if (@secondtitle != "None") {
#if (%ismember( @secondtitle, @barbtitles)) {@ttempclass = "Barbarian"}
#if (%ismember( @secondtitle, @bardtitles)) {@ttempclass = "Bard"}
#if (%ismember( @secondtitle, @clerictitles)) {@ttempclass = "Cleric"}
#if (%ismember( @secondtitle, @empathtitles)) {@ttempclass = "Empath"}
#if (%ismember( @secondtitle, @moontitles)) {@ttempclass = "Moon Mage"}
#if (%ismember( @secondtitle, @paladintitles)) {@ttempclass = "Paladin"}
#if (%ismember( @secondtitle, @rangertitles)) {@ttempclass = "Ranger"}
#if (%ismember( @secondtitle, @thieftitles)) {@ttempclass = "Thief"}
#if (%ismember( @secondtitle, @tradertitles)) {@ttempclass = "Trader"}
#if (%ismember( @secondtitle, @warriortitles)) {@ttempclass = "Warrior Mage"}
} {@ttempclass = "None"}
#var tempcircle "0"
#if (@firsttitle != "None") {
#if (%ismember( @firsttitle, @fivetitles)) {@tempcircle = 5}
#if (%ismember( @firsttitle, @tentitles)) {@tempcircle = 10}
#if (%ismember( @firsttitle, @twentytitles)) {@tempcircle = 20}
#if (%ismember( @firsttitle, @thirtytitles)) {@tempcircle = 30}
#if (%ismember( @firsttitle, @fiftytitles)) {@tempcircle = 50}
#if (%ismember( @firsttitle, @seventytitles)) {@tempcircle = 70}
#if (%ismember( @firsttitle, @nintytitles)) {@tempcircle = 90}
#if (%ismember( @firsttitle, @onetitles)) {@tempcircle = 100}
#if (%ismember( @firsttitle, @onetwentytitles)) {@tempcircle = 125}
#if (%ismember( @firsttitle, @onefiftytitles)) {@tempcircle = 150}
#if (@firsttitle = "Novice") {@tempcircle = 1}
#if (@firsttitle = "Mentor") {@tempcircle = 1}
#if (@tempcircle < 1) {#if (@tempclass != "None") {
#var unktitles %additem( @firsttitle, @unktitles)
#var unktitles %additem( @tempclass, @unktitles)
} {#if (%ismember( @firsttitle, @unktitles)) {#noop} {
#var unktitles %additem( @firsttitle, @unktitles)
#var unktitles %additem( @tempclass, @unktitles)
}}}
}
#if (@temprace = "Kaldaran") {#var temprace "Kaldar"}
#if (@temprace = "Dwarven") {#var temprace "Dwarf"}
#if (@temprace = "Elven") {#var temprace "Elf"}
#if (@twoclass <> @Tempclass and @twoclass <> "None") {@tempclass = @twoclass}
#if (@tempclass != "None" and @tempclass != "Thief") {#delITEM boxteefs @firstpersonname}
#if (@tempclass =~ "Thief") {#ADDITEM boxteefs @firstpersonname}
#echo @firstpersonname @secondpersonname @temprace @tempclass @citizen @firsttitle @secondtitle @tempcircle @ttempclass
@tempna = %query( &Fname=@firstpersonname)
#if (@tempna) {
#dbget @tempna
#If (&circle < @tempcircle) {&circle = @tempcircle}
#If (@tempclasss != "None") {&class = @tempclass}
#If (@citizen != "None") {&citizen = @citizen}
#If (@ttempclass != "None") {&fakeclas = @ttempclass}
&race = @temprace
&time = %time( )
&place = %sort( %dups( %additem( "Crossing", &place)))
&lastplace = "Crossing"
} {
#NEW people {fName=@firstpersonname|Lname=@secondpersonname|Race=@temprace|class=@tempclass|Circle=@tempcircle|fakeclas=@ttempclass|citizen=@citizen|time=%time( )|place="Crossing"|lastplace="Crossing"}
}
SLEEP
}
#dbsave
#IG


-------------------------------------------



Now ... this script can take several seconds to run, with a database of over 4000 items... i believe the slowness is in the finding the item in the database.. but anyone know of a way to make this faster? cause i have a script that runs RIGHT after this on the next line... but since i HAVE to disable all triggers while its runnin(if i dont... it will trigger again.. and the database cant deal with multiple query's.. and it messes up the data...)
or... is there a way pause mud output during trigger exectutation? that might fix it..

thanks

karthic

karthic
Reply with quote
karthic
Wanderer


Joined: 28 Aug 2001
Posts: 86
Location: USA

PostPosted: Thu Jan 03, 2002 4:35 am   
 
oh.. this is what it triggers off of...

You see (*), {a|an} (*).

karthic
Reply with quote
Darker
GURU


Joined: 24 Sep 2000
Posts: 1237
Location: USA

PostPosted: Thu Jan 03, 2002 2:02 pm   
 
I appreciate that this is a finished script, but I'd like to keep this particular forum free of conversations, as a library of published scripts.

Could you please take your question to the General forum? Thanks.



zMUD 6 Online Help: All the power you'll ever need.
Reply with quote
Troubadour
GURU


Joined: 14 Oct 2000
Posts: 556
Location: USA

PostPosted: Sat Apr 06, 2002 5:14 pm   
 
What MUD is this for?

Troubadour
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » Finished MUD Scripts 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