Author Topic: Multi-clicking a brick?  (Read 1166 times)

How would I make it so that you have to click a brick multiple times before something happens? (In a script).

I know this can be done with events, but I have something in mind if I can just figure this out.

How would I make it so that you have to click a brick multiple times before something happens? (In a script).

I know this can be done with events, but I have something in mind if I can just figure this out.

You could look at the guys event code and adapt it as pure code... Eventing only makes the code work within an event, you know.

Code: [Select]
function fxDTSBrick::onActivate(%this, %obj, %client, %pos, %rot)
{
%this.activatedByObj[%obj.getID()]++;
%this.activatedByClient[%client.getID()]++;

echo("Brick #" @ %this.getID() SPC "has been clicked by this player" SPC %this.activatedByObj[%obj.getID()] SPC
"and this client" SPC %this.activatedByClient[%client.getID()] SPC "times.");

return parent::onActivate(%this, %obj, %client, %pos, %rot);
}

This will tally how many times a player and client have clicked a brick. If there's any syntax errors I need to iron out that you can't resolve, just post.

You could look at the guys event code and adapt it as pure code... Eventing only makes the code work within an event, you know.
Please don't ever post in coding help again.

-helpsnip-

Thanks a ton. I'll start looking at this trying to get it to work right away.

EDIT:

When it says:
Code: [Select]
echo("Brick #" @ %this.getID() SPC "has been clicked by this player" SPC %this.activatedByObj[%obj.getID()] SPC

Would it say "Has been clicked by this player"? Or is it just checking if it "has been clicked by this player"?

Sorry, I'm still kind of new to scripting.
« Last Edit: March 08, 2011, 01:27:03 AM by slimabob »

Please don't ever post in coding help again.

Where the hell did that come from? He said he wanted things to happen only after a certain amount of clicks, and mentioned he knows there are events that do it. So I suggested examining that code. The code you provided doesn't even work the way he wants. That's just a click counter, without resets or any help on how to do that.

Seriously though, and I'm asking this seriously, where the hell did that come from?

I suggested examining that code.

Sorry, you kind of lost me when you said to "examine the code". Isn't that what I am trying to figure out?

I was thinking of onRapidActivate event. I'm pretty sure it's code would monitor clicks to know it's being hit rapidly, meaning more than once.

Edit: If I'm understanding the code correctly...:

Code: [Select]
%player.activatelevel
There's already an activation counter...[/s]

That's probably rapidly hitting setting... I got nothing, then. I'm sorry, slimabob.
« Last Edit: March 08, 2011, 02:37:19 AM by MegaScientifical »

It's fine. I'll figure it out.

I'm trying to make it so that when you click a brick, bottom print numbers decrease and something happens when they reach 0.

It's fine. I'll figure it out.

I'm trying to make it so that when you click a brick, bottom print numbers decrease and something happens when they reach 0.

Oh that's actually easy with events, counters. Why do you want to make it pure code?

Where the hell did that come from? He said he wanted things to happen only after a certain amount of clicks, and mentioned he knows there are events that do it. So I suggested examining that code. The code you provided doesn't even work the way he wants. That's just a click counter, without resets or any help on how to do that.

Seriously though, and I'm asking this seriously, where the hell did that come from?
Your suggestion was "take the events and turn it into TorqueScript" which is like saying "take paper and make a printer."

Why do you want to make it pure code?

I'm making an extension to an existing game-mode.

Oh that's actually easy with events, counters. Why do you want to make it pure code?
Look I'm going to have to agree with Iban here... you're really not cut out for this section. This is in Coding Help not Eventing Help.
Would it say "Has been clicked by this player"? Or is it just checking if it "has been clicked by this player"?
Did you try it in-game?

Your suggestion was "take the events and turn it into TorqueScript" which is like saying "take paper and make a printer."
I think he meant, take the code he used to make OnRapidActivate, and make your own script.

No, I agree with Iban.

I've messed with a program that "spoofs"... If I understand correctly, you wanted to give public access to an ID through passing out the security information to utilize it... That is deadly.

Total nonsense.

And now 'make events into script'.

Total nonsense.

What are you talking about? It's where you steal referral stuff so the server thinks you're someone legitimate.