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: Sun May 02, 2004 2:14 am   

Question script?
 
I have a question.

I want to run a "answer the question" game.

I will run this by typing a question manually.

When someone answeres the correct answer. I want to manually type:

ra XXX

ok, now that this is done. i want to show on the comm.

$xxx/1point

If someone else answeres a diffrent question correctly.
I want it to have both the people
$xxx1/1point xxx2/1point.

and if someone already has a point, I want it to add +1 to his score.

does any one understand what I mean?

Example:

$Corleidum: Name a weapon named after something in heaven.
$xxx1: a star?
$xxx2: god star.

ra xxx2 (the alias that adds)
ECHO - Xxx 2, 1 point -

$Corleidum: Score: Xxx2: 1p.

$Corleidum: Name a weapon named after something in heaven.
$xxx1: a star?
$xxx2: god star.

and so on and so on... sorry for my bad english as always.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sun May 02, 2004 4:59 am   
 
#VAR qa {}
#AL ra {#IF (%iskey( @qa, %1)) {#ADDK qa %1 {%eval( %db( @qa, %1) + 1)}} {#ADDK qa %1 1};echo Score: %expanddb( @qa, "p, ", "/")p.}

Untested. Hope it works. I couldn't tell for sure what the comm command was so I took a guess and used echo. Don't forget to clear the variable before use.
Reply with quote
Corleidum
Novice


Joined: 30 Apr 2003
Posts: 43
Location: Sweden

PostPosted: Sun May 02, 2004 7:08 am   
 
Works perfectly. Thank you. Would you like to explain to me what expanddb does?

And, is there a way to make the the correct answer in special color?
example:

Corleidum says the right answer.

Xxx1/1p. xxx2/8p xxx3/3p ->Corleidum/2p<- this in a different color from the rest?
The rest should use a color $HIY$ and the winner $HIR$..
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sun May 02, 2004 7:16 am   
 
I'd rather you just look it up in the zMUD help. The explanation there is probably as good as anything I'd come up with.

In this particular case, it inserts "p, " between each key-value pair and the next key-value pair, and uses a / to separate each key from its value.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sun May 02, 2004 5:34 pm   
 
You really enjoy making things difficult, don't you?
Add this line to the alias:
echo %1 says the right answer.
Reply with quote
Guede
Wanderer


Joined: 30 Nov 2003
Posts: 65
Location: United Kingdom

PostPosted: Mon May 03, 2004 5:30 pm   
 
Hi,

Using Lightbulb's rather cool alias as a template and what you are saying (you're either on the same mud as me, or a different one running on a very similar codebase) edit the value part of the ra alias to read:

#IF (%iskey( @qa, %1)) {#ADDK qa %1 {%eval( %db( @qa, %1) +1)}} {#ADDK qa %1 1}
$ %1 says the right answer.
$ Scores are: $HIY$%replace( %expanddb( @qa, "p$HIY$, ", "/")p., %1, "*$HIR$%1")$0$

That will colour your scores line bright yellow on the MUD and the winner of the point will be marked in bright red. e.g.

ra Guede

Scores are: Lightbulb/15p Corleidum/10p *Guede/1p.

and so on and so forth. The above might not work for every mud, it depends on how colours etc. are setup, but from what Corleidum is saying it's very similar(almost identical actually) to the LPMud I play. It seems to work here anyway albeit a bit of a kludge.

HTH,

Guede
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