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
Retrovirus
Wanderer


Joined: 13 Jul 2002
Posts: 51
Location: Malaysia

PostPosted: Sat Aug 24, 2002 7:44 pm   

Zmud Coding
 
Ok i am trying to get this code to work and keep failing! Here's the coding line.

%1 utters the words, 'nocelacri'
#var blinder_var = %1
%1 utters the words, 'blindness'
#var blinder_var = %1

%1 seems to be blinded!

Here's the problem.
I want to give the person who blinded the mob 1 point. So lets say..

Zenkai utters the words, 'blindness'
The Big Nasty Mob seems to be blinded!
#ADD 1 zenkai_var

#alias gtblind

Grouptell Blind Count: Zenkai(1), Guy 2, Guy 3...

etc etc.

Get my point?!
Problem is i don't know how to make the zenkai count make an automatic variable.

Cause i can't go creating a var for each player in mud.
Basically i want it to do something like this

Zenkai utters the words, 'nocelacri'
Zenkai is changed to the last person to cast blind.
Big nasty mob is blinded.
Zenkai gets 1 point.-> saves the var.
Dork utters the words, 'nocelacri'
Dork is changed to the last person to cast blind.
Big mob seems to be blinded!
Dork gets 1 point, -> saves the var.

gtblind

Grouptell Blind Count: Zenkai(1), Dork(1).

Can this be done fron highest to lowest. :)
Please help :P

Cameth
Saweth
Fledeth my asseth offeth
Reply with quote
finraziel
Newbie


Joined: 25 Oct 2001
Posts: 4
Location: Netherlands

PostPosted: Sat Aug 24, 2002 9:45 pm   
 
Try this:

#if @{@blinder_var} {#ad @blinder_var 1} {#var @blinder_var 1}

The expression checks wether the value of the var with name being the value of blindervar exists, if so it adds one to the var with name being the value of blindervar, otherwise it creates a var with name being the value of blinder var and assigns the value 1 to it.
Hope it works for you.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sat Aug 24, 2002 10:08 pm   
 
First, don't use %1, %2, etc. in the trigger PATTERN. zMUD uses different wildcards such as %w (alphabetic), %d (numeric), %a (alphanumeric). There's a full list in the helpfile under the topic "Pattern Matching".

zMUD does use %1, %2, etc. in the trigger COMMAND section. These refer to those sections of the pattern that are enclosed in parentheses:
"To save any part of the pattern to the %1..%99 parameters, enclose the part of the parameter in parenthesis"

Also, you can use either "#VAR varname value" OR "varname = value" to assign a value to a variable, but you shouldn't try to use both at the same time (#VAR blinder_var = %1). This will lead to @blinder_var having the value "=" with a default value of whatever %1 is.

A record (database) variable would probably be the simplest way of accomplishing what you want.
#TR {(%w) utters the words, 'nocelacri'} {#VAR blinder %1}
#TR {(%w) utters the words, 'blindness'} {#VAR blinder %1}
#TR {%w seems to be blinded!} {#IF (%iskey(@blindcount,@blinder) {#ADDKEY blindcount @blinder %eval(%db(@blindcount,@blinder) + 1)} {#ADDKEY blindcount @blinder 1}

#AL gtblind {GroupTell Blind Count~: {#LOOPDB blindcount {%key~(%val~), }}}

I'm not sure if you can use #LOOPDB in the middle of a line like this, you might have to save to a variable first and then do your tell. I don't feel like working out a sorting routine right now, perhaps you could do that yourself.

LightBulb
Senior Member
Reply with quote
Retrovirus
Wanderer


Joined: 13 Jul 2002
Posts: 51
Location: Malaysia

PostPosted: Sun Aug 25, 2002 1:01 pm   
 
Lightbulb im a tad confused, can you email me, so that way we can communicate i don't quite understand what you mean.. im quite computer illiterate :P and all this %w confuses me :P
ffixfaqs@hotmail.com :P

Cameth
Saweth
Fledeth my asseth offeth
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sun Aug 25, 2002 3:12 pm   
 
