wintin Forum Index wintin
Wintin Discussion Forum
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

2.07 -- Issues with '{' causing the client to eat scripts

 
Post new topic   Reply to topic    wintin Forum Index -> Bug Reports
View previous topic :: View next topic  
Author Message
zephyr
Juggernaut


Joined: 08 Jan 2007
Posts: 145

PostPosted: Sun Feb 11, 2007 4:35 pm    Post subject: 2.07 -- Issues with '{' causing the client to eat scripts Reply with quote

I wrote a script to monitor mud auctions for me and ran into a number of issues with the '{' character.

I had my script seemingly working well, until someone auctioned an item with this name:
Code:
-Sniggles-{@

When my C# script went to wintin.SetVariable() that name into my auction history variable the client refused. I quickly discovered that wintin variables can't contain the character '{'. As an aside, is there a technical reason for this?

Anyway, my initial fix was to use a placeholder character for storing '{'s in wintin variables. Something like this:
Code:
itemName = wintin.Args.Vars[2].ToString().Trim().Replace('{','έ');

And of course then this when displaying it:
Code:
itemName.Replace('έ','{');


That work around was fine until I restarted my client and noticed my auction tracker was no longer functioning at all. Looking in the Script Explorer revealed my triggering action was gone. I checked my defaultscripts.ws and the action was still defined in there. The consequence of the client not loading the script though is that once you exit the client again the defaultscripts.ws gets saved and now the offending script is gone.

My final, successful work around was to use the Unicode escape sequence for left curly brackets in my script:
Code:
'\u007B'


Anyway, here's the steps to reproduce the issue. Starting from a fresh defaultscripts I created the action foo. Then I used the following C# code for its script
Code:
using System;
using ScriptEngine;
//css_reference ScriptEngine.dll;

public class Script : WintinScript
{
   public override void Init()
   {
      "{test}".Replace('{','(');
   }
}
Restart the client and the action will be gone, but still in defaultscripts.ws. Exit the client and it will be removed from there too.
Back to top
View user's profile Send private message
zephyr
Juggernaut


Joined: 08 Jan 2007
Posts: 145

PostPosted: Sun Feb 25, 2007 6:35 am    Post subject: Reply with quote

I was just thinking, since #capture stores lines in wintin variables they really should be able to contain any character that might get pulled from the mud.
Back to top
View user's profile Send private message
zephyr
Juggernaut


Joined: 08 Jan 2007
Posts: 145

PostPosted: Tue Apr 24, 2007 7:47 pm    Post subject: Reply with quote

I haven't really tested this, but I think this has to do with the client script loading code wanting to see a } for every { even in contexts where it doesn't make sense.

I had a #gag in a C# script... something like this:
Code:
wintin.Interpret("#gag {^blah};#gag {^blah %1 blah.");
As you can see I left off the } by mistake inside the string I'm interpreting. This caused the script to be eaten the next time I restarted the client. After adding in the missing } the issue didn't occur.
Back to top
View user's profile Send private message
bOR_



Joined: 06 Apr 2007
Posts: 4

PostPosted: Wed Apr 25, 2007 9:35 am    Post subject: Reply with quote

Somewhat related.. if I want to make a colorful desc on my mud, I'd send it something like

desc + "His {bblue{x eyes light up in the night"

And I found that that didn't work. I put it down to wintin eating {'s when sending them to the mud but I didn't look into it any further.
Back to top
View user's profile Send private message
zephyr
Juggernaut


Joined: 08 Jan 2007
Posts: 145

PostPosted: Fri Apr 27, 2007 4:15 pm    Post subject: Reply with quote

If desc is command on your mud and not something in a C# script try this:
Code:
{desc + "His {bblue{x eyes light up in the night"
You can kind of see what's going on if you close those braces with an equal number on the other side. The outermost closing brace won't be sent either. As a rule of thumb, if you're going to have more { than } just toss an extra { on at the start (or alternately double up the first { you're using). If you have any { and you also have the same # of } or more you'll also need double up the last } Shocked. For example:
Code:
{echo 0{##}}}========-
displays as:
Code:
0{##}}========-
on my mud.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    wintin Forum Index -> Bug Reports All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group