Page 1 of 1

Counting trigger

Posted: 11 May 2017 22:14
by Kwevin
WHat would need to be in a trigger to count stuff? With my limited coding experience, it would have to have a counter in it, right? x=x+1? And how would you get it to input that number after each count? How would you get it to not redefine with each pattern appearance?

Re: Counting trigger

Posted: 11 May 2017 23:09
by Melarec
I was going to help, but as I began, I realized I haven't coded at all in 2 (more?) years and my pathetic attempt at a simple counter has left me ashamed.
If anyone can fix this..:

Code: Select all

<!DOCTYPE html>
<html>
  <body>
    <canvas id="counterCanvas" width="400" height="200"
     style="border:1px solid #c3c3c3; background-color: lightGrey;">
      Sadly, your browser does not support the canvas element.
    </canvas>
  <script>
    var canvas = document.getElementById("counterCanvas");
    var ctx = canvas.getContext("2d");
    var height = canvas.height*0.8;
    var wide = canvas.width*0.8;
    setInterval(tick,10000);
    var counter = 0;
     function tick(counter) {
       counter = counter + 1;
       if (counter == 6) {
         ctx.font = height*0.5 + "px Helvetica Neue";
         ctx.fillStyle="green";
         ctx.fillText("One minute has passed!",20,height/2);
         counter = 0;
       }
     }
  </script>
  </body>
</html>
It might help. But not inside Genesis.
Similar to what you're looking for, though?
This leaves me wondering how I ever managed to make a functional clock in JS..

Re: Counting trigger

Posted: 12 May 2017 10:44
by Tarax the Terrible
Don't think they want a timed counter. Instead an event counter.

Eowul posted the script for smiths counting items forged. In the client section. Everything u need to adapt that for whatever should be there

Re: Counting trigger

Posted: 12 May 2017 10:49
by Tarax the Terrible
Tarax the Terrible wrote:Don't think they want a timed counter. Instead an event counter.

Eowul posted the script for smiths counting items forged. In the client section. Everything u need to adapt that for whatever should be there
Here https://www.genesismud.org/forums/viewt ... =37&t=2257

Re: Counting trigger

Posted: 12 May 2017 15:19
by Kwevin
Sweet mother of God, yes! Exactly what I wanted! Many thanks, Tarax!

Re: Counting trigger

Posted: 12 May 2017 22:03
by Tarax the Terrible
Another satisfied customer lol *thumbup*

Re: Counting trigger

Posted: 12 May 2017 22:14
by Melarec
Tarax the Terrible wrote:
Tarax the Terrible wrote:Don't think they want a timed counter. Instead an event counter.
Eowul posted the script for smiths counting items forged. In the client section. Everything u need to adapt that for whatever should be there
Here https://www.genesismud.org/forums/viewt ... =37&t=2257
Oh my, this is lovely. Yes, I'm not sure what I was thinking before..

Re: Counting trigger

Posted: 12 May 2017 22:17
by Tarax the Terrible
Those guys really know their stuff. Would like to see some screenshots of heavily customised game clients to illustrate what is possible.