Skip to content

preconfig

mithrendal edited this page Mar 8, 2021 · 45 revisions

preconfiguration of scripts and action buttons

this page explains how to preconfigure action buttons or even javascripts which may run in background within the URL of vc64web.

configuration is done with a JSON-String within the URL when vc64web is called

action button examples

{"position":"bottom:0vh;left:0vw", "title":"[w]eapon", "key":"w", "script":"action('Space')"}

defines an action button in the bottom left corner, script is javascript language (default).

{"position":"top:0vh;right:0vw", "title":"[w]eapon", "key":"w", "lang":"actionscript", "script":"Space"}

defines an action button in the top right corner, script is the vc64web propriety actionscript language.

scripts without a button (background tasks)

{"run":true, "script":"$('#alert_wait').show();await action('3000ms');$('#alert_wait').hide();"}

shows a progress bar right after start and hides it after 3 seconds.

how to express json in URLs

JSON Strings go like this { "wide": true } for example expresses the property wide with the value true. For buttons and scripts there is the property { "buttons": [] } You see it is empty and buttons can be placed into the brackets. Lets do.

{ "buttons": [{"run":true,"script":"alert('hello world !')"}] }

let's try

https://dirkwhoffmann.github.io/virtualc64web/#{"openROMS":true,"buttons":[{"run":true,"script":"alert('hello%20world!')"}]}

did you notice the %20 between hello and world ? This is the url encoding for a space.

what if you have big scripts? Scripts with a lot of lines ... formatted lines ...

Well, in that case you go with the script_base64 property instead of script.

if you don't know how to encode you may just put your script into here https://www.base64encode.org/ which will convert it for you. Then copy the encoded script into the script_base64.

the above example becomes this.

https://dirkwhoffmann.github.io/virtualc64web/#{"openROMS":true,"buttons":[{"run":true,"script_base64":"YWxlcnQoJ2hlbGxvIHdvcmxkIScp"}]}

run a more complex background script which interacts with the C64 Hardware via peek and pokes

C64 rss reader on german forum64.de website

Clone this wiki locally