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
BlackSmith
Apprentice


Joined: 08 Dec 2002
Posts: 152

PostPosted: Mon Jan 30, 2006 2:47 pm   

partner recognization and returning a value
 
This is what i have tought now:

(*)
#If ("%1" = "blaa bloo blöö") {#PSUB "Magic missile" %x1 ;#PCOL indianred %x1} {
_#If ("%1" = "blaa blöö blöö") {#PSUB "Disintigrate" %x1 ;#PCOL pink %x1} {
__#If ("%1" = "blaa blöö") {#PSUB "Heal" %x1; #PCOL white %x1} {
___#If ("%1" = "zaprakakadukapöka!") {#PSUB "Genocide" %x1 ;#PCOL blue %x1}
__}
_}
}


This would be OK if it would stop here but this is missing about 300 more If lines.

Any way i could use DB in this instead?
Thus when same partner is found in DB it would return two values (name and color in this case).
_________________
BatMUD Best MMORPG around since 1990 telnet://bat.org:23
~ Magic & Mind beats Chrome & Meat anytime ~
Pattern(s) in PERL. Using Cmud 1.34/2.09 & BatClient.
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Tue Jan 31, 2006 2:52 pm   
 
#ALIAS AddClearWord {
#NOOP Syntax: AddClearWord blaa bloo blöö|Magic missile/indianred
#NOOP blaa bloo blöö: %copy( %-1, 1, %pos( "|", %-1)-1)
#NOOP Magic missile: %copy( %-1, %pos( "|", %-1)+1, %pos( "/", %-1)-(%pos( "|", %-1)+1))
#NOOP indianred: %copy( %-1, %pos( "/", %-1)+1, %len( %-1))
#ADDITEM AddClearWord.List {%copy( %-1, 1, %pos( "|", %-1)-1)}
#ADDKEY AddClearWord.Word {%copy( %-1, %pos( "|", %-1)+1, %pos( "/", %-1)-(%pos( "|", %-1)+1))}
#ADDKEY AddClearWord.Colour {%copy( %-1, %pos( "/", %-1)+1, %len( %-1))}
}

#TRIGGER {({@AddClearWord.List})} {
#PSUB %item(@AddClearWord.Word,%ismember(%1,@AddClearWord.List)) %x1
#PCOL %item(@AddClearWord.Colour,%ismember(%1,@AddClearWord.List)) %x1
}

Something like that should work. Its untested but the idea is right. Probably better ways to consolidate the pairs so they can be edited.
Reply with quote
BlackSmith
Apprentice


Joined: 08 Dec 2002
Posts: 152

PostPosted: Wed Feb 01, 2006 1:43 am   
 
Eh, you kinda lost me.
Im doing this for 461 spells and return values to them thus could you please explane bit more.
Doing 460 times If methods, is bit too much for the client and maintance will be beond pain.
_________________
BatMUD Best MMORPG around since 1990 telnet://bat.org:23
~ Magic & Mind beats Chrome & Meat anytime ~
Pattern(s) in PERL. Using Cmud 1.34/2.09 & BatClient.
Reply with quote
Vorax
Apprentice


Joined: 29 Jun 2001
Posts: 198
Location: USA

PostPosted: Wed Feb 01, 2006 5:06 am   
 
Quote:
Doing 460 times If methods, is bit too much for the client and maintance will be beond pain.

I don't understand why you say that. There are no #IFs in his example. It's using three database record variables. One of which contains the List of words (or words of a phrase), one for the eglish meaning of the Word and one for the Color to make it. Variables are given the values through the alias: Syntax: AddClearWord <original word>|<english word>/<color>

With your given examples:
AddClearWord blaa bloo blöö|Magic missile/indianred
AddClearWord blaa blöö blöö|Disintigrate/pink
AddClearWord blaa blöö|Heal/white
AddClearWord zaprakakadukapöka!|Genocide/blue

Hope that helps you understand what it does and how to use it.
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