Tick Trigger
Moderator: Eowul
Forum rules
- Use common sense and be respectful towards each other at all times, even when disagreeing.
- Do not reveal sensitive game information. Guild secrets, player seconds are examples of things not allowed.
- Use common sense and be respectful towards each other at all times, even when disagreeing.
- Do not reveal sensitive game information. Guild secrets, player seconds are examples of things not allowed.
Tick Trigger
Hello all. I am clueless in the language of Java, so I need help. How would I make a tick trigger?
What would you put in the pattern?
Also, how big is the number for one second?
What would you put in the pattern?
Also, how big is the number for one second?
Alea iacta est. Serius regredi est.
Re: Tick Trigger
JS and Java are 110% separate animals. (http://stackoverflow.com/questions/2450 ... t-and-java)
Triggers in the web client cannot be set to fire on a timer (yet) without some serious fiddling around.
JS is very easy to learn as far as languages go. The W3 tutorials should be enough to get you started.
http://www.w3schools.com/js/
Note that this is a very widely used language, so it's worth picking up a bit in any case. I think someone linked you the gwc thread in your other question, which discusses the unique functionality of the Genesis web client.
What is it that you want to use a timer for? There may be a different approach that would be less work.
Triggers in the web client cannot be set to fire on a timer (yet) without some serious fiddling around.
JS is very easy to learn as far as languages go. The W3 tutorials should be enough to get you started.
http://www.w3schools.com/js/
Note that this is a very widely used language, so it's worth picking up a bit in any case. I think someone linked you the gwc thread in your other question, which discusses the unique functionality of the Genesis web client.
What is it that you want to use a timer for? There may be a different approach that would be less work.
Re: Tick Trigger
You can easily create tick triggers.
Just create a trigger on something like 'Welcome to Genesis' to start it.
https://www.genesismud.org/forums/viewt ... ick#p22245
Just create a trigger on something like 'Welcome to Genesis' to start it.
https://www.genesismud.org/forums/viewt ... ick#p22245
Re: Tick Trigger
Oh, yeah, I found that. But, my question is, how many ticks in one second? My guess was something like 1000?
Alea iacta est. Serius regredi est.
Re: Tick Trigger
Tick is measured in milliseconds, so yes 1000 is once per second.
This will eat an herb every 5 seconds.
It may actually need something to initially set it off, though.. I've not experimented with JS in Genesis, but that would call "eatHerb" once per five seconds if this were web-design..
Attached is a clock I designed with JS.. It relies heavily on the ability to tick. Uncompress and open the "clockRun" HTML file in your browser.. Or in Notepad if you want to see the skeleton code.
EDIT: 5 seconds, not 5000..
Code: Select all
setInterval(eatHerb,5000);
function eatHerb() {
gwc.connection.send("eat herb");
}
It may actually need something to initially set it off, though.. I've not experimented with JS in Genesis, but that would call "eatHerb" once per five seconds if this were web-design..
Attached is a clock I designed with JS.. It relies heavily on the ability to tick. Uncompress and open the "clockRun" HTML file in your browser.. Or in Notepad if you want to see the skeleton code.
EDIT: 5 seconds, not 5000..
- Attachments
-
- G Clock - Cmprssd.zip
- (21.64 KiB) Downloaded 208 times
Last edited by Melarec on 12 Apr 2016 21:58, edited 1 time in total.
Re: Tick Trigger
Ahh, okay. I think I have this down pretty well.
Is there a simple way to color just one word, not the whole line?
Is there a simple way to color just one word, not the whole line?
Alea iacta est. Serius regredi est.
Re: Tick Trigger
Oh? I didn't know there was a callback timer like that. Will the functions persist outside the script execution?
Sort of complicated text coloring script:
Less complicated:
Sort of complicated text coloring script:
Code: Select all
Trigger (regex): (words|or phrases|that|I'm watching|for)
gwc.output.replace(RegExp(args[1], 'g'), '<span style="background-color: red; color: lime;">'+args[1]+'</span>', true);
Code: Select all
Trigger (plain): orc
gwc.output.replace(/(\s(orcs|orc)[\s|\.|,])/gi, '<span style="color: darkseagreen">$1</span>', true);
Re: Tick Trigger
Just a quick note..
Don't set a trigger's pattern to " " . (The blank space between words)
I seriously bogged down my client..
Don't set a trigger's pattern to " " . (The blank space between words)
I seriously bogged down my client..
http://tworzymyatmosfere.pl/przescieradla-jedwabne-z-gumka/