|
Aerious Wanderer
Joined: 21 Jan 2008 Posts: 62
|
Posted: Thu Jul 03, 2008 1:47 am
[2.29]Possible Variable bug with '/' character |
I have a variable called sorcmsg that contains
Code: |
7/2/2008 9:40:52 PM--cMud-- |
I try to write this variable to a file (and since it stopped working (have not used since zmud) it only writes '0's, to the file.) (tried to test it out and it also shows as '0' on #echo too.
this is what I use to generate the variable
Code: |
**PATTERN**
^You feel you have reached a higher understanding of (*)
**END**
#color blue
sorcmsg = %time(c) ~-~- %1 ~-~-
#if (%1 = "alternate magics.") {sorcmsg=@sorcmsg using @sorcspellused}
#if (%1 = "chaos from invariance.") {sorcmsg=@sorcmsg using @sorcspellused}
#if (%1 = "magical lore.") {sorcmsg=@sorcmsg using @sorcspellused}
#if (%1 = "chaos theory.") {sorcmsg=@sorcmsg using @sorcspellused}
#if (%1 = "adaption of chaos.") {sorcmsg=@sorcmsg using @sorcspellused}
#if (%1 = "invocation.") {sorcmsg=@sorcmsg using @sorcspellused}
#if (%1 = "magical transformation.") {sorcmsg=@sorcmsg using @sorcspellused}
#if (%1 = "invocation.") {sorcmsg=@sorcmsg using @sorcspellused}
party say WOO gained %1 mastery boint!
#FILE 5 sorcMastery.txt
#WRI 5 @sorcmsg
#close 5
#gag -1;#gag |
so as you can see, it grabs the current date, and then the name of the mastery point, and puts it into a variable... (and if it was a skillmastery, it also writes which spell triggered the gain)
zmud did this just fine.
it is the '/' in the variable breaking it.
taking the / out of the 'date' in the variable (which was put into the variable, and EXISTS in the variable then allows for the #echo and filewrite to work as required.
is this a bug?
Thanks Sincerely,
Aerious |
|
|
|
Aerious Wanderer
Joined: 21 Jan 2008 Posts: 62
|
Posted: Thu Jul 03, 2008 1:51 am |
I did realize that I should convert this over to a local variable because I only ever use it in this trigger :p, but I'd still like to know why this won't work, as I plan to do similar things many times with dates and times.
|
|
|
|
Aerious Wanderer
Joined: 21 Jan 2008 Posts: 62
|
Posted: Thu Jul 03, 2008 2:46 am |
is it that i need to use some function like the 'magicquotes' or something to escape the variable?..
it is really strange to me that with all the text in the variable that it would be converting it to an int instead of treating it like a string,
i tried using %string(sorcmsg) and it STILL wrote zero.
so it may not be that at all :0 |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Thu Jul 03, 2008 5:20 am |
The '/' is a special character in CMUD. Not sure why it's affecting anything in that context, but the function you're looking for %quote.
|
|
_________________ Asati di tempari! |
|
|
|
Zhiroc Adept
Joined: 04 Feb 2005 Posts: 246
|
Posted: Thu Jul 03, 2008 7:30 am |
I believe you have to be more careful with variable assignments. You should be doing:
Code: |
sorcmsg = {%time(c) ~-~- %1 ~-~-} |
Otherwise, I think the problem is that it takes the date as a math expression, and 7 divided by 3 divided by 2008 turns into 0. |
|
|
|
Aerious Wanderer
Joined: 21 Jan 2008 Posts: 62
|
Posted: Thu Jul 03, 2008 12:02 pm |
just to clarify, making the variable is NOT the problem, using it is.
%quote() does not work
Either did using the suggested variable assignment syntax. |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Thu Jul 03, 2008 3:20 pm |
Aerious, you have to use {} braces every time you are assigning a string which, when evaluated, contains slashes. In other words, you need both:
Code: |
sorcmsg = {%time(c) ~-~- %1 ~-~-} |
and this:
Code: |
sorcmsg={@sorcmsg using @sorcspellused} |
|
|
|
|
Aerious Wanderer
Joined: 21 Jan 2008 Posts: 62
|
Posted: Thu Jul 03, 2008 4:00 pm |
yes rahab, in that case I was, because that 2nd part was not firing based on the test msg I was using (cmud),
....
any way... I have changed my script a bit to try to workaround this 'buglike activity'
and have determined it is still acting this way EVEN if the / are not present. because sometimes there is also a '.' (period) present, and the period breaks it too.
and this is with your above suggestion in consideration. |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Thu Jul 03, 2008 5:03 pm |
I just did this:
Code: |
sorcmsg = "7/2/2008 9:40:52 PM--cMud--"
#file 5 test.txt
#write 5 @sorcmsg
#close 5 |
and it was written to the file just fine. So I don't think there is any bug or "buglike activity" here.
As rahab mentioned, you need " quotes or {} braces around your assignment. |
|
|
|
Aerious Wanderer
Joined: 21 Jan 2008 Posts: 62
|
Posted: Thu Jul 03, 2008 7:17 pm |
Something is still messed up, and right now it is the period.
which you did not try zugg, so perhaps it slipped by...
using
You feel you have reached a higher understanding of testing.
and
Code: |
#color blue
sorcmsg = {-- %-1 --}
#if (%1 = "alternate magics.") {sorcmsg={@sorcmsg using @sorcspellused}}
#if (%1 = "chaos from invariance.") {sorcmsg={@sorcmsg using @sorcspellused}}
#if (%1 = "magical lore.") {sorcmsg={@sorcmsg using @sorcspellused}}
#if (%1 = "chaos theory.") {sorcmsg={@sorcmsg using @sorcspellused}}
#if (%1 = "adaption of chaos.") {sorcmsg={@sorcmsg using @sorcspellused}}
#if (%1 = "invocation.") {sorcmsg={@sorcmsg using @sorcspellused}}
#if (%1 = "magical transformation.") {sorcmsg={@sorcmsg using @sorcspellused}}
#if (%1 = "evocation.") {sorcmsg={@sorcmsg using @sorcspellused}}
party say WOO gained %1 mastery boint!
#FILE 5 sorcMastery.txt
#WRI 5 {%time(c) " " @sorcmsg}
#close 5
#gag -1;#gag |
only the @sorcmsg messes up, with it returning '0' just like before, .. I have brought the %time(c) out, tho i suspect it will still break it, despite your sorcmsg you tested with.
did you try sorcmsg= {%time(c) --cMud--} ?
I think it should be noted, that the variable I am sending to textfile is created by using OTHER variables, so your assignment of time + perhaps some sentance witha period, MAY not break it,, but create a second variable, and try it perhaps |
|
|
|
Aerious Wanderer
Joined: 21 Jan 2008 Posts: 62
|
Posted: Thu Jul 03, 2008 7:38 pm |
ok it is not the period.
it seems to tbe the two minus signs right next to eachother..
if i go /-/-testing./-/- in the variable it works, and writes to the file...
but --testing.-- will not (from within the above provided script |
|
|
|
Aerious Wanderer
Joined: 21 Jan 2008 Posts: 62
|
Posted: Thu Jul 03, 2008 7:52 pm |
I have tried some more testing, because it is bothering me.
I made this trigger, for testing.
Code: |
PATTERN ^Zugg debug testing (*)
zuggtest={--%-1--}
zuggtest2={%time(c) @zuggtest}
#echo @zuggtest2
|
output: 7/3/2008 3:46:32 PM --testing.-- (to the screen via echo)
and then modified my existing trigger to
Code: |
PATTERN ^You feel you have reached a higher understanding of (*)
sorcmsg = {--%-1--}
#noop #if (%-1 = "alternate magics.") {sorcmsg={@sorcmsg , using @sorcspellused}}
#noop #if (%-1 = "chaos from invariance.") {sorcmsg={@sorcmsg using @sorcspellused}}
#noop #if (%-1 = "magical lore.") {sorcmsg={@sorcmsg using @sorcspellused}}
#noop #if (%-1 = "chaos theory.") {sorcmsg={@sorcmsg using @sorcspellused}}
#noop #if (%-1 = "adaption of chaos.") {sorcmsg={@sorcmsg using @sorcspellused}}
#noop #if (%-1 = "invocation.") {sorcmsg={@sorcmsg using @sorcspellused}}
#noop #if (%-1 = "magical transformation.") {sorcmsg={@sorcmsg using @sorcspellused}}
#noop #if (%-1 = "evocation.") {sorcmsg={@sorcmsg using @sorcspellused}}
party say WOO gained %-1 mastery boint!
#echo @sorcmsg
#file 5 sorcMastery.txt
#write 5 {%time(c)@sorcmsg}
#close 5
#echo @sorcmsg
#noop #gag -2
|
output:
0
Opened sorcMastery.txt as file 5
Closed C:\Documents and Settings\benb\My Documents\My Games\CMUD\ZJ\sorcMastery.txt on file 5
0
in both castes the (*) (%-1) held 'testing.' (without the quotes)
As you can see, the differences between the first and second are very very minimal...
yet, sorcmsg (@sorcmsg) outputs 0 to screen..
inside zmud sorcmsg holds the correct values.
there are no dublicate sorcmsg variables, and if i change
{--%-1--}
to
{" , "%-1}
it works as you would expect....
any ideas? |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Thu Jul 03, 2008 8:13 pm |
Either some other setting is inteferring with this, or you have a preference set differently, or this is already fixed in v2.30. In v2.30, I created the trigger you showed in the previous post (right above this one). Then I typed:
#show "You feel you have reached a higher understanding of testing."
and it displayed:
Code: |
You feel you have reached a higher understanding of testing.
party say WOO gained testing. mastery boint!
--testing.--
Opened sorcMastery.txt as file 5
Closed C:\Projects2007\CMUD\sorcMastery.txt on file 5
--testing.-- |
This was in a blank session (run CMUD, close the Session screen, create a trigger and paste the above script and pattern into it).
So I'm not sure why it's failing for you.
Also, do not use () parenthesis around anything. The () parenthesis tells CMUD to *evaluate* the stuff inside as an expression. So don't confuse the () parenthesis with the {} braces.
Edited: I just tested this in a fresh install of v2.29 and also could not get it to fail. Not sure what to suggest. |
|
|
|
Aerious Wanderer
Joined: 21 Jan 2008 Posts: 62
|
Posted: Thu Jul 03, 2008 8:20 pm |
is 2.30 available as beta, and if so where do I get it to try?
|
|
|
|
Nicodareus Wanderer
Joined: 24 Jun 2008 Posts: 68 Location: Texas
|
Posted: Thu Jul 03, 2008 8:30 pm |
I just tried the script as well, running CMudPro 2.29
Code: |
You feel you have reached a higher understanding of testing.
party say WOO gained testing. mastery boint!
--testing.--
Opened sorcMastery.txt as file 5
Closed Z:\CMUD\sorcMastery.txt on file 5
--testing.--
You feel you have reached a higher understanding of magical lore.
party say WOO gained magical lore. mastery boint!
--magical lore.--
Opened sorcMastery.txt as file 5
Closed Z:\CMUD\sorcMastery.txt on file 5
--magical lore.--
|
Do you have any other scripts that modify the @sorcmsg variable? Perhaps somewhere close to where @sorcspellused is getting defined? |
|
|
|
Aerious Wanderer
Joined: 21 Jan 2008 Posts: 62
|
Posted: Thu Jul 03, 2008 8:32 pm |
No I do not, this is selfcontained within this paticular trigger.
|
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Thu Jul 03, 2008 8:33 pm |
2.30 is internal to Zugg as this point. As the author of CMud he is always working with the bleeding edge.
He also stated that he tested this with a copy of 2.29 and couldn't replicate the problem. Is there anything else you can tell us to help in replicating this? |
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
Aerious Wanderer
Joined: 21 Jan 2008 Posts: 62
|
Posted: Thu Jul 03, 2008 8:34 pm |
I deleted sorcmsg variable and let cmud2.29 recreate it and it works now...
the question only remains, why did it mess up to begin with :( |
|
|
|
Nicodareus Wanderer
Joined: 24 Jun 2008 Posts: 68 Location: Texas
|
Posted: Thu Jul 03, 2008 8:35 pm |
Are you using class folders? Might the variable be getting defined in one class, but not the one that contains your script? As has been pointed out, this is not an issue with 2.29, but instead is being caused by something else outside of this particular script. The script itself works just fine.
Edit: Never mind on all of that, since you (at least to a degree) fixed it and posted before I could :P |
|
Last edited by Nicodareus on Thu Jul 03, 2008 8:36 pm; edited 1 time in total |
|
|
|
Aerious Wanderer
Joined: 21 Jan 2008 Posts: 62
|
Posted: Thu Jul 03, 2008 8:36 pm |
have a great holiday people, I will check back on this monday... peraps assigning the variable the wrong way
ie,
sorcmsg=--%-1--
and then using the same variable (that already existed) later to overwrite to
sorcmsg= {--%-1--}
caused it, but i cannot try to test it until monday..
Thank you all. |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Thu Jul 03, 2008 8:49 pm |
It's certainly possible that the Type of the variable in the settings editor was set to something different than Auto-Type that might have caused the problem.
|
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Thu Jul 03, 2008 8:54 pm |
This works as expected for me in a blank session using the following code. I am running CMUDPro 2.29
Code: |
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
<trigger priority="10" copy="yes">
<pattern>^You feel you have reached a higher understanding of (*)</pattern>
<value>#echo we were called
sorcmsg = {--%-1--}
#noop #if (%-1 = "alternate magics.") {sorcmsg={@sorcmsg , using @sorcspellused}}
#noop #if (%-1 = "chaos from invariance.") {sorcmsg={@sorcmsg using @sorcspellused}}
#noop #if (%-1 = "magical lore.") {sorcmsg={@sorcmsg using @sorcspellused}}
#noop #if (%-1 = "chaos theory.") {sorcmsg={@sorcmsg using @sorcspellused}}
#noop #if (%-1 = "adaption of chaos.") {sorcmsg={@sorcmsg using @sorcspellused}}
#noop #if (%-1 = "invocation.") {sorcmsg={@sorcmsg using @sorcspellused}}
#noop #if (%-1 = "magical transformation.") {sorcmsg={@sorcmsg using @sorcspellused}}
#noop #if (%-1 = "evocation.") {sorcmsg={@sorcmsg using @sorcspellused}}
party say WOO gained %-1 mastery boint!
#echo @sorcmsg
#echo {%time(c)@sorcmsg}
#file 5 sorcMastery.txt
#write 5 {%time(c)@sorcmsg}
#write 5 {@sorcmsg}
#close 5
#echo @sorcmsg
#noop #gag -2 </value>
</trigger>
<var name="sorcspellused" copy="yes">pallor of light</var>
<var name="sorcmsg" type="String" copy="yes">--testing.--</var>
</cmud>
|
|
|
_________________ Asati di tempari! |
|
|
|
|
|