Saies
Doctor Agon
26 Apr 2024, 20:13Hi
I know this has been asked before, refer you to the following link
https://textadventures.co.uk/forum/quest/topic/lqrzx5-mak2yaqmlvi01ra/i-little-thing-but-it-stands-out-a-mile
but its really the dictionary aspect that I'm writing about
<conjugations type="stringdictionary">
<item><key>pass out</key><value>passes out</value></item>
<item><key>@ with</key><value> with</value></item>
<item><key>@ by</key><value> by</value></item>
<item><key>@ on</key><value> on</value></item>
<item><key>@ at</key><value> at</value></item>
<item><key>*ay</key><value>ays</value></item>
<item><key>*oy</key><value>oys</value></item>
<item><key>*ey</key><value>eys</value></item>
<item><key>*y</key><value>ies</value></item>
<item><key>*ss</key><value>sses</value></item>
<item><key>*s</key><value>sses</value></item>
<item><key>*sh</key><value>shes</value></item>
<item><key>*ch</key><value>ches</value></item>
<item><key>*o</key><value>oes</value></item>
<item><key>*x</key><value>xes</value></item>
<item><key>*z</key><value>zes</value></item>
<item><key>*</key><value>s</value></item>
</conjugations>
And mrangel if they're about
Is it a function called DictionaryItem
, if so, how is that coded?
Apologies again for bringing this issue up again
Doctor Agon
28 Apr 2024, 19:05Ok,
So I've now put the code into the game after the
Is there a way to put the code into a library.
I've tried, but it comes up with an error '
Or do I have to manually cut and paste that code into every game i make.
Any help is greatly appreciated.
Doctor Agon
05 May 2024, 17:15ok,
I finally figured this out.
If you want to put it in a library, you have to put it into an object first. I'm using the object 'zz9'.
So...
<library>
<function name="Conjugate" parameters="obj, verb" type="string">
gender = obj.gender
if (gender = "he" or gender = "she") {
gender = "it"
}
switch (verb) {
case ("be") {
switch (gender) {
case ("i") {
return ("am")
}
case ("you") {
return ("are")
}
case ("it") {
return ("is")
}
case ("we") {
return ("are")
}
case ("they") {
return ("are")
}
default {
return ("is")
}
}
}
case ("do") {
switch (gender) {
case ("i") {
return ("do")
}
case ("you") {
return ("do")
}
case ("it") {
return ("does")
}
case ("we") {
return ("do")
}
case ("they") {
return ("do")
}
default {
return ("do")
}
}
}
default {
if (gender = "it") {
foreach (ending, zz9.conjugations) {
if (ending = verb) {
return (DictionaryItem (zz9.conjugations, verb))
}
else if (Left (ending, 1) = "@" and EndsWith (verb, Mid (ending, 2))) {
return (Conjugate (obj, Left (verb, LengthOf(verb) - LengthOf(ending) + 1)) + DictionaryItem (zz9.conjugations, ending))
}
else if (Left (ending, 1) = "*" and EndsWith (verb, Mid (ending, 2))) {
return (Left (verb, LengthOf(verb) - LengthOf(ending) + 1) + DictionaryItem (zz9.conjugations, ending))
}
}
return (verb + "s")
}
}
}
</function>
<object name="zz9">
<conjugations type="stringdictionary">
<item><key>pass out</key><value>passes out</value></item>
<item><key>@ with</key><value> with</value></item>
<item><key>@ by</key><value> by</value></item>
<item><key>@ on</key><value> on</value></item>
<item><key>@ at</key><value> at</value></item>
<item><key>*ay</key><value>ays</value></item>
<item><key>*oy</key><value>oys</value></item>
<item><key>*ey</key><value>eys</value></item>
<item><key>*y</key><value>ies</value></item>
<item><key>*ss</key><value>sses</value></item>
<item><key>*s</key><value>sses</value></item>
<item><key>*sh</key><value>shes</value></item>
<item><key>*ch</key><value>ches</value></item>
<item><key>*o</key><value>oes</value></item>
<item><key>*x</key><value>xes</value></item>
<item><key>*z</key><value>zes</value></item>
<item><key>*</key><value>s</value></item>
</conjugations>
</object>
</library>
Hope this helps someone in the future.
mrangel
05 May 2024, 18:03Ideally, you'd put it in the defaultgame
type so it's in the game object… but I don't think Quest supports type overloading, so you'd have to copy the whole type over from CoreTypes.aslx
.