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
jabpotter
Newbie


Joined: 13 Feb 2022
Posts: 4

PostPosted: Sun Feb 13, 2022 7:05 pm   

Problems with aarget
 
THe autoquester gives quests where you have to take each letter of the word and find an item within a certain level of you and return them to you. For example "great" you would need to find items that begin with "g", "r", "e", "a", "t" and return them to the autoquestor. I am storing items in the donation room. So the idea is to go there, cycle through the word getting the items and return. I am having trouble with %arrget not returning a value.


Code:

#loop %len(@Spelling),1 {
#VAR mm %lower(%copy(@Spelling,%{i},1))
#VAR SpellNum -96
#ADD SpellNum %ascii(@mm)
#VAR SpellItem %arrget(Spellings, @SpellNum)
get @SpellItem
}
#T- Spelling
.u2se
qc
Reply with quote
jabpotter
Newbie


Joined: 13 Feb 2022
Posts: 4

PostPosted: Sun Feb 13, 2022 8:09 pm   
 
Here is the Spellings variable array. It goes all the way to 26 "z"


Reply with quote
hpoonis2010
Adept


Joined: 18 Jun 2019
Posts: 279

PostPosted: Mon Feb 14, 2022 5:45 am   
 
I don't think that spellings data is correct, or your idea of what will be in there is correct.

Your word search will search every word of every item for matches?

EG.,
real star dragon SWORD true night
excalibur SWORD might

You could just add them to a string list variable then do a %POS test
Reply with quote
jabpotter
Newbie


Joined: 13 Feb 2022
Posts: 4

PostPosted: Mon Feb 14, 2022 11:38 am   
 
Code:
#loop %len(@Spelling),1 {                              // sets the loop through the word
#VAR mm %lower(%copy(@Spelling,%{i},1))           // stores current letter 
#VAR SpellNum -96                                                 // Accounts for ASCII
#ADD SpellNum %ascii(@mm)                                 // For example stores 1 for a
#VAR SpellItem %arrget(Spellings, @SpellNum)        // for Spellings, 1 it should store ~'Leg Plates of Avalon~' for a
get @SpellItem                                                       // should result in get ~'Leg Plates of Avalon~'
}
#T- Spelling
.u2se
qc
Reply with quote
jabpotter
Newbie


Joined: 13 Feb 2022
Posts: 4

PostPosted: Wed Feb 16, 2022 11:34 am   
 
I figured it out. I started it as an array. CMud changed it from an array to a String List. So %arrget wasn't able to get the information. It worked perfectly with %item.

Code:

#loop %len(@Spelling),1 {                                       // sets the loop through the word
#VAR mm %lower(%copy(@Spelling,%{i},1))           // stores current letter
#VAR SpellNum -96                                                 // Accounts for ASCII
#ADD SpellNum %ascii(@mm)                                 // For example stores 1 for "a"
get %item(Spellings, @SpellNum)                            // gets ~'Leg Plates of Avalon~' for letter "a"
}
#T- Spelling
.u2se
qc
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