Page 1 of 1

Paths and multi-pattern triggers

Posted: 25 Sep 2014 18:16
by Cherek
Anyone know how to create these with the client?

Apparently Yanus has decided to for some reason remove all his information he provided previous in this thread, replacing all his posts with ".". And Eowul is also currently inactive.

I am doing a small guide on how to use the client for the new and improved webpage, and this is two things that would be good to include I think.

With multi-pattern triggers I mean for example having ONE single coloring trigger that fires on both "obvious exits" and "obvious exit", and similar, instead of having to do multiple triggers.

Re: Paths and multi-pattern triggers

Posted: 26 Sep 2014 12:05
by Keltar
Cherek wrote:Anyone know how to create these with the client?

With multi-pattern triggers I mean for example having ONE single coloring trigger that fires on both "obvious exits" and "obvious exit", and similar, instead of having to do multiple triggers.
example multi-pattern:
trigger
type regexp
pattern: obvious (?:exit|exits)
script: gwc.output.color("green");
select javascript
save

example path:
alias
pattern: <alias name of your choice>
script:
var path = ['e','s','s','n','n','w', 'enter', 'out'];

path.forEach(function(step) {
gwc.connection.send(step);
});

select javascript below the script textbox
save

Re: Paths and multi-pattern triggers

Posted: 26 Sep 2014 13:36
by Cherek
Thank you Keltar! And thank you again for the other stuff you sent me previously!

Re: Paths and multi-pattern triggers

Posted: 27 Sep 2014 00:09
by Cherek
How about reversing a path? Doable, or do you have to type it in manually in reverse?

Re: Paths and multi-pattern triggers

Posted: 27 Sep 2014 18:22
by Keltar
Cherek wrote:How about reversing a path? Doable, or do you have to type it in manually in reverse?
Sure it's doable, I will put it together and post here

Re: Paths and multi-pattern triggers

Posted: 27 Sep 2014 20:24
by Cherek
Keltar wrote:
Cherek wrote:How about reversing a path? Doable, or do you have to type it in manually in reverse?
Sure it's doable, I will put it together and post here
Great! Thanks.

Re: Paths and multi-pattern triggers

Posted: 27 Sep 2014 22:35
by Keltar
Cherek wrote:How about reversing a path? Doable, or do you have to type it in manually in reverse?
alias, note that alias name is the same as the path name, not necessary but helps
pattern: path1
script:
var p = gwc.userdata.paths;
p.go(p.path1);

select javascript
save

alias to reverse the path
pattern: path1back
script:
var p = gwc.userdata.paths;
p.go_back(p.path1);

select javascript
save

alias so that paths are refreshed when you run the alias, you can add as many paths as you like, path1 and path2 are added already:
Pattern: <whatever you like>
script:
gwc.userdata.paths = {

path1:['e','s','s'],
path2:['e','e','d','d'],

reverse : {
'n':'s', 's':'n', 'e':'w', 'w':'e',
'nw':'se', 'ne':'sw', 'sw':'ne', 'se':'nw',
'u':'d', 'd':'u', 'in':'out', 'out':'in'
},

go:function(path) {
path.forEach(function(step) {
gwc.connection.send(step);
});
},
go_back:function(path) {
path.reverse();
path.forEach(function(step) {
step = gwc.userdata.paths.reverse[step];
gwc.connection.send(step);
});
}
};

select javascript
save

Re: Paths and multi-pattern triggers

Posted: 29 Sep 2014 04:07
by Cherek
Great work Keltar. Very useful!