mobileSensorAvailable ("location")
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Re: mobileSensorAvailable ("location")
Ok then, I'll bite... When does tMessage get populated ?
Re: mobileSensorAvailable ("location")
Incoming message:
Outgoing message:
Data is there because that's what was in the LC lesson about sockets and servers, I changed as little as possible from the official code.
Code: Select all
on chatReceived s,data
put data into tMessage
put item 1 of data into tMessageType
switch tMessageType
case LOCA
#etc.
Code: Select all
on chatMessage data
if lMobileLoc is true then
set the backgroundcolor of button "Location" to green
set the label of button "Location" to uMyLocation
write "LOCA" && uMyLocation & return & field "NameField" & ":" && data to socket lChatSocket
end if
end chatMessage
Re: mobileSensorAvailable ("location")
Ah, OK... I'll bow out here as I have not ever looked at this 'lesson'... and don't have the time to go through it...
Re: mobileSensorAvailable ("location")
For reference should anyone else come across this thread:
http://lessons.livecode.com/m/4071/l/12 ... ng-sockets for conceptual stuff, and then the base code (including 'data') is one of the examples available from inside the IDE.
It works in every other regard. It's just that one line of code that's screwing with me. Why, gods of code, why?
http://lessons.livecode.com/m/4071/l/12 ... ng-sockets for conceptual stuff, and then the base code (including 'data') is one of the examples available from inside the IDE.
It works in every other regard. It's just that one line of code that's screwing with me. Why, gods of code, why?
Re: mobileSensorAvailable ("location")
For the sake of argument, I swapped all instances of 'data' out for 'tMessage'.
Same error, no change. Though I guess the code is slightly tidier for it, which never hurts.
Same error, no change. Though I guess the code is slightly tidier for it, which never hurts.
Re: mobileSensorAvailable ("location")
Gonna try making it more complicated, seeing if that works. I'll swap out a simple 'put line 2 of tMessage' for changing a variable and then posting the message based on that variable, and if that doesn't work, setting up a whole new command to function when the miles < 2. It's a roundabout way of doing things, but I haven't tried it yet.
Re: mobileSensorAvailable ("location")
Dixie got it, my mind skipped right over the error because not only does it read right, but "and" is also a valid keyword. But it's only valid for evaluations, if you need concatenation you must use "&" . The engine is evaluating a phrase that doesn't produce a valid boolean result and returning "false" .Dixie wrote:Use '&' instead of 'and'
What you want is:
put line 2 of tMessage & return after field "displayMessage"
Aside: since "return" also has multiple uses, I always use the constant "cr" for carriage returns. I might have noticed the problem sooner if it had been written (incorrectly) as:
put line 2 of tMessage and cr after field "displayMessage"
Glad you stuck with this.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: mobileSensorAvailable ("location")
Oh good lord.
My heartfelt apologies to Dixie, I missed that small change when you posted it.
Of course, of course it has fixed everything. Bloody hell, I rewrote the entire loop EXCEPT for the one line that was wrong
Thank you both so much for this, it FINALLY works as planned and I can move on to the account system and settings card.
BEAUTIFUL.
My heartfelt apologies to Dixie, I missed that small change when you posted it.
Of course, of course it has fixed everything. Bloody hell, I rewrote the entire loop EXCEPT for the one line that was wrong

Thank you both so much for this, it FINALLY works as planned and I can move on to the account system and settings card.
BEAUTIFUL.
Re: mobileSensorAvailable ("location")
Great! Don't beat yourself up too much. LC reads so naturally that your brain just doesn't always process these little syntax distinctions. And I think we can all relate to the frustration. You were a trooper.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com