Page 1 of 1

using get matchText true/false return...

Posted: Tue Feb 24, 2015 9:56 pm
by tjo7777
I know this is probably a stupid question, but I'm kinda struggling...

Code looks like this:

Code: Select all

on MouseUp
   local tLineNumber
   put 1 into tLineNumber
   put 1 into NewListNumber
   
   repeat for each line tLine in field "PlayerList"
   put line tLineNumber of field "PlayerList" into playerlistline
   get matchText(playerlistline,"name player=\"(.*.)\" ",sc1) 
   if matchText is true then
   put sc1 into line NewListNumber of field "TestField"
   add 1 to tLineNumber
   add 1 to NewListNumber
   end if
   end repeat
end MouseUp
The matchText works as expected. The problem seems to be in the "if matchText is true then" line. I get the error message " compilation error at line 12 (Function: missing '('), char 7"

I am trying to have sc1 put into a line of TestField ONLY IF matchText is true. Right now if I remove the if/then statement it creates a blank line in TestField when there is no match.

Really I just need to know how to tell if the matchText return value is TRUE or FALSE. Feeling pretty dumb right now, just spent an hour on this and I'm sure it can't be that hard. :oops:

Thanks for any help or suggestions,

TJ.

Re: using get matchText true/false return...

Posted: Tue Feb 24, 2015 9:59 pm
by Simon
Hi TJ.,
"Get" puts the stuff into the "it' variable.

Simon

Re: using get matchText true/false return...

Posted: Tue Feb 24, 2015 10:28 pm
by tjo7777
Hi Simon,

Thanks for your reply. I think I got it now.

Thanks so much for taking the time to reply. God only knows how long I would have searched on my own before finding the it variable. Having an off brain day, lol.

TJ. :D

Re: using get matchText true/false return...

Posted: Tue Feb 24, 2015 10:36 pm
by Simon
Hi TJ,
Glad I could help. :)
People seem to really like the "get" method but I prefer the "put" way.

Code: Select all

put matchText("Goodbye","bye") into tVar
answer tVar
Now the way you have it set up (using 'it" right after getting) you'll not run into any trouble using the "it" var but understand that "it" can get updated often.

Simon