-
-
Notifications
You must be signed in to change notification settings - Fork 10
javascript
mithrendal edited this page Mar 28, 2021
·
19 revisions
pure javascript can be used for more complex control ...
function sprite_xpos(0..7) //returns the current x-position of the selected sprite... function sprite_ypos(0..7) //returns the current x-position of the selected sprite... function not_stopped(this_id) //returns whether a the user asked the script to stop ... //set_port_owner gives exclusive control of the port so that signals do not mix
function set_port_owner(1..2,PORT_ACCESSOR.MANUAL or PORT_ACCESSOR.BOT); returns previous port owner//repeats action until action button is pressed again
while(not_stopped(this_id))
{
//do some action
await action("A=>500ms"); // presses Keyboard 'A' and waits 500ms
}var x=sprite_xpos(1);
var y=sprite_ypos(1);
while(not_stopped(this_id))
{
console.log('------'+x + ' '+sprite_xpos(1));
await my_move_strategy1(1);
await my_aim_and_shoot(1);
console.log('------'+x + ' '+sprite_xpos(1));
}
async function my_move_strategy1(port)
{
await action("j"+port+"right1=>850ms");
await action("j"+port+"right0=>800ms");
await action("j"+port+"left1=>450ms");
await action("j"+port+"left0=>800ms");
}
async function my_aim_and_shoot(port)
{
await action("j"+port+"fire1=>j"+port+"left1");
await action("300ms");
await action("j"+port+"left0=>j"+port+"fire0");
}
alert('finished the script');- simple hashtag preconfiguration
- preconfig with JSON notation
- using direct start links for sharing on social media
- preconfig of scripts and buttons
- scripting support for simple tasks
- scripting support for complex tasks like programming a game specific AI
lightweight integration into your own webpage (with only a few lines of code)
- using the web player for embedding and controlling vc64web inside another webpage
- preloading the web player with specific system roms
- send scripts into the emulator via the webplayer
- customizing the icon bar at the bottom of the webplayer
- how to preload original system roms and autostart a .d64 title
create a standalone package which contain all files to run your C64 program