|
misterbalrog Apprentice
Joined: 26 Oct 2004 Posts: 108
|
Posted: Sat Jan 29, 2005 2:57 pm
tired of %quote bugging... |
Anyone got a better working thing than %quote?
Cuz it simply does not do...
Here's an example:
what I type: goss let's try it again with & and % and " and such
what it sends: gos &+Blet's try it again with ~& and ~% and " and such), "~&+y"
what is seen: You holler, 'let's try it again with ~& and ~% and " and such), "~"'
What I want to be seen: You holler, 'let's try it again with & and % and " and such'
Example if I don't use %quote:
I type: goss Let's make another attempt without %quote and see what happens with &:s and words like S&M..
It sends: gos &+BLet's make another attempt without and see what happens with &:s and words like S.&+y
What is seen: You holler, 'Let's make another attempt without and see what happens with &:s and words like S.'
Note: there's a whitespace after the word "without" where %quote should be...
The alias:
#AL goss gos %concat( @randcolor, %quote( %-1), "&+y")
If you're curious about @randcolor, here it is...
#var ->
Code: |
colorcodes L|r|R|g|G|y|Y|b|B|m|M|c|C|w|W
randcolor &+%item( @colorcodes, %random( 1, 15)) |
Perhaps something that is on the to-fix list already? who knows... |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Sun Jan 30, 2005 12:41 pm |
%quote doesn't apply to either single-quotes or double-quotes.
Instead of trying all these tricks with user functions (scripts inside variables), just put the color-selection into the alias.
Code: |
#AL goss {gos ~&+%item( @colorcodes, %random( 1, 15))%{-1}~&+y} |
|
|
_________________ LightBulb
Senior member
Most scripts in this forum are written for Command Line entry.
Don't even open the Settings Editor unless its use is specified or obvious. |
|
|
|
misterbalrog Apprentice
Joined: 26 Oct 2004 Posts: 108
|
Posted: Sun Jan 30, 2005 5:34 pm |
LightBulb, apparently you didn't quite read or try your own code... but that does not work. It produces the same result. And the reason I have it separated is cuz I tend to use @randcolor elsewhere... but again.. @randcolor was not the issue, it was %quote.
#AL goss2 {gos ~&+%item( @colorcodes, %random( 1, 15))%{-1}~&+y}
Gives:
Typed: goss2 test &test %quote % and more & aswell as " going for another "test so...
Sent: gos &+btest % and more & aswell as going for another test so...&+y
Seen: You holler, 'test % and more & aswell as going for another test so...'
Note: Again there are extra whitespaces instead of each word that is paired with a special character. This is one of the most annoying things, but the single-quote and double-quote aswell.. cuz if you use the alias and want to quote someone while saying something, the quotes disappear. It makes the entire sentence look really weird.
Thanks for trying though =)
Should perhaps be noted that if the amount of quotes are odd and used in a string within an alias that parses it through a function, most of the times it will get real buggy and interrupt the function, ending up sending either the remaining part from that quote 'til the end of the alias, or the entire alias line. As shown previously with the paranthesis showing from the %quote function inside the %concat.... |
|
|
|
Pega Magician
Joined: 08 Jan 2001 Posts: 341 Location: Singapore
|
Posted: Sun Jan 30, 2005 11:40 pm |
'Mind if I suggest something?
|
|
|
|
misterbalrog Apprentice
Joined: 26 Oct 2004 Posts: 108
|
Posted: Mon Jan 31, 2005 12:14 am |
If it is related to actually being able to use the randomcolor function properly with an alias that sends the arguments after it, and properly with all characters as entered, go ahead and suggest...
|
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Mon Jan 31, 2005 12:30 am |
Yes, I did test it just not as exhaustively as you did. I used the precise line you complained about in your original post:
Quote: |
goss let's try it again with & and % and " and such |
What it sends:
Code: |
&+wlet's try it again with & and % and " and such &+y |
It never occured to me that you would next try putting VARIABLES into the line (it should have, since you had them in your second example). &test is a variable, an empty or undefined one apparently. %quote is a variable, an empty one. When you put undefined or empty variables into an alias, it's not surprising that you get back empty white space. It's just the spaces in front of and behind those variables with nothing (the contents of the variable) between the spaces. Matched double-quotes will also be stripped unless you have chosen otherwise in Prefs.
I can't think of any way to accomplish what you are trying to do, but I've also never been very interested in applying random colors to everything I say. It would probably be simpler to just write an alias to send the gossip command and color-code, using #SENDPROMPT, followed by the #VERBATIM command to disable parsing, then you can send whatever you want for the actual gossip and use CTRL-R to restore your command-line processing, and finally use another alias to send the &+y if necessary.
Code: |
#AL goss3 {#SENDPROMPT gos ~&+%item( @colorcodes, %random( 1, 15));#VERB}
#AL goss4 {#SENDPROMPT ~&+y} |
Pega, if you have suggestions go right ahead. I certainly won't mind.
EDIT: Added #VERBATIM to suggestion |
|
_________________ LightBulb
Senior member
Most scripts in this forum are written for Command Line entry.
Don't even open the Settings Editor unless its use is specified or obvious. |
|
|
|
Pega Magician
Joined: 08 Jan 2001 Posts: 341 Location: Singapore
|
Posted: Mon Jan 31, 2005 12:53 am |
I think what you want to use is the %literal() function. %quote simply prefixes special chars with ~'s.
Code: |
#AL goss {gos @randcolor %literal(%-1&+y)} |
|
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Mon Jan 31, 2005 1:15 am |
Very nice!
|
|
_________________ LightBulb
Senior member
Most scripts in this forum are written for Command Line entry.
Don't even open the Settings Editor unless its use is specified or obvious. |
|
|
|
misterbalrog Apprentice
Joined: 26 Oct 2004 Posts: 108
|
Posted: Mon Jan 31, 2005 3:03 am |
Almost! but not quite...
This is what the alias looks like now:
#AL goss {gos @randcolor%literal( %-1)&+y}
However... 2 errors still occur...
That is when an argument is sent to the alias containing commas (which is widely used in grammatically correct sentences) or just a single double-quote, it still becomes weird.
When a string contains a comma, it cuts off where the comma is and doesn't send the rest of the string. Example:
Typed: goss what about another, test with commas
Sent: gos &+Mwhat about another&+y
Seen: You holler, 'what about another'
And the double-quote thing.. well it's already been shown in the first example in the quote.. it simply adds the ending parenthesis of the function to the end of the string prior to the last color-code...
We're ALMOST there! =) ... |
|
|
|
Pega Magician
Joined: 08 Jan 2001 Posts: 341 Location: Singapore
|
Posted: Mon Jan 31, 2005 3:26 am |
The quotes and double quotes work. Commas are special chars to zMUD functions.
If you opt to use this alias, my best suggestion is to place ~'s in front of your commas and any closing parentheses in the message.
I just found an alternative.
#AL goss {#PR gossmessage {What do you want to gossip?};gos @randcolor%expand(@gossmessage,1)&+y}
NB If you use "" instead of {} around 'What do you want to gossip' followed by a semicolon you can get an infinite loop.
You could also save the message into a file somehow and send the contents of the file. |
|
|
|
misterbalrog Apprentice
Joined: 26 Oct 2004 Posts: 108
|
Posted: Mon Jan 31, 2005 3:39 am |
A single double quote does not work.. I tried it and it ends up with the afformentioned result. (one or more) Single quote(s) DOES work, but not a single double-quote...
Typed: goss another test with double-quote " like that..
Sent: gos &+Manother test with double-quote " like that..)&+y
Seen: You holler, 'another test with double-quote " like that..)'
I think zugg should make a %raw function or the likes.. which will absolutely in no way expand more than once (just getting the value from %-1) a certain string. This way commas, double-quotes, single-quotes, special-characters and whatnots be able to get through...
Edit: The prompt version actually works, but I can't figure out a way to simulate the "clean" way it stores the value into the variable without using it... the pop-up is sooooooooooooo annoying... cuz if I could simulate how it stores it, then I could use that manner directly in the send... |
|
Last edited by misterbalrog on Mon Jan 31, 2005 3:53 am; edited 1 time in total |
|
|
|
Pega Magician
Joined: 08 Jan 2001 Posts: 341 Location: Singapore
|
Posted: Mon Jan 31, 2005 3:42 am |
Okay I think this is the ultimate solution:
Code: |
#ONINPUT {^goss5 (.+)$} {gos @randcolor%1&+y} "" {case|notrig|regex} |
|
|
|
|
misterbalrog Apprentice
Joined: 26 Oct 2004 Posts: 108
|
Posted: Mon Jan 31, 2005 4:00 am |
Actually, to fix a few minor things, I had to do a %concat in there for it...
#ONINPUT {^goss5 (.+)$} {gos %concat(@randcolor,"%1",&+y)} "" {case|notrig|regex}
Without the %concat, it will strip away the first word. But yes, now it seems to work... I'll return if anything else shows up :P |
|
|
|
Pega Magician
Joined: 08 Jan 2001 Posts: 341 Location: Singapore
|
Posted: Mon Jan 31, 2005 4:05 am |
Oh you are right, I never defined randcolor that is why I did not notice it before.
Try this instead:
Code: |
#ONINPUT {^goss5 (.+)$} {gos @{randcolor}%1&+y} "" {case|notrig|regex} |
|
|
|
|
Pega Magician
Joined: 08 Jan 2001 Posts: 341 Location: Singapore
|
Posted: Mon Jan 31, 2005 10:08 am |
Summary:
1. Using an Alias.
Quote: |
#AL goss {gos @randcolor%literal(%quote(%-1))&+y} |
Strange, using the above with commas work for me now, not sure why it did not seem to work earlier, but it still has problems with the semicolon character.
2. Using an OnInput Alias.
Quote: |
#ONINPUT {^goss3 (.+)$} {gos %literal(@{randcolor}%1)&+y} "" {case|notrig|regex} |
Semicolons do not work with #1 and #2 because they are automatically parsed into multiple lines before the aliases can use the input. Even if command-line parsing (eg. the #verbatim 0) was turned off, aliases do not work.
3. Using a Prompt and a Variable.
Quote: |
#AL goss2 {#PR gossmessage {What do you want to gossip?};gos %literal(@randcolor@gossmessage)&+y} |
PS It seems that if you allow [] or () for eval in your script parser settings, you will not be able to stop its evaluation in the command-line or pop-up prompt unless they are manually prefixed with tildes.
Good? |
|
|
|
misterbalrog Apprentice
Joined: 26 Oct 2004 Posts: 108
|
Posted: Mon Jan 31, 2005 12:59 pm |
actually I have no problem with parenthesis... perhaps If I try and use it as a smiley... lemme try it.. nope... no problem there either...
The only thing I do have a problem with is if I use both [ and ] in the same sentence in that order... if I use them ] and [ there will, ofcourse, not be a problem. but that could be fixed with a %replace I think... but .. I don't use such smileys.. so I'll manage...
=) |
|
|
|
misterbalrog Apprentice
Joined: 26 Oct 2004 Posts: 108
|
Posted: Mon Jan 31, 2005 3:24 pm |
Oh.. just noticed... with %concat, commas stop working....
and with @{randcolor} the variable is not expanded, it just ends up blank, it returns NULL... so no color code applied...
and with @randcolor%1&+y , the first word vanishes and no color code is applied... |
|
|
|
Pega Magician
Joined: 08 Jan 2001 Posts: 341 Location: Singapore
|
Posted: Mon Jan 31, 2005 6:57 pm |
misterbalrog wrote: |
actually I have no problem with parenthesis... perhaps If I try and use it as a smiley... lemme try it.. nope... no problem there either...
The only thing I do have a problem with is if I use both [ and ] in the same sentence in that order... if I use them ] and [ there will, ofcourse, not be a problem. but that could be fixed with a %replace I think... but .. I don't use such smileys.. so I'll manage...
=) |
I suggest turning off [] and () evaluation in your settings, since you intend to enter those characters directly into the command-line or prompt without evaluation.
misterbalrog wrote: |
Oh.. just noticed... with %concat, commas stop working....
and with @{randcolor} the variable is not expanded, it just ends up blank, it returns NULL... so no color code applied...
and with @randcolor%1&+y , the first word vanishes and no color code is applied... |
You may be seeing weird things going on because you did not use %literal() in the right places to prevent immediate evaluation of variables (eg. @{randcolor}) when entering the script from the command line or from a script import. @{randcolor} - with the braces, does not prevent it from being expanded, rather it could have been expanded too early. |
|
|
|
misterbalrog Apprentice
Joined: 26 Oct 2004 Posts: 108
|
Posted: Mon Jan 31, 2005 7:37 pm |
Que?
I did not enter the script from commandline, I altered the existing one with the editor. I don't do script imports either..
Like I said, it doesn't evaluate () at all, but [] it does... however, since I don't use such smileys, I can keep the evaluation still intact, cuz if I uncheck it, it will affect other triggers/scripts...
Basically, I will not alter anything in the settings cuz I have the current ones as they are for a reason. I've toggled em on and off depending on diff sets of scripts and triggers. If I were to change smth it will affect something else... thus I don't wanna ruin anything by toggling them... Esp since it's ONLY going to affect if I use [] (both are needed, and in that order) in a sentence, which normally are not ever used in a sentence anyway except for smileys (which I don't have a habit of using)..
However, I've temporarily fixed the trigger by just putting the @randcolor script in the trigger directly... that fixes the comma problem...
But I'd still like to get that to work properly (using @randcolor that is)..
Additionally, if @{randcolor} does get expanded too early, then that's just silly... why should/would it do that?
(tho that seems to be the effect, since if a variable contains "&+" and you do #echo @var, it shows "&+", but with #echo @{var} it shows "", it could be just hateful against the amphersand...)
Edit: Using %expand on @randcolor worked just fine...
so the content of the trigger you made earlier (the oninput one) looks like this:
goss %expand( @randcolor)%1&+y |
|
|
|
Pega Magician
Joined: 08 Jan 2001 Posts: 341 Location: Singapore
|
Posted: Mon Jan 31, 2005 8:00 pm |
Try using the lines of script I typed out in my earlier post. http://forums.zuggsoft.com/phpbb/viewtopic.php?t=19754&postdays=0&postorder=asc&start=14
Enter them into the command line, not the script editor. They were meant for command line input.
If you are using the first alias, remove the %quote(), I got it mixed up with another thread.
misterbalrog wrote: |
Like I said, it doesn't evaluate () at all, but [] it does... however, since I don't use such smileys, I can keep the evaluation still intact, cuz if I uncheck it, it will affect other triggers/scripts...
Basically, I will not alter anything in the settings cuz I have the current ones as they are for a reason. I've toggled em on and off depending on diff sets of scripts and triggers. If I were to change smth it will affect something else... thus I don't wanna ruin anything by toggling them... Esp since it's ONLY going to affect if I use [] (both are needed, and in that order) in a sentence, which normally are not ever used in a sentence anyway except for smileys (which I don't have a habit of using).. |
I guess you will have to change your triggers and scripts. IMHO using [] for evaluation is unneccesary and only a minor convenience in your script. In this case, it is a hindrance.
misterbalrog wrote: |
Additionally, if @{randcolor} does get expanded too early, then that's just silly... why should/would it do that? |
That applies to command-line entry of the script. |
|
|
|
misterbalrog Apprentice
Joined: 26 Oct 2004 Posts: 108
|
Posted: Mon Jan 31, 2005 11:11 pm |
I'm using the ONINPUT... but instead of %literal, it's using %expand on the @randcolor variable... works just fine now.
|
|
|
|
Pega Magician
Joined: 08 Jan 2001 Posts: 341 Location: Singapore
|
Posted: Tue Feb 01, 2005 2:33 am |
As I said in the other thread, %literal is used in command line input of a script.
Your @randcolor uses %expand only because it requires recursive expansion.
They are 2 seperate things.
Cheers |
|
|
|
|
|