|
andrul Beginner
Joined: 09 May 2001 Posts: 25 Location: USA
|
Posted: Thu Aug 28, 2003 6:26 am
list variables and arrays |
Zmud version: 6.62
Goal: Automatically start learning new language when current language becomes fluent.
Method:
#VAR tongue %array(farsi, wulinaxin, nibelungen, malkierien, ersi, kendrall, sssylyn, artrexcian, dreltherial, terrakarn)
#VAR learning 0
#TRIG {You are done studying} {languages}
#TRIG {You are fluent in @tongue.@learning} {#ADD @learning 1; study @tongue.@learning for 3 minutes}
Problems:
1) If not fluent I want to continue studying the current language curriculum, not just stop.
2) During testing, #SHOW @tongue.learning displays 'farsi' no matter what @learning is currently set to. #SHOW @tongue.@learning displays 'Array.2' where the current value of @learning has been set to 2. It seems to me that creating the triggers is useless until I can get the correct values returned from the array.
3) I have tried using variable lists, but
#VAR testlist {abc|def|ghi
#show @testlist.@learning
displays 'abc|def|ghi.2'
and #show @testlist.learning displays nothing
4) I've not even bothered yet with stopping once the end of the list is reached. I'm currently presuming the mud would receive 'study for 3 minutes' and give me an error response.
Any help greatly appreciated
Andrul[?] |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Thu Aug 28, 2003 8:12 am |
1. How will you know if you are not fluent? What pattern will be used to reach this conclusion? It's almost always preferable to trigger on a positive event (something the MUD did send) than a negative one (something it didn't). Thus, it would be preferable to trigger on "You are able to mumble a few phrases in Farsi" than to try to trigger on not receiving "You are fluent in Farsi".
2. #SHOW %arrget( tongue, @learning)
3. #VAR testlist {abc|def|ghi}
#SHOW %item( @testlist, @learning)
4. %arrhigh() will give you the highest index number for arrays
a. %numitems() will give you the number of items in a list
It should be easy, in either case, to test whether you've reached the end.
I'd use a list. There are far more commands and functions for working with them, making them much more flexible. |
|
|
|
andrul Beginner
Joined: 09 May 2001 Posts: 25 Location: USA
|
Posted: Fri Aug 29, 2003 5:07 am |
The languages command displays all known languages and how well you know each. ie: You are fluent in Farsi, you are moderately skilled in malkierien, etc...
|
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Fri Aug 29, 2003 6:26 am |
I really meant that question to help you figure out for yourself what pattern to use.
#VAR tongue {farsi|wulinaxin|nibelungen|malkierien|ersi}
#VAR learning 1
#TR LanguageLessons {You are (*) in (%w)} {#IF (%lower( %2) = %item( @tongue, @learning)) {#IF ("%1" = "fluent") {#ADD learning 1} {study %item( @tongue, @learning) for 3 minutes}};#IF (@learning > %numitems( @tongue)) {#T- LanguageLessons;#SAY Fluent in everything}}
NOTE: Use #ADDITEM to add additional languages (or add them to the #VAR command). I kept it short so it would all fit a single screen-width. |
|
|
|
andrul Beginner
Joined: 09 May 2001 Posts: 25 Location: USA
|
Posted: Sat Aug 30, 2003 3:43 am |
Thank you very much Lightbulb. I apologise for the incoherent original request. I read it again and wonder how you could have gotten so close to the mark based on my bleary eyed ramblings. I'm including the resolution here so if anyone else wants to do something similar they can.
Here is an example of the output of the command 'languages':
You are fluent in Shilkin.
You are just beginning to learn Artrexcian.
You are very skilled at Sssylyn.
You are fluent in Nibelungen.
I put the triggers and variables into their own class 'Language' to prevent spending xp to learn nothing.
The alarm is to compensate for any lag after sending the languages command.
#VAR tongue {atrexcian|wulinaxin|nibelungen|malkierien|ersi}
#VAR learning 1
#TR {You are done studying} {languages; #ALARM +5 {study %item( @tongue, @learning) for 6 minutes}
#TR {You are fluent in %item( @tongue, @learning)} {#ADD learning 1;#IF (learning > 5) {#T- Language}
Thanks again! |
|
|
|
|
|
|
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
|
|