View unanswered posts | View active topics It is currently 23 Jan 2018 13:42

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.



Reply to topic  [ 21 posts ]  Go to page Previous  1, 2, 3  Next
Marking in colour one word 
Author Message
Site Admin
User avatar

Joined: 04 Mar 2010 01:14
Posts: 270
Hmm, I guess triggers which only highlight should be exempt from the loop detection somehow.
I'll see if I can improve it.

For now I'd recommend Alisas approach.


21 Nov 2015 15:30
Profile
Wizard
User avatar

Joined: 28 Sep 2015 16:42
Posts: 45
cotillion wrote:
Hmm, I guess triggers which only highlight should be exempt from the loop detection somehow.
I'll see if I can improve it.

For now I'd recommend Alisas approach.


Agree that Alisas approach is better for highlighting.

I currently only use the catch all trigger (.*) when checking for no obvious exits to display the mobile key pad. (viewtopic.php?f=37&t=3307). It currently disables itself when I quick walk.

Possibly a checkbox to exclude the trigger from the check could be added?


22 Nov 2015 02:16
Profile
Wizard

Joined: 13 Sep 2013 16:58
Posts: 14
As for the disabling of triggers, I use this to go around it. An alias I activate when I awaken.

function ListRegex(regex, str) {
if (! regex.global) {
throw new Error('Please set flag /g of regex');
}
return (str.match(regex) || []);
}
function escapeRegExp(str) {
return str.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1");
}
function replaceAll(str, find, replace) {
return str.replace(new RegExp(escapeRegExp(find), 'g'), replace);
}
function uniq(a) {
var seen = new Set();
return a.filter(function(x) {
return !seen.has(x) && seen.add(x);
});
}
function colors(str) {
var ColorList = [
["darkmagenta", "you", "You"],
["red",
// Health
"at death's door", "barely alive", "terribly hurt",
"in a very bad shape", "in agony", "in a bad shape",
"very hurt", "suffering", "hurt", "aching", "somewhat hurt",
"slightly hurt", "sore", "feeling well", "feeling very well",
// Low Durability
"a little worn down"],

["lime",
// High Durability
"in prime condition", "in a fine condition"],
["aqua",
// Progress
"a tiny amount of progress", "minimal progress",
"slight progress", "low progress", "a little progress",
"some progress", "modest progress", "decent progress",
"nice progress", "good progress", "very good progress",
"major progress", "great progress", "extremely good progress",
"awesome progress", "immense progress", "tremendous progress",
"fantastic progress"
],

["white",
// Names
gwc.gmcp.data.character.status.name,
// Equipment
"sturdy black greaves", "sturdy black bracers", "black platemail",
// Directions
//"north", "west", "east", "south", "up", "down"
],

//["ADDCOLOR",""]
];

for (k = 0; k < ColorList.length; k++) {
var regex = new RegExp(ColorList[k].slice(1).join('|'), 'g');
var matches = uniq(ListRegex(regex,str));
for (l = 0; l < matches.length; l++) {
str = replaceAll(str, matches[l], matches[l].fontcolor(ColorList[k][0]));
}
}
return str;
}
// Triggers
function actions(str) {
}
// Triggers END

var delay = 15;
var last = document.getElementsByClassName("line hanging-indent").length;
var timer = setTimeout(function check() {
var current = document.getElementsByClassName("line hanging-indent").length;
if (current != last) {
if (last>current) {last=current;}
for (last; last < current; last++)
{
var str = document.getElementsByClassName("line hanging-indent")[last].innerHTML;
actions(str);
document.getElementsByClassName("line hanging-indent")[last].innerHTML=colors(str);
}
}
setTimeout(check, delay);
}, delay);

$("#mudoutput").css("color","green");
gwc.output.append("Your settings have been updated!");


21 Dec 2015 01:27
Profile
Wizard

Joined: 13 Sep 2013 16:58
Posts: 14
Has anyone solved how to change keybindings on numpad in portal? I attempted something along these lines, but failed miserably.. Works if you want to bind some other keys though..

$(document).keydown(function(e) {
switch(e.which) {
case 109:
gwc.output.append("testing");
break;

default: return;
}
e.preventDefault();
});


21 Dec 2015 01:30
Profile
Site Admin
User avatar

