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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
boblinski
Novice


Joined: 05 Dec 2005
Posts: 49
Location: New Zealand

PostPosted: Wed Jan 31, 2018 7:31 am   

Database question
 
Wanting to create a database for the following list of questions:

Quote:
Why do Citizens kill?
Why do Imperials kill?
Why do you slay our foes?
Why do you kill those who oppose us?
Why kill the non-Oathed?
(ANSWER) To defend and to teach

How do our foes learn when Citizens slay them?
How do Imperials teach when they kill?
How do you teach when you slay our foes?
How do our foes learn through death?
(ANSWER) The offering of the Bloodoath

Who gives power to the Imperial Guardians?
Who alone can appoint the Emperor?
Who does the Council answer to?
Who speaks through the Divine Sect?
Who raises the Council?
(ANSWER) The Immortal Lords of Empire

What do the Imperial Guardians defend for us?
What is guarded by the Imperial Guardians?
What did Baelind Telthin translate for all?
What states the goals of the Empire?
What defines our drive for civilization?
(ANSWER) The Imperial Codex

What power did Baelind Telthin write of?
What power does the Empire represent?
What do the Barbarians and Outlanders fear?
What power does our Might represent?
What makes wealth, art, peace, and health possible?
(ANSWER) The Power of Civilization

How do we recruit more to our cause?
What allows the Empire to grow?
What separates the Empire from all other Civilization?
What is the key to the success of Civilization?
What focuses us upon our role in Civilization?
(ANSWER) The Blood Oath

Recite your Oath, Citizen
What are the words to the Oath?
What are the words to the Blood Oath, Citizen?
What words bound your soul to the Empire?
(ANSWER) My heart, my soul, my life for the Empire

What is required for True Civilization?
What is the power of the Oath based upon?
What does the Oath bring to a Citizen?
What is the way of the Empire?
What must an Imperial hold in their heart?
(ANSWER) Darkness and Order



And when I am asked one of the above questions:
Quote:
The Shadow Sect Guardian tells you '*'

I'd like to just be able to have the answer automatically come up with an alias #al answer {@answer}

I've tried adding one lot of questions to their own string variable and then checking something like:
Code:
#tr {The Shadow Sect Guardian tells you '(*)'} {#if (@question = {%1}) {#var answer {say To defend and to teach}}


This does not get me good results :(
TIA
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4692
Location: Pensacola, FL, USA

PostPosted: Wed Jan 31, 2018 8:14 am   
 
#ADDKEY answerTable {question} {answer}
#IF (%ismember(@question, %dbkeys(@answerTable))) {answer %db(@answerTable, @question)}

In your example you never define the @question variable, I will assume it is set elsewhere because otherwise, you are comparing %1 to a %null string, which will always turn up false.
If this is the only place it would be used, just use %1 instead of @question in the above examples, there is no need to save it beyond this setting.
_________________
Discord: Shalimarwildcat
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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