Hi,
so i have a urlfetch with responses a text like:
Player (998) Rank #19,792, has played 402 games with a 51% winrate, -2 streak, and 5 drops
This works fine, but now i want to translate it in german before Nightbot posts it in the chat.
So i’ve tried eval to use some javascript.
My current Try looks like this:
$(eval a=$(urlfetch https://aoe2.net/api/nightbot/rank?leaderboard_id=3&search=Player&flag=false);b = a.slice(0, a.indexOf(' Rank')).replace(' (', ' hat eine Elo von: ').replace(')', '.'); c = a.slice(a.indexOf(', has played')+13, a.indexOf(' games ')); d = a.slice(a.indexOf(' with a ')+8, a.indexOf('%')); e = a.slice(a.indexOf('winrate, ')+9, a.indexOf(' streak,')); b = b + ' Gespielte Spiele: ' + c + '. Die Siegrate beträgt: ' + d + '%.' + ' Die aktuelle Serie ist ' + e + '.';b)
But it just writes “Unexpected identifier” to the chat.
I want following Javascript code inside the eval.
- a is the result of the urlfetch.
- b is the variable i want nightbot to post inside the chat
Javascript version i want inside eval:
a = $(urlfetch https://aoe2.net/api/nightbot/rank?leaderboard_id=3&search=Player&flag=false);
b = a.slice(0, a.indexOf(' Rank')).replace(' (', ' hat eine Elo von: ').replace(')', '.');
c = a.slice(a.indexOf(', has played')+13, a.indexOf(' games '));
d = a.slice(a.indexOf(' with a ')+8, a.indexOf('%'));
e = a.slice(a.indexOf('winrate, ')+9, a.indexOf(' streak,'));
b = b + ' Gespielte Spiele: ' + c + '. Die Siegrate beträgt: ' + d + '%.' + ' Die aktuelle Serie ist ' + e + '.';
Can someone help me please?