If you have a question, ask it here.

%w isn't any harder to understand than %1. Neither requires much in the way of computer literacy. As it says in the helpfile I pointed out (Pattern Matching)
"%w      match any number of alpha characters (a-z) (a word)"

I already demonstrated the use of %w in the triggers I wrote for you. You can find multitudes of other examples throughout this forum.

LightBulb
Senior Member
Reply with quote
Retrovirus
Wanderer


Joined: 13 Jul 2002
Posts: 51
Location: Malaysia

PostPosted: Fri Aug 30, 2002 11:42 am   
 
TRIGGER {^Ok.} {blinder=%char}
#TRIGGER {(%w) utters the words, 'noselacri'} {blinder=%1}
#TRIGGER {(%w) utters the words, 'blindness'} {blinder=%1}

#TRIGGER {%1 seems to be blinded!} {gt Blind brought to you by @blinder!;blinds
add @blinder}
#ALIAS blinds {#if %1="clear" {blinders="";#echo Blind database cleared.}
{};#if %1="add" { blinders=%additem( @blinders, %2)} {};#if %1="stat"
{blindline={"Blinds: "};#loopdb %countlist( @blinders) {blindline=%concat(
@blindline, %key, "(", %val, ")", " ")};gt @blindline;#unvar blindline}}


still can't get it to work, what the heck is wronG?

Cameth
Saweth
Fledeth my asseth offeth
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Fri Aug 30, 2002 12:53 pm   
 
First, don't use %1, %2, etc. in the trigger PATTERN. zMUD uses different wildcards such as %w (alphabetic), %d (numeric), %a (alphanumeric). There's a full list in the helpfile under the topic "Pattern Matching".

#TRIGGER {%w seems to be blinded!} {gt Blind brought to you by @blinder!;blinders = %additem(@blinders, @blinder)}

#AL blindstat {blindline = %null;#LOOPDB %countlist(@blinders) {blindline=%concat(
@blindline, %key, "(", %val, ")", " ")};gt Blinds: @blindline}

Because I haven't deleted the variable, @blindline, you'll be able to see what got saved to it.

Other than that, what's not working? And what is it doing?

LightBulb
Senior Member
Reply with quote
Retrovirus
Wanderer


Joined: 13 Jul 2002
Posts: 51
Location: Malaysia

PostPosted: Fri Aug 30, 2002 12:58 pm   
 
