It is currently April 19th, 2024, 1:45 am

Inline Pattern, setting [solved]

Get help with creating, editing & fixing problems with skins
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am

Inline Pattern, setting [solved]

Post by Mor3bane »

Hi
I am trying to have a text adjustment using InlineSetting, and inlinePattern.

The following String Meter is the bit I am adjusting:

Code: Select all

[PercentString]
Meter=String
Text=[Percent:0] %
AntiAlias=1
DynamicVariables=1
FontFace=digital
InlineSetting=Face | Medici Text
InlinePattern=^.* (.*)
FontSize=22
FontColor=232,202,145,200
StringEffect=Border
FontEffectColor=0,0,0,255
StringAlign=CenterCenter
X=145
Y=145
I am trying to avoid relying on the space in the Text parameter to get my result being attempted in the InlinePattern parameter.

In other words, I wish to not have the space in there at all, but keep the "%" from being changed like the {Percent:0} portion i do wish to change.
Thanks for looking.
Last edited by Mor3bane on September 29th, 2019, 1:47 am, edited 1 time in total.
My DevArt Gallery

There are many ways to be different - there is only one way to be yourself - be amazing at it

The law of averages says what it means; even if you get everything right, you will get something wrong. Therefore; self managing error trapping initiates another set of averages - amongst the errors, some of them will not be errors, instead those instances will appear to be "luck". One cannot complain of the 'appearance' of 'infinite regress of causation', even if it does not have a predictable pattern, only that it requires luck to achieve.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Inline Pattern, setting

Post by jsmorley »

Not entirely sure I follow, but if the intent is to have the numeric value be one thing, and the % symbol to be another, you might do:

Code: Select all

[PercentString]
Meter=String
FontSize=22
InlineSetting=Color | 255,0,0,255
InlinePattern=\d
InlineSetting2=Color | 0,255,0,255
InlinePattern2=%
AntiAlias=1
DynamicVariables=1
Text=[Percent:0] %

1.jpg


Just means:
\d any and all numeric characters
% any and all percent symbols
Remember that InlinePattern is "greedy" unless you tell it otherwise with (?U).

So if:
Text=23%ABC%98

2.jpg
You do not have the required permissions to view the files attached to this post.
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am

Re: Inline Pattern, setting

Post by Mor3bane »

Sweet.

Thanks JS
My DevArt Gallery

There are many ways to be different - there is only one way to be yourself - be amazing at it

The law of averages says what it means; even if you get everything right, you will get something wrong. Therefore; self managing error trapping initiates another set of averages - amongst the errors, some of them will not be errors, instead those instances will appear to be "luck". One cannot complain of the 'appearance' of 'infinite regress of causation', even if it does not have a predictable pattern, only that it requires luck to achieve.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Inline Pattern, setting [solved]

Post by jsmorley »

Sure thing.

Another option might be:

Code: Select all

[PercentString]
Meter=String
FontSize=22
InlineSetting=Color | 255,0,0,255
InlinePattern=\d
InlineSetting2=Color | 0,255,0,255
InlinePattern2=[^\d]
AntiAlias=1
DynamicVariables=1
Text=[Percent:0] %
Just means:
\d any and all numeric characters
[^\d] any and all of the character set that is ^ NOT a numeric character
Note that the ^ (NOT) modifier only applies to a single character (not "greedy") or a [character set].

A [character set] is a way to define one or more individual characters or \character classes in any order. So:

Code: Select all

[PercentString]
Meter=String
FontSize=22
SolidColor=0,0,0,1
InlineSetting=Color | 255,0,0,255
InlinePattern=[ABC]
InlineSetting2=Color | 0,255,0,255
InlinePattern2=[123]
InlineSetting3=Color | 0,0,255,255
InlinePattern3=[DEF]
AntiAlias=1
DynamicVariables=1
Text=CEA123FBD

1.jpg

InlinePattern=[ABC] in effect means "A or B or C in any order". It doesn't mean the strict pattern "ABC".

[character sets] can include "ranges" like a-zA-Z0-9 as well. [^\d] and [^0-9] are synonymous.

In order to exclude a strict pattern like "hello world", it would take some pretty complicated negative lookahead assertion, and it's probably not worth it. I'm not entirely sure it is even possible... Just include the "hello world" pattern in a separate InlineSetting that sets it some other way than the rest.
You do not have the required permissions to view the files attached to this post.