0 votes
by (2.4k points)

Hello there I'm back !
 

So here I was trying something, I wanted to use the widget <<sheS>> (which prints the first or second argument depending on the value of $sheS) within the widget <<chat>>.

Here's the thing, how do you manage to separate arguments without the " ' " ? 

​
<<chat $name $sName
$sName 'Hey bro' 'I\'ve heard from mom that you were coming home soon!' 
$name 'Yes.'
$sName 'That\'s amazing!' 'Why didn\'t you tell your marvelous <<sheS 'sister' 'brother'>>? :('
$name '...' 'You know why.'
$sName 'What?' 'Are you still mad about last time?'
$name 'Let\'s not talk about it.' >>

​

 

Here, the code won't work as <<chat>> will think the " ' " separating sister from brother (<<sheS 'brother' 'sister' >> ) are actually there to separate its own arguments. So I've tried and wrote <<sheS brother sister>> and it worked ! 
But what if I want to enter long sentences within <<sheS>> ? How do I use " ' " to make <<sheS>> understand the argument is the whole sentence, while not making <<chat>> bug it all out ?

Thanks a lot ! 
And sorry If I was unclear, please do tell me if that's the case. 

1 Answer

0 votes
by (159k points)

You can either try escaping the single quote delimiters of the <<sheS>> macro's parameters, like you are doing with words like ```I\'ve``` and ```That\'s```

'Why didn\'t you tell your marvelous <<sheS \'sister\' \'brother\'>>? :('

... or you can try switching to delimiting the <<sheS>> macro's parameters with double quotes instead

'Why didn\'t you tell your marvelous <<sheS "sister" "brother">>? :('

opinion::
Personally I think the main issue with what you are trying to do is the method you are using to pass multiple sets of comments to your <<chat>> macro. I would of uses a collection object like an Array to group each set of comments, and used child Arrays to group the items within each set.

<<chat [
	[$name, $sName],
	[$sName, 'Hey bro', 'I\'ve heard from mom that you were coming home soon!'],
	[$name, 'Yes.'],
	[$sName, 'That\'s amazing!', 'Why didn\'t you tell your marvelous <<sheS \'sister\' \'brother\'>>? :('],
	[$name, '...', 'You know why.'],
	[$sName, 'What?', 'Are you still mad about last time?'],
	[$name, 'Let\'s not talk about it.']
]>>

... that way you are only passing a single parameter to the <<chat>> macro. It would of also been easier to loop through each set of comments and each of the items within a set.

...