action_sequence_script - vc64web/virtualc64web GitHub Wiki
scripting in vc64web can be expressed in two different languages. In javascript for more complex scenarios and in action-sequence-script a script language specifically designed for the basic needs of the c64 emulation.
If you don't like to bother with this simple script language and want directly get to the real complex javascript language then you should know that you can always write action-sequence-script in javascript too.
You do can this action("...put some action script in here...")
e.g. javascript fire on joystick1 for 100ms expressed with a action-sequence-script call
action('j1fire1=>100ms=>j1fire0');
This chapter is about the simpler action-sequence-script.
simulates a keyboard press,
for example B
for drop a bomb in a game
enclosed in single quotes like 'load"$",8,1'
j<number><direction><press/release>
number = 1 or 2 direction = up, down, left, right press/release = 1/0
for example moving joystick2 right/up for one second
j2right1=>j2up1=>1000ms=>j2right0=>j2up0
for example fire and down:
j1fire1
, j1down1
followed somewhen by a j1down0
<number>ms
for example
1000ms
for delaying 1 second
examples:
j1fire1=>100ms=>j1fire0
when the action buttons are locked via the settings dialog then vc64web can behave more precisly to the users actions. That is when touching an action button the script is immediatly started and when lifting the finger from the action button this is registered too ... This all does not work when the actionbuttons are not locked, because they have to detect the dragging and haptic touch (long press) gestures then.
in locked mode you can for example simulate correctly a left flipper key with an actionbutton with the following script
presscommodore=>await_action_button_released=>releasecommodore
immediatly when a touch on the action button starts the script is called which triggers the commodore key press and then it waits until the user is lifting the finger from it. At the end the commodore key is released.
simple loops are expressed in this way:
loop5{j1fire1=>100ms=>j1fire0=>150ms}
the number directly after the keyword loop expresses how often the loop has to be repeated
lets look this in real on vc64web
the script will wait 3 seconds and emit F keyboard press and a joystick1 fire press for 5 times
of course this is a rather nonesense sequence of actions but it should give you the idea of how things work...
Now you should be able to create an auto fire button and which triggers on a certain keypress.