local tCurrentValue

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller

Post Reply
dimen426GA1Hmj
Posts: 16
Joined: Thu Dec 08, 2011 12:20 pm

local tCurrentValue

Post by dimen426GA1Hmj » Thu Aug 04, 2016 9:59 am

I tried removing the line in the percentPressed command script “local tCurrentValue” and the program executed just fine. My question is, was this line added as part of “good programming practice” or is there some practical reason for adding this code. For a newbie all I see is one additional line of code which I can do away with, making the code more efficient...or is it? When would you recommend adding the local variable and when would you not have to. Why would it make sense to add this to this particular script and this particular app now that I don't see any difference in the result.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4943
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: local tCurrentValue

Post by jacque » Thu Aug 04, 2016 5:51 pm

It's required if you are running with explicit variables turned on, which helps catch some typos in scripts. In some circles it's considered good programming practice as well, especially by those coming from other languages where it's required. I never debug with explicit variables so I don't include the declarations. It's mostly a matter of personal preference though it has been known to cause religious wars occasionally.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6590
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: local tCurrentValue

Post by FourthWorld » Wed Feb 13, 2019 6:31 pm

The only difference would be if the declaration is outside of a handler or inside. Outside is needed if you want the variable to be available to all handlers within the script. Inside is not necessary, used by some scripters for clarity.
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

smithclarkson001
Posts: 1
Joined: Tue Mar 26, 2019 9:10 pm
Contact:

Re: local tCurrentValue

Post by smithclarkson001 » Tue Mar 26, 2019 9:14 pm

If you will ever try to run it with explicit variables it work work , it fails big time !!! :(

SparkOut
Posts: 1918
Joined: Sun Sep 23, 2007 4:58 pm

Re: local tCurrentValue

Post by SparkOut » Tue Mar 26, 2019 10:03 pm

This thread was necromanced by a spammer, three posts above this one.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6590
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: local tCurrentValue

Post by FourthWorld » Wed Mar 27, 2019 2:14 am

SparkOut wrote:
Tue Mar 26, 2019 10:03 pm
This thread was necromanced by a spammer, three posts above this one.
Necromanced, yes. (And thank you for noting that. When I bring it up people just yell at me.)

But "spammer"? What is being spammed? No links in his sig, no links in the post, the post appears on-topic, and it contains apparently-unique content.

Admittedly, sometimes spammers are smarter than me. What am I missing?
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

SparkOut
Posts: 1918
Joined: Sun Sep 23, 2007 4:58 pm

Re: local tCurrentValue

Post by SparkOut » Wed Mar 27, 2019 8:30 am

Gone now, but he had come back and edited, with a link to one of those compressed urls. It definitely showed as a link (maybe two, maybe broken) on my phone, and when I was replying in this thread, the previous message list showed some mangled code for that.

Klaus
Posts: 10908
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: local tCurrentValue

Post by Klaus » Wed Mar 27, 2019 10:49 am

I deleted the user yesterday and yes, he had two working links in his posting.
Obviously it is too hard to prevent this from users with postings < 10.
I asked Heather a couple of times and she tried what she could, but with very few success obviously. :(

bogs
Posts: 3264
Joined: Sat Feb 25, 2017 10:45 pm

Re: local tCurrentValue

Post by bogs » Wed Mar 27, 2019 12:56 pm

FourthWorld wrote:
Wed Mar 27, 2019 2:14 am
SparkOut wrote:
Tue Mar 26, 2019 10:03 pm
This thread was necromanced by a spammer, three posts above this one.
Necromanced, yes. (And thank you for noting that. When I bring it up people just yell at me.)

But "spammer"? What is being spammed? No links in his sig, no links in the post, the post appears on-topic, and it contains apparently-unique content.

Admittedly, sometimes spammers are smarter than me. What am I missing?
I don't think I ever yelled at you, but I do play a lot of D2, so Necros are good things imwv(in my world view) :wink:

Spammers and bots are a fun discussion. Some are obvious, some not so much. smithclarkson up there might fall under 'bot' status.

If your writing a bot for spamming forums, you generally want the bot 'accepted' for the first several posts as real, usually in testing. That is why you often see the 'catch phrases' clipping, where they skim the boards, pick up already posted lines from other real authors, and then try to put it into what 'looks' like a legitimate post.

Done well, it is a neat trick, one I wish I knew enough to figure out myself.

The 'brute force' ones are much easier to spot of course, they just get the account and blast as many posts as they can.
No links in his sig, no links in the post, the post appears on-topic, and it contains apparently-unique content.
You can emulate this yourself in a few minutes, there is even a lesson on a similar topic about combining text strings. Instead of an insult generator, you put in tech / programming terms, and you get what was in the post SparkOut mentioned.
Image

Post Reply

Return to “Calculator”