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


Joined: 30 Apr 2003
Posts: 43
Location: Sweden

PostPosted: Wed Mar 24, 2004 9:49 am   

%additem Help!...
 
Ok, I have a party with me, and sometimes you miss alot of says when lots of text spams.
So I am trying to make a "party say history" command.
So if "[PARTY] Someone: So where are we goin?" I want it to add it into my variable @partyhist.
then i want to type "partyhist" and it will show the last 25 history
Now so far so good.

Here is how everything looks like.
There is two triggers.

Pattern: ~[Party~] (%w)~: (*) and
Pattern: ~[Party~] (%w) (*)

The difference as you can see is the ':'.
When this is sent to the mud I am on, it emotes.
So if I send: $: falls.
It fill say: [Party] Corleidum falls.

if i only type: $falls. (wich is without the emote) it's shown:
[Party] Corleidum: falls.

That's why I need two triggers.


So the triggers set. Now what? Well I have the value like this:
Now that is the value for the first pattern.
PATTERN: ~[Party~] (%w)~: (*) and
VALUE: #VARIABLE partyhist %addItem( %ansi( blue)~[ %ansi( bold, red)partyhist %ansi( blue)~] %ansi( bold, black) %1~: %2, @partyhist)

Then I have an alias. That looks like this:
PATTERN: partyhist
VALUE:
#IF (%1=party) {#ECHO %ansi( yellow)Party's hist:%ansi( bold, red)%cr****************************************%cr%replace( @partyhist, "|", %cr)%cr%ansi( bold, red)****************************************}
#IF (%1==clear) {#YESNO "Clear the list ?" {Yes: #UNVAR partyhist} {No: #SHOW {You've chosen not clear the party hist.}}}
#IF (%1=tell) {
tell %2 $HIY$Party's hist:
tell %2 $HIR$****************************************
tell %2 %replace( @partyhist, "|", %cr tell %2)
tell %2 $HIR$****************************************
}


