SphereServer BugTracker - SphereServer
View Issue Details
0001500SphereServerexecutable - genericpublic22-08-08 03:3523-04-14 02:18
Ankron 
Ben 
normalfeaturealways
resolvedfixed 
 
0.56c Nightly 
08-02-2008
None
None
0001500: Qoutation mark's cause huge problems in the scripting language
When you type in things like .TEST "a", a, "a" the function will only see the first argument, and ignore that there are Qoutation marks the rest. So say I want to use a function like this...
.TEST His name is "PK", and he likes to kill players
it will only see the first argument

His name is PK
here's a test script <args> works fine <argvx> does not.

[FUNCTION TEST]
say <args>
say <argv0>, <argv1>, <argv2>
No tags attached.
Issue History
22-08-08 03:35AnkronNew Issue
22-08-08 03:35AnkronNightly Version => 08-02-2008
22-08-08 03:35AnkronExperimental Flags => None
22-08-08 03:35AnkronOption Flags => None
23-08-08 02:38CorujaNote Added: 0000069
23-08-08 22:06AnkronNote Added: 0000070
26-08-08 00:59nazghulNote Added: 0000072
26-08-08 01:00nazghulNote Edited: 0000072
26-08-08 01:02nazghulSeveritymajor => feature
26-08-08 01:02nazghulStatusnew => feedback
27-08-08 20:52AnkronNote Added: 0000075
27-08-08 20:54AnkronNote Edited: 0000075
27-08-08 20:55AnkronNote Edited: 0000075
27-08-08 21:00AnkronNote Edited: 0000075
27-08-08 21:39AnkronNote Edited: 0000075
15-03-09 18:20AnkronNote Added: 0000181
15-03-09 18:22AnkronNote Edited: 0000181
15-03-09 18:23AnkronNote Edited: 0000181
15-03-09 18:24AnkronNote Edited: 0000181
15-03-09 20:09MrSugarCubeRelationship addedhas duplicate 0001583
23-04-14 02:18BenNote Added: 0002080
23-04-14 02:18BenStatusfeedback => resolved
23-04-14 02:18BenFixed in Version => 0.56c Nightly
23-04-14 02:18BenResolutionopen => fixed
23-04-14 02:18BenAssigned To => Ben

Notes
(0000069)
Coruja   
23-08-08 02:38   
Thats the sphere scripting language I guess, but you can use '' instead of "" without problems :D
(0000070)
Ankron   
23-08-08 22:06   
I suppose you could, but users hardly if ever think like that. Say I wanted to create a script that requires user input right? Well the moment a user starts using qoutation makers the whole script goes Kaboom. IE user puts in say

.chat Hello, GM this guys just said "I'm gonna crash your server", "screw the GM's", and ect.

Only half that message would show up. Or maybe some other scripting clutz out there used qoutations in the name of an item and I want to store the information about that item in a data base. It might not store so well.

There there's the issue of NPC's speech, what if I need to use Qotation marks and apostrophies in the same sentence? Can't do it with out issues.

Also what about parsing what a player says for command line/filtering pourposes
Enter a qoutation mark and a comma (quite common I might add) your script is sunk.

Personnaly I'd like to see strings parsed the same way they would be in most modern programing languages IE...

"My dog's name is \"".<local0.varhere>."\". He likes to eat %1, %2, and %3.", "ribs", "chicken", "anything off the table."

Notce how it's parsed?
if there is a qoutation mark with no forward-slash then it signifies the start or end of a string in an argument. But if a forward-slsh preceeds the qoutation mark it means that the qoutation mark is part of the string to be used. Also notice the commas outside the qouted string? those signify that after this comma is a new argument. Much cleaner.

IE if I used the string above with say this function...

[function DogsName]
local.varhere="Spike"
say <argv0>
(0000072)
nazghul   
26-08-08 00:59   
(edited on: 26-08-08 01:00)
No one stops you from using Sphere's Regex function.

Escaping would help you absolutely nothing with your "user writes in a chat" example, because if the user is unable to remember to not use quotation marks, he's also unable to use escaping; so your script has to do the escaping for him - and then you can insert your own escaping/deescaping.

Anyway, I really doubt that any dev is willing to rewrite the whole, in some parts "distributed" parser just to enable you to use single quotes and apostroph's in the same string

NOT to mention that this is no "major bug", as you declarated it, but, if at all, a feature request

(0000075)
Ankron   
27-08-08 20:52   
(edited on: 27-08-08 21:39)
More to the bug... in scrips it drops everything after the first qoutation mark in the argument variables even in <args>, I really would like it if that didn't happen.

(0000181)
Ankron   
15-03-09 18:20   
(edited on: 15-03-09 18:24)
Ok, more info on this bug... you cannot escape qoutation marks no matter how much you want to... you type asc(") and gives the result in 00 which will never convert back to any charactor other than a space. And even if you get the 00 it still drops everything after the second qoutation mark.

asc("asd", AAA)) will result in a set of 3 bytes when it should be 9 bytes, 1 byte per char.

So telling some one to escape a qoutation mark when it's not possible, just does not work.

(0002080)
Ben   
23-04-14 02:18   
This is how is will work now in a simple function called TEST...
-.TEST "a", b, "c,d" Output: ARGS = a ARGV[0] = a ARGV[1] = b ARGV[2] = c,d
-.TEST "a"e, b, "c,d" Output: ARGS = a ARGV[0] = a ARGV[1] = b ARGV[2] = c,d
-.TEST e"a", b, "c,d"f Output: ARGS = e"a", b, "c,d"f ARGV[0] = e"a" ARGV[1] = b ARGV[2] = c,d
-.TEST f"a"g"h,i",b,e"c,d" Output: ARGS = f"a"g"h,i",b,e"c,d" ARGV[0] = f"a"g"h,i" ARGV[1] = b ARGV[2] = e"c,d"
*All ARGV will now show even if quotes are found in first argument.
*if quotes are found as the first character of an argument, what is found in the quote is the argument
*if a quote is found but not at the beginning, or no quote is found, whole string is used as argument.