Page 1 of 1

local tCurrentValue

Posted: Thu Aug 04, 2016 9:59 am
by dimen426GA1Hmj
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.

Re: local tCurrentValue

Posted: Thu Aug 04, 2016 5:51 pm
by jacque
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.

Re: local tCurrentValue

Posted: Wed Feb 13, 2019 6:31 pm
by FourthWorld
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.

Re: local tCurrentValue

Posted: Tue Mar 26, 2019 9:14 pm
by smithclarkson001
If you will ever try to run it with explicit variables it work work , it fails big time !!! :(

Re: local tCurrentValue

Posted: Tue Mar 26, 2019 10:03 pm
by SparkOut
This thread was necromanced by a spammer, three posts above this one.

Re: local tCurrentValue

Posted: Wed Mar 27, 2019 2:14 am
by FourthWorld
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?

Re: local tCurrentValue

Posted: Wed Mar 27, 2019 8:30 am
by SparkOut
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.

Re: local tCurrentValue

Posted: Wed Mar 27, 2019 10:49 am
by Klaus
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. :(

Re: local tCurrentValue

Posted: Wed Mar 27, 2019 12:56 pm
by bogs
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.