Jump to content
UBot Underground

Javascript Add To File


Recommended Posts

Hello,

I need some help, function below opens an alert with some numbers, but ubot not support alert, so...I want to add the result in a %variable, can do that?
Probably should be replaced "alert" with another function..

Thank you!

javascript:var coords=[];for(x=0;x<TWMap.size[1];x++)for(y=0;y<TWMap.size[0];y++){coord=TWMap.map.coordByPixel(TWMap.map.pos[0]+TWMap.tileSize[0]*y,TWMap.map.pos[1]+TWMap.tileSize[1]*x);if(coord)if(village=TWMap.villages[coord.join("")])if(village.owner==="0")coords.push(coord.join("|" ))}alert(coords.join(' '));void 0
Edited by unurohack
Link to post
Share on other sites

So, i solve the problem with alert, i add document.write, but i need add this result in list.

javascript:var coords=[];for(x=0;x<TWMap.size[1];x++)for(y=0;y<TWMap.size[0];y++){coord=TWMap.map.coordByPixel(TWMap.map.pos[0]+TWMap.tileSize[0]*y,TWMap.map.pos[1]+TWMap.tileSize[1]*x);if(coord)if(village=TWMap.villages[coord.join("")])if(village.owner==="0")coords.push(coord.join("|" ))}document.write(coords.join(' '));void 0
Edited by unurohack
Link to post
Share on other sites

instead of document.write

use eval

 

put that entire expression in a @Run JavaScript command

then after that

 

eval ,maybe something like 'coords' or 'JSON.stringify(cords)'

 

add item to list(%items,$eval("insert here"),"Don\'t Delete","Global")

Link to post
Share on other sites

sample javascript alert by $eval command

alert($eval("var x = \'hi\';
x;"))
set(#Message,"Hi","Global")
alert($eval("var x = \'{#Message}\';
x;"))

 

Link to post
Share on other sites
  • 4 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...