The Webclient
I've been working with the webclient more often now doing a basic razing package and trying to help some less-skilled coders get some basic attacks going on it, and I've come to the conclusion that the webclient is the right tool for the wrong job. You've created a decent webclient for people who can program while ignoring the fact that nobody who can program actually uses the webclient. The issue here is that people who can script in the webclient are more than capable of scripting in Mudlet, and so they're all doing that because Mudlet has a better UI and better features. The only people left in the webclient are the people who can't really program well, and those people are in over their head with it.
Honestly, trying to walk people without experience through this client is a goddamn nightmare, because they don't have enough of a programming foundation to understand things like "the target variable is out of the scope of this script, so you need to call client.get_variable() to bring the value of the variable into the script and then you have to assign it to a local variable, and you have to do this in every script of every alias", and javascript as a whole is a very intimidating looking language.
I mean, here's a simple script to check and see if the person who shielded is my target and set a variable if they are, while accounting for the fact that people like to target partials names:
if (args[1].toLowerCase().indexof(
String(client.get_variable('target') ).toLowerCase()) == 0 ){
client.set_variable('targetShielded','1')
}
That's incredibly ugly, as well as being a confusing mess to people who don't understand programming. I'm testing if the trigger subject is my target and the only equals is against zero? What's this "index of" crap?
I really think that the best possible change you could make to the webclient would be working less on features and more on ease of use.
- Have a preset target variable with built-in target checking functions, so that when I want to see if somebody is my target I can just do "if (isTarget(args[1])) {..." to account for partial matching.
- Built in GCMP support in a way that makes it simple to check things like isWielded(longsword)
- Documentation that doesn't completely suck. I actually gave up on trying to call functions via the "call function" trigger action because I couldn't figure out how it was passing parameters and just resorted to calling run_function() from the "execute script". Specifically, a function that works when called via run_function() would not work when called via 'call function' and I could not figure out why.
- Get Garryn or somebody to do a youtube video or a detailed tutorial explaining how you make a rebounding tracker, maybe some other basic scripts.
"On the battlefield I am a god. I love war. The steel, the smell, the corpses. I wish there were more. On the first day I drove the Northmen back alone at the ford. Alone! On the second I carried the bridge! Me! Yesterday I climbed the Heroes! I love war! I… I wish it wasn’t over."
Comments
Ideally we'd like to have basic scripting features available without having to use javascript at all (a few things, like command delaying, are already in), more should hopefully follow. We do also need better API/documentation, yes.
"On the battlefield I am a god. I love war. The steel, the smell, the corpses. I wish there were more. On the first day I drove the Northmen back alone at the ford. Alone! On the second I carried the bridge! Me! Yesterday I climbed the Heroes! I love war! I… I wish it wasn’t over."
client.set_variable('targetShielded','1')
}
"On the battlefield I am a god. I love war. The steel, the smell, the corpses. I wish there were more. On the first day I drove the Northmen back alone at the ford. Alone! On the second I carried the bridge! Me! Yesterday I climbed the Heroes! I love war! I… I wish it wasn’t over."
"On the battlefield I am a god. I love war. The steel, the smell, the corpses. I wish there were more. On the first day I drove the Northmen back alone at the ford. Alone! On the second I carried the bridge! Me! Yesterday I climbed the Heroes! I love war! I… I wish it wasn’t over."
"On the battlefield I am a god. I love war. The steel, the smell, the corpses. I wish there were more. On the first day I drove the Northmen back alone at the ford. Alone! On the second I carried the bridge! Me! Yesterday I climbed the Heroes! I love war! I… I wish it wasn’t over."
This is an error in the docs that I believe they are fixing. Send_direct is a bad method for most things until the source is corrected.
Using send over send direct is going to eliminate A LOT OF confusion for you.
i = 0;
client.send_direct("Think i " + i);
i = i + 1;
client.send_direct("Think i " + i);
i++;
client.send_direct("Think i " + i);
i = 0;
client.print("i" + i);
i = i + 1;
client.print("i" + i);
i++;
client.print("i" + i);
var j;
j = 0;
client.send_direct("Think j " + j);
j = j + 1;
client.send_direct("Think j " + j);
j++;
client.send_direct("Think j " + j);
j = 0;
client.print("j" + j);
j = j + 1;
client.print("j" + j);
j++;
client.print("j" + j);
var potato;
potato = 0;
client.send_direct("Think potato " + potato);
potato = potato + 1;
client.send_direct("Think potato " + potato);
potato++;
client.send_direct("Think potato " + potato);
potato = 0;
client.print("potato" + potato);
potato = potato + 1;
client.print("potato" + potato);
potato++;
client.print("potato" + potato);
-----------------------------------------------------------------------
i0
i1
i2
j0
j1
j2
potato0
potato1
potato2
You think: i 0.
You think: i 12.
You think: i 13.
You think: j 0.
You think: j 1.
You think: j 2.
You think: potato 0.
You think: potato 1.
You think: potato 2.
After going over it with Claudius, I did some tests and I'm pretty sure the problem is that client.send_direct() is using 'i' as an index and that my script ends up running using send_direct's i values.
var i;
for (i = 0; i < 10;i++){
client.print(i)
}
for (i = 0; i < 10;i++){
client.send_direct("think " + i)
}
---------------------------------
0
1
2
3
4
5
6
7
8
9
You think: 0.
And this:
var i;
for (i = 0; i < 10;i++){
client.print(i)
}
for (i = 0; i < 12;i++){
client.send_direct("think " + i)
}
0
1
2
3
4
5
6
7
8
9
You seem to have send more than 200 commands within a second. You probably have some runaway trigger - disabling commands for a while.
You think: 0.
You think: 10.
You think: 11.
You think: 11.
You think: 11.
You think: 11.
You think: 11.
You think: 11.
...
You think: 11.
"On the battlefield I am a god. I love war. The steel, the smell, the corpses. I wish there were more. On the first day I drove the Northmen back alone at the ford. Alone! On the second I carried the bridge! Me! Yesterday I climbed the Heroes! I love war! I… I wish it wasn’t over."
More tests:
var potato;
for (potato = 0; potato < 10;potato++){
client.print(potato)
}
for (potato = 0; potato < 12;potato++){
client.send_direct("think " + potato)
}
---------------------------------------
0
1
2
3
4
5
6
7
8
9
You think: 0.
You think: 1.
You think: 2.
You think: 3.
You think: 4.
You think: 5.
You think: 6.
You think: 7.
You think: 8.
You think: 9.
You think: 10.
You think: 11.
=======================================================
var potato;
var i = 0;
for (potato = 0; potato < 12;potato++){
client.send_direct("think " + i)
}
------------------------------------------------
You think: 0.
You think: 9.
You think: 9.
You think: 9.
You think: 9.
You think: 9.
You think: 9.
You think: 9.
You think: 9.
You think: 9.
You think: 9.
You think: 9.
"On the battlefield I am a god. I love war. The steel, the smell, the corpses. I wish there were more. On the first day I drove the Northmen back alone at the ford. Alone! On the second I carried the bridge! Me! Yesterday I climbed the Heroes! I love war! I… I wish it wasn’t over."