This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

How do I make the x data variable into the y data variable?

Help for those learning Tcl or writing their own scripts.
Post Reply
B
Bewedesign
Voice
Posts: 2
Joined: Wed Jan 31, 2024 8:27 am

How do I make the x data variable into the y data variable?

Post by Bewedesign »

How do I make the x data variable into the y data variable, like the following example:

from notices: blue 3 wild wild draw four green draw two yellow 6 red 0 wild

to txt file:
blue 3
wild
wild draw four
green draw two
yellow 6
redo 0
wild
User avatar
CrazyCat
Revered One
Posts: 1242
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Re: How do I make the x data variable into the y data variable?

Post by CrazyCat »

I don't understand how you want to split the notice.
Can you be more explicit or use real example?
D
DasBrain
Voice
Posts: 16
Joined: Thu Apr 08, 2021 12:31 pm

Re: How do I make the x data variable into the y data variable?

Post by DasBrain »

It seems like you want to write an UNO bot - that plays UNO as a player.

So, I added the colored reverse.
This should extract the information into a Tcl list:

Code: Select all

set cardstr {blue 3 wild wild draw four green draw two yellow 6 red 0 wild}
set cardlist [regexp -all -inline {(?:blue|green|yellow|red) (?:\d|draw two|reverse)|wild draw four|wild} $cardstr]
This would yield a list with the 7 cards in $cardlist.
B
Bewedesign
Voice
Posts: 2
Joined: Wed Jan 31, 2024 8:27 am

Re: How do I make the x data variable into the y data variable?

Post by Bewedesign »

Dasbrain, you are absolutely right... Thank you..
Post Reply