Page 1 of 2

Value of a counter

Posted: Wed Oct 22, 2014 11:51 pm
by Faerghail
Hi all,

What is the new method to return the value of a counter ? old one was for example : counter1:getvalue()

I would like , to test a script , to print the value of counter1

Faerghail

Re: Value of a counter

Posted: Wed Oct 22, 2014 11:57 pm
by Skuggasveinn

Code: Select all

function firetrappuzzle1()

	local count1 = firecounter_1.counter:getValue()
	local count2 = firecounter_2.counter:getValue()
	local count3 = firecounter_3.counter:getValue()

	if firecounter_1.counter:getValue() == 0 and
	firecounter_2.counter:getValue() == 1 and
	firecounter_3.counter:getValue() == 0 then

	hudPrint("firecounter_1 has "..count1.." in value")
	hudPrint("firecounter_2 has "..count2.." in value")
	hudPrint("firecounter_3 has "..count3.." in value")
	mine_door_spear_1.door:open()

	else
	mine_door_spear_1.door:close()
	hudPrint("firecounter_1 has "..count1.." in value")
	hudPrint("firecounter_2 has "..count2.." in value")
	hudPrint("firecounter_3 has "..count3.." in value")
	end
	
end

Re: Value of a counter

Posted: Thu Oct 23, 2014 12:05 am
by Faerghail
Great ,thank you for your quick answer :)

Re: Value of a counter

Posted: Thu Oct 23, 2014 5:22 am
by Mysterious
Hi. Hey Skuggs I like the coding. How would I use it with plates or levers etc.., if you don't mind thxs :)

Re: Value of a counter

Posted: Thu Oct 23, 2014 6:50 pm
by Doridion
Skuggasveinn, I seen your part 7 of your tuto, and ... wow ^^

However , in case of a countdown ( never thinked to use the " Boss bar " to give a visual indication of the time , good tip), except by the hudprint ( Given only on the left -down screen corner ) , is there any solution to display something like a stopwatch ?

For example, entering in part of the dungeon, doing some puzzles, accessing to THE object ... but ... when taking it, begins a global CD with an alert message ... before all the dungeon parts will close/explose/disrupt/etc.

Love to stress players :D

Re: Value of a counter

Posted: Thu Oct 23, 2014 8:30 pm
by SnowyOwl47
@Doridion and @Mysterious You guys have some more questions but skuggs is not here right now he might be offline any way.

first thing:

@Mysterious What you want to do is the below:

Code: Select all

lever.lever:getValue()

Code: Select all

plate.floortigger:getValue()
Now I could be wrong but that should do it!

But just remember to replace lever.lever with your levers name.lever so lever_name.lever and so on.

Second thing:

@Doridion There is nothing you can use like a stopwatch the players will see you can use hudPrints though:

Code: Select all

function time(time)
     while time == false do 
           hudPrint(time)
     end
end
function timer()
      script_entity.script.time(10)
end
Now that is kinda a blob and would need to be worked on a lot but its still something!

Re: Value of a counter

Posted: Thu Oct 23, 2014 8:49 pm
by JohnWordsworth
Assuming there is a method like the old "onDrawGui" available for the party component (or another, new, component) then having a count down timer in the corner of the screen will be trivial. :).

Re: Value of a counter

Posted: Thu Oct 23, 2014 8:56 pm
by Doridion
Thanks for your answer SnowyOwl47 ^^ I thinked about a script like that, just sad that we've not yet more informations about script and assets references :p I'll certainly script light modifications for torchs ( pulsing red for example ) and the boss count. For the message, he'll come after.

@John : Not sure ; spawning a CD centered up of the screen and seeing seconds/milliseconds growing down is stress-up, and stress is good for a quality game :D ( I completly assume to be a torturer )

Re: Value of a counter

Posted: Thu Oct 23, 2014 9:01 pm
by Mysterious
As Doridion said thxs again for the help SnowyOwl47 :) It's really good to have some help. Looking forward to more of your Scripts and other things.

Re: Value of a counter

Posted: Sat Feb 14, 2015 5:49 pm
by Halluinoid
do you have to use coding to get the counter to work?

I placed a counter with a value of 3 next to a passageway

in the passageway is a floor trigger

I connected the floor trigger to the counter

I then connected the counter with a value of 3 to the corridor door

I expected the counter to open the door after the floor trigger had sent 3 counts to the counter but no, the door remains closed :(