Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits. Anti-spam check. Do not fill this in!=Starting Out= '''Keep these things in mind when writing your scripts:''' *Use a plain text editor to compose your scripts. Make sure it is saving the file as TEXT-ONLY. Do NOT use programs like Word, wordpad or other advanced editors. These insert hidden header info and use non-standard ASCII characters for Return/Line-Feed commands, quotation-marks, and others. The simplest of text-editors will suffice (Notepad in Windows, nano in Linux for example.) Scripts must be saved as ASCII plain text. UTF-8 may work, but is not recommended because some editors insert a [http://en.wikipedia.org/wiki/Byte_order_mark unicode BOM] at the start. Mac users see [[FAQ/Mac#How_to_Copy_Script_Files_Without_Errors|this special note concerning Macs and Script Files]]. *Keep all commands in lower-case. Variables are case-sensitive (a and A are not the same). *In versions prior to 0.5.5 ([http://tools.assembla.com/chdk/changeset/524 SVN Changeset 524]) you are limited to 8k (8192 bytes) for the size of your script - CHDK Build 119 or later. (2k (2048 bytes) in CHDK Build 116 or earlier.) *Be aware that not all commands work on all cameras, if you plan on sharing your script try to keep it as generic as possible unless you have a special need for the camera-specific commands. Try to also provide a more generic version so that all may benefit from it. *If using earlier CHDK Builds some commands listed here will not be available to you and cause errors, this tutorial will be updated as new commands and changes are made to CHDK. *'''Keep your script concise and efficient!''' It takes 10ms of time for each line of your script to be interpreted by tiny uBASIC. If your script is 10 lines long this takes 1/10th of a second, 100 lines takes a full second, etc. This can greatly impact high-speed uses. Even '''rem''' statements take 10ms to be processed, use them sparingly. See this section in the discussion area for [[Talk:UBASIC/TutorialScratchpad#uBasic_timing.__One_line_.28only.21.29_executed_every_10_msec.3F|'''script timing test results''']] for further info. In versions 0.5.5 and later, up to 100 rem statements and labels will be executed before a 10ms wait is required. *If you write an interesting script, '''please''' share it with the rest of us on the User Written Scripts pages so we may learn from you! Beginner script-writers can be some of the most creative! *See these pages for some ideas and examples if you are just starting out: [[uBASIC/Scripts|'''User Written Scripts''']] *Two new Scripts Menu options have been added to some special builds, read about them in the [[CHDK_firmware_usage#Special_Builds_Features|Special Builds Features]] on the firmware usage page. By using these two options in conjunctions with these scripts, you are able to execute any script when first powering on your camera. This allows you an unlimited number of favorite Custom shooting modes and USB-Remote functionality. You may want to write your scripts taking these extra features into account. *<s>'''Allbest Build Special Note:''' It has been found that you cannot just simply select the much desired Tv, Av, and ISO '''Override''' features from its menus and then expect them to work in scripts. If using or writing scripts for the Allbest Build any special override shutter-speeds, aperture, and ISO values <u>will have to be</u> '''hard-coded''' into your scripts. If not then your scripts' '''shoot''' command will just use whatever standard manual or automatic exposure features selected. Consider the Allbest Override features for manual use only, at this time. See the [[Allbest Firmware Usage uBASIC Commands]] section for available script commands if you need to use these override features in scripts.</s> <i>This has since been made more compatible in the latest Allbest builds. Now your CHDK menu override-value features will take precedence, unless they are overridden by commands in your scripts.</i> Summary: Please note that all contributions to the CHDK Wiki are considered to be released under the CC-BY-SA Cancel Editing help (opens in new window) Retrieved from "https://chdk.fandom.com/wiki/UBASIC/TutorialScratchpad"