blind stats [typed in mud]
<681hp 570ma 283mv>
{ #if (stat==clear) { blinders=; #echo Blind database cleared.}
{ #if (stat==add) { blinders=}
{#if (stat==stat) {blindline={Blinds: }; #loopdb 1 {blindline=%{key}(%{val}) ; };{grouptell ; #unvar blindline; }; };
Arglebargle, glop-glyf!?!



Cameth
Saweth
Fledeth my asseth offeth
Reply with quote
Retrovirus
Wanderer


Joined: 13 Jul 2002
Posts: 51
Location: Malaysia

PostPosted: Fri Aug 30, 2002 1:08 pm   
 
After adding what you said.. i have done that and now this is how the error shows up as.
blindstat

I blinded the mob twice.
blindstat brought this line instead of the gt i wanted.
{blindline = ;#LOOPDB Hotara2 {blindline=%{key}(%{val}) };gt Blinds: }
Arglebargle, glop-glyf!?!


Cameth
Saweth
Fledeth my asseth offeth
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Fri Aug 30, 2002 1:23 pm   
 
It would appear you can't use #LOOPDB on %countlist.

LightBulb
Senior Member
Reply with quote
Retrovirus
Wanderer


Joined: 13 Jul 2002
Posts: 51
Location: Malaysia

PostPosted: Fri Aug 30, 2002 1:33 pm   
 
How do you fix that?

Cameth
Saweth
Fledeth my asseth offeth
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Fri Aug 30, 2002 1:46 pm   
 
First save whatever %countlist returns to a variable and then use it in #LOOPDB:
#ALIAS blindstat {blindline = %null;#VAR count {%countlist(@blinders)};#LOOPDB @count {blindline=%concat(
@blindline, %key, "(", %val, ")", " ")};gt Blinds: @blindline}

Kjata
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Fri Aug 30, 2002 2:25 pm   
 
If you use #VAR, you can simplify by omitting the %concat function:
#ALIAS blindstat {#VAR blindline %null;#VAR count {%countlist(@blinders)};#LOOPDB @count {#VAR blindline {@blindline %key (%val)}};gt Blinds:@blindline}


LightBulb
Senior Member
Reply with quote
Retrovirus
Wanderer


Joined: 13 Jul 2002
Posts: 51
Location: Malaysia

PostPosted: Fri Aug 30, 2002 7:37 pm   
 
You grouptell: ' Blinds: =Souliris(3) Linsey(2) Malek(5) Tanat(1) Link(1) Krot(1) Rino(1) Hotara(3)

Sweet it works.. now is there a way to sort it from highest to lowest?

Cameth
Saweth
Fledeth my asseth offeth
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sat Aug 31, 2002 3:35 am   
 
Where'd you pick up the equals sign from?
You grouptell: ' Blinds: =Souliris(3) Linsey(2) Malek(5) Tanat(1) Link(1) Krot(1) Rino(1) Hotara(3)

There's no easy way to sort it.

LightBulb
Senior Member
Reply with quote
Retrovirus
Wanderer


Joined: 13 Jul 2002
Posts: 51
Location: Malaysia

PostPosted: Sat Aug 31, 2002 7:19 am   
 
I fixed the = to thing.
Anyways so it can be sorted but it's a bit complicated i take it?
Now how do i clear the blindline value count?

Cameth
Saweth
Fledeth my asseth offeth
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Sat Aug 31, 2002 7:53 am   
 
If blind times are under 10 then you could change things around a bit to get so we have leading numbers.

#LOOPDB:
#ALIAS blindstat {blindline = %null;#VAR count {%countlist(@blinders)};#LOOPDB @count {#ADDITEM blindline %concat(%val,"_",%key)};gt Blinds: %replace(%sort(@blindline),"|"," ")}


For a result similar to:
You grouptell: ' Blinds: 1_Tanat 1_Link 1_Krot 1_Rino 2_Linsey 3_Hotara 3_Souliris 5_Malek

Your count list is a function of how you are controlling @blinders, see red
Change the blue thing to make the numbered list.
Change the green thing to say the sorted list.

Ton Diening
Reply with quote
Retrovirus
Wanderer


Joined: 13 Jul 2002
Posts: 51
Location: Malaysia

PostPosted: Sat Aug 31, 2002 2:44 pm   
 
This sucks...
Now last night it was working today it has begin all gogly again..
#al blindstat
the math is correct.
You grouptell: ' Blinds: =Airhead(2) Gale(3) Link(12) }}}}}}}}}}}}}}}}}(1) '
Ends up with tons of } and the (1) at the end + the = before the first blinder..

How do i fix this?

Currently it's like this
#al blindstat
#var blindline = %null
#LOOPDB %countlist(@blinders) {blindline=%concat(@blindline, %key, "(", %val, ")", " ")}
gt Blinds: c11@blindline

Cameth
Saweth
Fledeth my asseth offeth
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sat Aug 31, 2002 4:29 pm   
 
You are using a function %concat, on a variable which contains parentheses. Try it the way I suggested, using the #VAR command without %concat.
#ALIAS blindstat {#VAR blindline %null;#VAR count {%countlist(@blinders)};#LOOPDB @count {#VAR blindline {@blindline %key (%val)}};gt Blinds:@blindline}
You can try adding color commands (c11) if it works.

When something is working, and then you change it and it stops working, look at whatever you changed. In this case, you went back to using the %countlist function in your #LOOPDB statement, instead of assigning it to a variable and using the variable in the #LOOPDB statement.

LightBulb
Senior Member
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