Now, to the problems I have.... =(
When I put this:
#ECHO %ansi( yellow)~[ %ansi( bold, red)Partyhist %ansi( yellow)~] %ansi( bold, black) %1: %2

It show Perfectly:

[ Partyhist ] Corleidum: Test

With the colors and all... BUT!
When I use the alias:

partyhist party

it show:
Partyhist Corleidum: Test

So I tried all different ways, but nothing worked: So i tried to put a "" to the trigger pattern:


And now it shows me:
VALUE: #VARIABLE partyhist %addItem( %ansi( blue)~[ %ansi( bold, red)partyhist %ansi( blue)"]" %ansi( bold, black) %1~: %2, @partyhist)
[ Partyhist "]" Corleidum: Test

So far I've made it. And now I am clueless. How to remove the last ' "" ' ???


AND! One more thing is.

Now I want that if a friend asks about the party hist I should type:

partyhist friend tell

And it should tell him the @partyhist sending:
tell friend row by row.

Now it shows:

tell friend ****************************************
tell friend [ Partyhist "]" Corleidum: Test1
tell friend[ Partyhist "]" Corleidum: Test2
tell friend[ Partyhist "]" Corleidum: Test3
tell friend[ Partyhist "]" Corleidum: Test4
tell friend[ Partyhist "]" Corleidum: Test5
tell friend[ Partyhist "]" Corleidum: Test6
tell friend ****************************************


So the problem here is:
there is a SPACE before "tell friend" when sending the >2 variables from string. PLUS. after 'tell friend' the [ Partyhist ] shows up without a space... and still the same problem with the ' "]" ' thing.
So how can I change that
I tried by adding:


tell %2 $HIR$****************************************
tell %2 %replace( @partyhist, "|", %cr "tell %2" )
tell %2 $HIR$****************************************

Notice the space after " 'tell %2' "

but then when saving the space is automatically removed.
And now it looks like this instead:
tell friend [ Partyhist "]" Corleidum: Test1
"tell friend"[ Partyhist "]" Corleidum: Test2
"tell friend"[ Partyhist "]" Corleidum: Test3
"tell friend"[ Partyhist "]" Corleidum: Test4
"tell friend"[ Partyhist "]" Corleidum: Test5
"tell friend"[ Partyhist "]" Corleidum: Test6
tell friend ****************************************



AND! my last question. (for now, until i come up with another 'bright idea' that'll pull my head off)
Are there any ways to limit the number of strings in the variable?
Otherwise this will insert and insert if I have a long online time.
So lets say about 30 strings max? Is that possible? Thanks for all help I'll get.

AND are there any possibility to trigger on color?
Let's say a friend types a color red. Then when I want to see my party history I want it to be shown as the same color as HE had it?
So if he does a red HELLO I want it top show red.. and so on.

So mainly there's a biiiig problem for me. And this thing is not really neccessary, but then again what is. Though it would be great having and a Big plus.
Reply with quote
Danlo
Magician


Joined: 28 Nov 2003
Posts: 313
Location: Australia

PostPosted: Wed Mar 24, 2004 2:22 pm   
 
Try this. The triggers delete the first string in the variable, if there is 30, and then adds the next string onto the end:

#trigger {~[Party~] (%w)~: (*)} {#if (%numitems(@partyhist)=30) {#delnitem PartyHist 1};#var PartyHist {%addItem( %ansi( bold, black) %1~: %2, @partyhist)}
#trigger {~[Party~] (%w) (*)} {#if (%numitems(@partyhist)=30) {#delnitem PartyHist 1};#var PartyHist {%addItem( %ansi( bold, black) %1~: %2, @partyhist)}

#alias PartyHist {#IF (%lower(%1)="party") {#ECHO %ansi( yellow)Party's hist:
#ECHO %ansi( bold, red)%cr****************************************
#forall @PartyHist {#ECHO %ansi( blue)~[ %ansi( bold, red)partyhist %ansi( blue)~] %i}
#ECHO %ansi( bold, red)****************************************}
#IF (%lower(%1)="clear") {#YESNO "Clear the list ?" {Yes: #UNVAR partyhist} {No: #SHOW {You've chosen not clear the party hist.}}}
#IF (%lower(%2)="tell") {tell %1 $HIY$Party's hist:
tell %1 $HIR$****************************************
#forall @partyhist {tell %1 ~[ PartyHist ~] %stripansi(%i)}
tell %1 $HIR$****************************************}}
Reply with quote
Corleidum
Novice


Joined: 30 Apr 2003
Posts: 43
Location: Sweden

PostPosted: Thu Mar 25, 2004 12:51 pm   
 
quote:
Originally posted by Danlo

Try this. The triggers delete the first string in the variable, if there is 30, and then adds the next string onto the end:

#trigger {~[Party~] (%w)~: (*)} {#if (%numitems(@partyhist)=30) {#delnitem PartyHist 1};#var PartyHist {%addItem( %ansi( bold, black) %1~: %2, @partyhist)}
#trigger {~[Party~] (%w) (*)} {#if (%numitems(@partyhist)=30) {#delnitem PartyHist 1};#var PartyHist {%addItem( %ansi( bold, black) %1~: %2, @partyhist)}

#alias PartyHist {#IF (%lower(%1)="party") {#ECHO %ansi( yellow)Party's hist:
#ECHO %ansi( bold, red)%cr****************************************
#forall @PartyHist {#ECHO %ansi( blue)~[ %ansi( bold, red)partyhist %ansi( blue)~] %i}
#ECHO %ansi( bold, red)****************************************}
#IF (%lower(%1)="clear") {#YESNO "Clear the list ?" {Yes: #UNVAR partyhist} {No: #SHOW {You've chosen not clear the party hist.}}}
#IF (%lower(%2)="tell") {tell %1 $HIY$Party's hist:
tell %1 $HIR$****************************************
#forall @partyhist {tell %1 ~[ PartyHist ~] %stripansi(%i)}
tell %1 $HIR$****************************************}}



Thanks, but that did not work =(
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Thu Mar 25, 2004 7:49 pm   
 
Good grief! You've already got red *'s blocking off the entire echo, with a yellow header so you'll know it's your party history. What more do you need?
Party hist:
****************************************
Anything that appears between these lines of red
stars is the party history. It's easy to tell even without
[ party history ] at the beginning of each line.
****************************************

However, if you still want the [ party history ], it's probably better to try another approach. Put it in the alias instead of the variable.

PATTERN: ~[Party~] (%w)~: (*)
VALUE:
#VARIABLE partyhist %additem( %1~: %2, @partyhist)
#IF (%numitems( @partyhist) > 30) {#DELN partyhist 1}

PATTERN: ~[Party~] (%w) (*)
VALUE:
#VARIABLE partyhist %additem( %1 %2, @partyhist)
#IF (%numitems( @partyhist) > 30) {#DELN partyhist 1}

NAME: partyhist
VALUE:
#IF (%1 = party) {
#ECHO %ansi( yellow)Party's hist:
#ECHO %ansi( bold, red)****************************************
#FORALL @partyhist {#ECHO %ansi( blue)~[ %ansi( bold, red)partyhist %ansi( blue)~] %ansi( bold, black)%i}
#ECHO %ansi( bold, red)****************************************
}
#IF (%1 = clear) {
#YESNO "Clear the list?" {Yes: #UNVAR partyhist} {No: #SHOW {You've chosen not clear the party hist.}}
}
#IF (%1 = tell) {
tell %2 $HIY$Party's hist:
tell %2 $HIR$****************************************
#FORALL @partyhist {tell %2 $B$~[ $HIR$partyhist $B$] $HIX$%i}
tell %2 $HIR$****************************************
}

NOTE: I had to guess at the MUD codes for blue and bold black.
Reply with quote
Corleidum
Novice


Joined: 30 Apr 2003
Posts: 43
Location: Sweden

PostPosted: Sat Mar 27, 2004 6:40 pm   
 
quote:
Originally posted by LightBulb

Good grief! You've already got red *'s blocking off the entire echo, with a yellow header so you'll know it's your party history. What more do you need?
Party hist:
****************************************
Anything that appears between these lines of red
stars is the party history. It's easy to tell even without
[ party history ] at the beginning of each line.
****************************************

However, if you still want the [ party history ], it's probably better to try another approach. Put it in the alias instead of the variable.

PATTERN: ~[Party~] (%w)~: (*)
VALUE:
#VARIABLE partyhist %additem( %1~: %2, @partyhist)
#IF (%numitems( @partyhist) > 30) {#DELN partyhist 1}

PATTERN: ~[Party~] (%w) (*)
VALUE:
#VARIABLE partyhist %additem( %1 %2, @partyhist)
#IF (%numitems( @partyhist) > 30) {#DELN partyhist 1}

NAME: partyhist
VALUE:
#IF (%1 = party) {
#ECHO %ansi( yellow)Party's hist:
#ECHO %ansi( bold, red)****************************************
#FORALL @partyhist {#ECHO %ansi( blue)~[ %ansi( bold, red)partyhist %ansi( blue)~] %ansi( bold, black)%i}
#ECHO %ansi( bold, red)****************************************
}
#IF (%1 = clear) {
#YESNO "Clear the list?" {Yes: #UNVAR partyhist} {No: #SHOW {You've chosen not clear the party hist.}}
}
#IF (%1 = tell) {
tell %2 $HIY$Party's hist:
tell %2 $HIR$****************************************
#FORALL @partyhist {tell %2 $B$~[ $HIR$partyhist $B$] $HIX$%i}
tell %2 $HIR$****************************************
}

NOTE: I had to guess at the MUD codes for blue and bold black.




Awesome! THANSK! BUT! =( Sigh, I hate buts!

2 things that screws everything is:

when someone types a comma ' , '....
Lets pretend:
corleidum: hi, whatusp?
then it will clear the partyhist

AND! When someone types a long sentence. the words on the newline wont appear..!! =(

help =(
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Sat Mar 27, 2004 10:05 pm   
 
UNTESTED Added a few "'s

PATTERN: ~[Party~] (%w)~: (*)
VALUE:
#VARIABLE partyhist %additem( "%1~: %2", @partyhist)
#IF (%numitems( @partyhist) > 30) {#DELN partyhist 1}

PATTERN: ~[Party~] (%w) (*)
VALUE:
#VARIABLE partyhist %additem( "%1 %2", @partyhist)
#IF (%numitems( @partyhist) > 30) {#DELN partyhist 1}
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Sat Mar 27, 2004 10:09 pm   
 
quote:
AND! When someone types a long sentence. the words on the newline wont appear..!! =(


In order of Easyness

OPTION 1 Have them use shorter sentences
OPTION 2 See if your mud lets you define wordwrapping/screenwidth and set it to MAX (usually 0 or some really high number) and let zmud handle wrapping
OPTION 3 A lot more work to change your current code
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sun Mar 28, 2004 5:31 am   
 
You haven't provided enough information to even attempt a script for multiline party says. However, it would follow the same general principles as any other script to capture multiline communications. There are plenty of examples already on this forum, try a search on multiline tell.
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