Skip to content

preconfig

mithrendal edited this page Nov 11, 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.

lets have a look at this example (key w is remapped to space)

https://vc64web.github.io/#{"openROMS":true,"buttons":[{"position":"bottom:0vh;left:0vw","title":"[w]eapon","key":"w","script":"action('Space')"}]}

lets have a look at this example (key a is remapped to b, button is not visible)

https://vc64web.github.io/#{"openROMS":true,"buttons":[{"key":"a","lang":"actionscript","script":"'HELLO'"}]}

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://vc64web.github.io/#{"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.

the above example becomes this.

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

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.

run a more complex background script which interacts with the C64 hardware via peek and pokes accompanied with two visual action buttons for "next rss item" and "refresh latest rss content".

C64 rss reader on german forum64.de website

Clone this wiki locally