|
Ithilion Wanderer
Joined: 02 Sep 2005 Posts: 85
|
Posted: Thu Mar 05, 2009 5:34 pm
cmud and serial #'s in variables.. (Aardwolf) |
for some reason "(123456)" parses as ~(123456~) with default values set, also (123456) in the default field will also return the same parse.. I'm just wanting to use (123456) literally, I need serials as I use them in a lot of my scripts to refer to unique items. I realize I could use keywords, but I prefer serials, as I know they will truly be unique in the keyword list
question is, I guess, HTF do I make cmud recognize I want to use (123456) as literal, without being parsed as something else.
Basically, this is output atm for bags variable with a ga alias (forall loop containing @bags variable)
get card ~(244880~)
get card ~(244879~)
get card ~(227647~)
get card ~(279968~)
You do not see a ~(244880~) here.
You do not see a ~(244879~) here.
You do not see a ~(227647~) here.
You do not see a ~(279968~) here.
Using 2.37 if that matters any.. |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Thu Mar 05, 2009 6:08 pm |
Not sure what you mean. I just typed:
get card (12345)
and it sent that text to the MUD just as I typed it. No need for the ~ characters anymore. The command line in CMUD is smarter about parsing than zMUD was.
Now, if you are calling an alias, then the () will cause CMUD to parse the result as an expression. You can prevent this by going into the alias and turning off the "parse arguments" option for the alias.
Finally, if you put " quotes around text, it will be treated as a literal value. So show us more about what you are actually trying to do so we can help more. |
|
|
|
Ithilion Wanderer
Joined: 02 Sep 2005 Posts: 85
|
Posted: Thu Mar 05, 2009 7:08 pm |
Basically, I'm trying to kinda get the whole feel of how to handle everything.
portal aliases that include serial #'s such as amulet of aardwolf:
Code: |
#IF (@pw=1) {
get 'amulet aardwolf "(210874)" aardhotel' @portbag
hold 'amulet aardwolf "(210874)" aardhotel'
enter
wear @pslot
put 'amulet aardwolf "(210874)" aardhotel' @portbag
} {
get 'amulet aardwolf "(210874)" aardhotel' @portbag
rem @dual
hold 'amulet aardwolf "(210874)" aardhotel'
enter
dual @dual
put 'amulet aardwolf "(210874)" aardhotel' @portbag
}
|
executes just fine
but when I do ga which is an alias
Code: |
#LOCAL $bags
$bags="(244880)"|"(244879)"|"(227647)"|"(279968)"|testament|satchel|girth|demon
#forall $bags {get %1 %i}
|
resulting execute is:
ga card, for example
echo messages output show:
get card 244880
get card 244879
get card 227647
get card 279968
get card testament
get card satchel
get card girth
get card demon
in this instance, how do I fix? parse arguments unchecked? |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Thu Mar 05, 2009 8:03 pm |
The problem is in where you assign a value to $bags. What actually gets put into the variable is missing all the quotes. Because of this CMud thinks the () are indicating a sublist and stripping them. The correct assignment is
Code: |
$bags="""(244880)""|""(244879)""|""(227647)""|""(279968)""|testament|satchel|girth|demon" |
|
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
Ithilion Wanderer
Joined: 02 Sep 2005 Posts: 85
|
Posted: Thu Mar 05, 2009 8:06 pm |
Ooh, ok. gotcha. :) double to ensure they stay. ok. :) Thanks Vilj!
|
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Fri Mar 06, 2009 2:18 am |
Basically, don't try to create a string list like this "manually" yourself using direct assignment. Vijilante's code will work, but it's hard to maintain and remember over time. It's better to use
$bags = ""
#ADDITEM bags "(244880)"
#ADDITEM bags "(244879)"
#ADDITEM bags "(227647)"
...etc
or to enter the items in the list directly into the settings editor string list editor panel. In other words, instead of hardcoding a local variable like that, use a normal variable where you can store and edit these bag items in the settings editor. Then you don't need to mess with the low-level details of how string lists are stored. Also, your script will be faster since CMUD won't have to keep re-creating the hash table, converting the string value into a string list all the time. |
|
|
|
|
|