Joined: 04 Mar 2010 01:14
Posts: 270
Carnak wrote:
Has anyone solved how to change keybindings on numpad in portal? I attempted something along these lines, but failed miserably.. Works if you want to bind some other keys though..

$(document).keydown(function(e) {
switch(e.which) {
case 109:
gwc.output.append("testing");
break;

default: return;
}
e.preventDefault();
});

You can do this by modifying the global keyMap object.
But that's subject to change in the future.


09 Jan 2016 15:41
Profile
Wanderer
User avatar

Joined: 06 Apr 2014 07:40
Posts: 71
Cotillion, could you please fix the issue with line breaks causing triggers to not fire or fire for only part of a given statement? If the word was long and at the end of a line, it could cause the word to not highlight correctly. Have the server send the complete strings and have the client do the linebreaking while keeping them in their own cubbied paragraphs so they can be used in the same way still.

_________________
Args Explained - Adv. Trigger Manip - Adding Audio


16 Jan 2016 07:11
Profile WWW
Site Admin
User avatar

Joined: 04 Mar 2010 01:14
Posts: 270
Vlek wrote:
Cotillion, could you please fix the issue with line breaks causing triggers to not fire or fire for only part of a given statement? If the word was long and at the end of a line, it could cause the word to not highlight correctly. Have the server send the complete strings and have the client do the linebreaking while keeping them in their own cubbied paragraphs so they can be used in the same way still.

This should not be happening with 'options screenwidth off' set.
It's supposed to be off by default for GWC users.


16 Jan 2016 11:55
Profile
Wanderer
User avatar

Joined: 06 Apr 2014 07:40
Posts: 71
cotillion wrote:
This should not be happening with 'options screenwidth off' set.


Bah, you're right! That looks like it did the trick. That's really weird though. Even if it's set to a specific number, that shouldn't separate them into different paragraphs and cause them to not highlight or work correctly. For instance, the obvious exits that get cut off at the end will not be clickable to travel in that direction. Also, I don't think it's off by default. I'm pretty sure it's preset to like 80.

I had made a bug report about this issue and you said that highlighting would have to be reworked. I'll update that there's a workaround.

_________________
Args Explained - Adv. Trigger Manip - Adding Audio


17 Jan 2016 02:22
Profile WWW
Adept
User avatar

Joined: 23 Jan 2016 08:28
Posts: 133
Location: Bree
Minor necro, but with the hilight issue I think it's worthwhile to add some kind of exemption or else just a special trigger because it would allow the user to store a map of keywords and colors/background-colors that could be modified from the command line.

For example, I could make an alias so that I could issue the command:

hilite apple red

which would add the key 'apple' to the map and associate it with the color red, until I decided to remove it later with another command.

Alternatively, if we could have programmatic access to the scripts themselves we could use the mentioned method and just make aliases that would alter the trigger value.


06 Mar 2016 03:54
Profile
Wanderer
User avatar

Joined: 06 Apr 2014 07:40
Posts: 71
Mayobe wrote:
I think it's worthwhile to add some kind of exemption or else just a special trigger because it would allow the user to store a map of keywords and colors/background-colors that could be modified from the command line.


That's already thoroughly doable. I have that setup right now. You're basically capturing everything, checking whether there's a word in your special highlight list, and then highlighting it based on the saved color value that you gave when you created the highlight rule using a console command. I'd strongly encourage, if you do go this route, to try to put as much cool stuff into the one all-capturing trigger as possible. It doesn't exactly play fair with other triggers.

Mayobe wrote:
Alternatively, if we could have programmatic access to the scripts themselves we could use the mentioned method and just make aliases that would alter the trigger value.


You do understand that you're using a webclient where, quite literally, everything is available to you. If you really wanted, you could plunge headfirst into https://genesismud.org/play/gwc.min.db935731c9d2118f.js and try to pull out the necessary functions to do whatever it is you want. HOWEVER, the normal shmuck that just wants red "apples" isn't going to go through the trouble. Plus, even if you were able to figure something out, that's not to say cotillion won't make a change a week later that thoroughly breaks your code. I've been down that road, it's only worth it if hacking webclients is the fun for you, not necessarily the game.

_________________
Args Explained - Adv. Trigger Manip - Adding Audio


08 Mar 2016 03:55
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 21 posts ]  Go to page Previous  1, 2, 3  Next

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software.