|
charneus Wizard
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Sun Jun 29, 2008 10:39 am
[BUG 2.29] #YESNO arguments |
I was messing around with #YESNO earlier tonight, and tried the following:
#YESNO "Are you sure you want to reset the quest tracker?" {questdatabase="";questdatabase.reset=%time("mm/dd/yy hh:nn am/pm")}
and what showed up was
Are you sure you want to reset the quest tracker?
[questdatabase=""06/29/08 05:23 am] [No]
Unless I'm sorely wrong, it shouldn't do that. Also, when I tried to change questdatabase="" to #VAR questdatabase "", it didn't recognize it as a command.
Charneus |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Mon Jun 30, 2008 3:14 pm |
You have the wrong syntax in your original code. It should probably be:
Code: |
#YESNO "Are you sure you want to reset the quest tracker?" {@questdatabase="";@questdatabase.reset=%time("mm/dd/yy hh:nn am/pm")}
|
or even better, use #addkey for the second command. However, #yesno does seem to be behaving oddly, sometime replacing the "yes" button text with the first argument. When it does this, the code may not be executed properly. If I can, I'll look further at this, but I'm pretty busy today. |
|
|
|
charneus Wizard
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Mon Jun 30, 2008 6:54 pm |
You are incorrect. It's a=b, not @a=b. My syntax thusly is correct. Not to mention I use the same exact syntax in many of my scripts.
The main point was also that #VAR was not recognized as a command. In fact, NO command is recognized as such.
Charneus |
|
|
|
mr_kent Enchanter
Joined: 10 Oct 2000 Posts: 698
|
Posted: Mon Jun 30, 2008 7:49 pm |
Looks like a bug to me.
I haven't installed 2.29 yet so I can't play with this atm.
Aside from commands not working, the example you showed looks like the semicolon is stripped or lost. So I wonder
1. Does it work with only one command?
Code: |
#VAR testvar ""
#YESNO "Testing yesno command" {testvar="somevalue"} |
2. Does this work?
Code: |
#YESNO "Are you sure you want to reset the quest tracker?" {RESET:{#VAR questdatabase "";#VAR questdatabase.reset %time("mm/dd/yy hh:nn am/pm")}} {NO:#PRINT "Questdatabase was not reset"} |
3. Does it work if you explicitly add the NO branch braces at the end? '{}'
4. Aliases still work okay?
Code: |
#ALIAS resetquestdatabase {#VAR questdatabase "";#VAR questdatabase.reset %time("mm/dd/yy hh:nn am/pm")}
#YESNO "Are you sure you want to reset the quest tracker?" {resetquestdatabase} |
|
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Mon Jun 30, 2008 7:51 pm |
Bleh, brain fry. You're right. I've been on vacation too long.
I did notice and agree that #yesno is acting funny. I've just tried a few quick tests. So far, I have only had this bug show up when I use the %time() function in the second parameter. It works fine with several other functions and commands as long as there is no %time() function. |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Tue Jul 01, 2008 5:41 pm |
Confirmed and added to bug list. The problem is that the #YESNO command supports the syntax "Caption:Command" to add a caption to the buttons, and that's an old kludge in the parser that CMUD isn't handling properly. So when CMUD tries to detect the caption, it makes your entire script into the caption instead. I'm not going to be able to fix this for 2.30 I don't think, but I'll try to figure out a way to fix it for the future.
As a workaround, assign your script to an alias, and then call the alias from the #YESNO command. |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Tue Jul 01, 2008 7:34 pm |
The first fix that pops to mind is to add 2 new parameters to #yesno for the captions. The problem of course is that will break zmud compatibility.
|
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Tue Jul 01, 2008 8:27 pm |
OK, this was actually pretty simple. When using the %time function, it was returning the time in the format mm/dd/yy hh:nn. The : colon in the time was confusing the #YESNO command. The #YESNO command takes everything before the colon as the caption for the button. So it's actually doing what it is supposed to. To fix this will require making the #YESNO command a lot smarter about how it determines the caption.
|
|
|
|
|
|