リファレンス 214 ドキュメント 7 サンプル 55
algorithms 10 analyze 15 ar 4 arduino 5 Artlet2D 11 audiometer 2 basic 147 cbcom 2 comobj 20 coreaudio 2 d3module 29 demo 2 dotfw 11 game 34 gpmodule 2 hgimg3 43 hgimg4 38 HIDaspx 2 hsp3dish 29 hsp3imp 1 hsp3utf 4 hspcl 11 hspcv 5 hspd2d 4 hspda 7 hspdb 3 hspext 18 hspinet 17 hspprint 2 hspsock 5 hspsw 4 hsptv 4 hsptvapp 2 hspusbio 1 hspvoicevox 2 iron 69 iron_config 3 misc 24 mmaudio 4 module 9 mucom88 6 new34 10 new35 16 new36 10 new37 3 obaq 17 pronama2d 6 pronama3d 5 rawinput 3 ribbon 1 sprite 20 SQLele 3 ssaver 1 tamane 10 win32_gen2 5

basic

Path : sample\basic
allman_brace.hsp
allman_brace.hsp ? Allman ブレーススタイルのサンプル IronHSP の hspcmp では if/else のブロック開始 { を次行に置く 「Allman スタイル」がサポートされています。 従来の同一行 { (K&R スタイル) も引き続き使えます。
sample\basic\allman_brace.hsp - 2026/04/16
arraynote.hsp
#include "hsp3util.as" s="abc\ndef\nhij\nklm" note2array a,s *main cls syscolor 15:boxf color 0,0,0 pos 8,8:mes "配列変数のセーブ・ロードを行ないます" pos 8,32 objsize 320,24 repeat 4 input a(cnt) loop button "セーブ",*asave button "ロード",*aload button "確認",*aview button
sample\basic\arraynote.hsp - 2009/03/10
atan_grect.hsp
screen 0,320,240 cx=160:cy=120 repeat redraw 0 dir=atan(cy-mousey,cx-mousex) color 255,255,255:boxf color 0,0,0:pos 0,0 mes "mouse=("+mousex+","+mousey+") dir="+dir grect cx,cy,dir,100,100 redraw 1 await 20 loop
sample\basic\atan_grect.hsp - 2009/03/10
aviplay.hsp
window内aviファイル再生サンプル dialog "avi",16,"aviファイル" if stat=0 : goto *dlcan fname=refstr mmload fname,1 screen 0,640,480,0 cls 4 objsize 160,32 pos 0,0 button "PLAY",*gogo pos 160,0 button "END",*dlcan pos 0,32 stop *gogo mmplay 1 stop *dlcan end
sample\basic\aviplay.hsp - 2009/03/10
bmpsave.hsp
読み込んだ画像を加工してBMPで出力するプログラム mydir=dir_cur 現在のディレクトリを保存 ファイルを選択 dialog "bmp *.jpg *.gif",16 if stat = 0 : end fname=refstr picload fname @を画面に書く font msgothic,160 color 0,0,255:mes "@" 保存 sname=getpath(fname,1+8)+"_mod_bmp" chdir mydir bmpsave sname
sample\basic\bmpsave.hsp - 2017/10/02
calcsheet.hsp
簡単な表計算を行なうサンプル 枠の中に入力した数値の合計を表示し、値に応じた棒グラフを表示します。 数値を入力して、[TAB]キーで次の枠に移動できます。 HSP3.2で追加されたobjskip命令により、合計の枠はフォーカスが移動 しないよう設定されています。
sample\basic\calcsheet.hsp - 2017/10/02
cdplay.hsp
簡易CDプレイヤーサンプル ( 現在演奏中のトラックを監視するバージョン) mci "capability cdaudio can play" if stat!0 : dialog "デバイスは使用中です",1:end mci "status cdaudio number of tracks" if stat<0 : dialog "CDがセットされていません",1:end maxtrack=stat onexit *owari 終了した時のジャンプ先 mci "open cdaudio
sample\basic\cdplay.hsp - 2009/03/10
chkbox.hsp
syscolor 15:boxf オブジェクトの表面色で背景を塗りつぶす mes "Check box test" a1=1:a2=0 objsize 80,24 chkbox "変数a1",a1 chkbox "変数a2",a2 button "OK",*chkok stop *chkok m="現在の状態\na1="+a1+"/a2="+a2 dialog m stop
sample\basic\chkbox.hsp - 2009/03/10
clock.hsp
#include "hsp3util.as" gettimestr,getdatestrを使うため t1="":t2="" objsize 120,20 mesbox t1,160,32,0 メッセージボックスを表示 (オブジェクトID0になります) mesbox t2,160,32,0 メッセージボックスを表示 (オブジェクトID1になります) *tmprt gettimestr t1 getdatestr t2 objprm 0,t1 メッセージボックスID0の内容を更新 objprm
sample\basic\clock.hsp - 2009/03/10
clock2.hsp
#include "hsp3util.as" gettimestr,getdatestrを使うため screen 0,320,80 画面サイズ指定 font msgothic,30,1 文字サイズを指定 t1="":t2="" *tmprt gettimestr t1 時刻を取得 getdatestr t2 日付を取得 redraw 0 color 255,255,255:boxf 白い色で背景を塗りつぶす color 0,0,0 文字の色 pos 0,0:mes t1 時刻を表示 pos
sample\basic\clock2.hsp - 2009/03/10
dirinfo.hsp
システムのディレクトリ情報を表示する cls 3 sysfont 17 hr=" " max=13 sdim dex,64,max sdim s1,128 dex(0)="0 : カレント(現在の)ディレクトリ" dex(1)="1 : HSPの実行ファイルがあるディレクトリ" dex(2)="2 : Windowsディレクトリ" dex(3)="3 : Windowsのシステムディレクトリ" dex(4)="4 : コマンドライン文字列" dex(5)="$10000 :
sample\basic\dirinfo.hsp - 2009/03/10
dirlist.hsp
ディレクトリ一覧表示サンプル (入力したディレクトリに移動できます) dirbuf="" sel=0 ad="" objsize 200,24:pos 0,30 listbox sel,200,dirbuf input ad button "ディレクトリ変更",*chg *getdir color 255,255,255:boxf 0,0,640,24 color 0,0,0:pos 0,0:mes "DIR="+dir_cur dirlist dirbuf,"*.*" objprm
sample\basic\dirlist.hsp - 2011/07/22
ease_test3.hsp
クリックした座標にボールを移動させます x=ginfo_sx/2 y=ginfo_sy/2 anim=100 移動するフレーム数 *start color 0,0,0:boxf 画面をクリア color 255,255,255 pos 0,0 mes "画面をクリックしてください" pos x,y mes "●" *main stick key await 20 if key&256 : goto *main2 goto *main *main2 bx=x 開始座標X by=y 開始座標Y
sample\basic\ease_test3.hsp - 2014/04/25
editor.hsp
title "size="+strlen(buf) テキストサイズをタイトルに表示 goto *main *file_save dialog "txt",17,"テキストファイル" if stat=0 : goto *dlcan fname = refstr exname=getpath(fname,2) ファイル名の拡張子を取得 if exname="" : fname+=".txt" 拡張子がなければ.txtを追加 notesel buf notesave fname
sample\basic\editor.hsp - 2009/03/10
emes.hsp
#include "hsp3util.as" emes命令を使用するために必要です ゆっくり文字列を表示するサンプル font msgothic,30,1 a="こんにちは、HSPです。\nゆっくりと文字を出してみましょう。
sample\basic\emes.hsp - 2009/03/10
filedialog.hsp
ファイルダイアログ指定サンプル(HSP3.2) dialog命令により呼び出されるファイル選択ダイアログの パラメーター指定例を実際に実行することができます。 複数の拡張子、ファイル種別を区切り記号により記述することができます。
sample\basic\filedialog.hsp - 2017/10/02
fonts.hsp
cls 4 color 255,155,55 boxf 0,84,640,90 boxf 0,0,640,40 font "Arial",20,17 pos 20,8 color 0,0,0 mes "HSP ver3.0 font test" font "Arial",20,16 color 255,255,255 pos 40,60 mes "Non-Anti-aliased" pos 360,60 mes "Anti-aliased" color 255,255,255 pos
sample\basic\fonts.hsp - 2009/03/10
getpath.hsp
title "getpath関数のテスト" screen 0,640,320 mes "ファイルを開いて下さい。" dialog "*",16:if stat=0 : end a=refstr mes "すべて取り出す。" mes getpath(a,0) mes "拡張子を除いた部分を取り出す。" mes getpath(a,1) mes "拡張子を取り出す。" mes getpath(a,2) mes "ファイル名のみ取り出す。
sample\basic\getpath.hsp - 2009/03/10
gradf.hsp
gradf命令サンプル sx=640: sy=480 screen 0,sx,sy それぞれの頂点座標と色を配列に代入 x(0)=0 : y(0)=0 : col(0)=$0000ff x(1)=sx : y(1)=0 : col(1)=$00ffff x(2)=sx : y(2)=sy : col(2)=$ff0000 x(3)=0 : y(3)=sy : col(3)=$ff00ff グラデーションで四角形を描画 gsquare gsquare_grad, x,y,col
sample\basic\gradf.hsp - 2017/10/02
grect.hsp
title "grect" screen 0,640,480,0 cls 2 font "Arial",14 m="HSP3 Sample Image" x=160:y=160:px=4:py=4 repeat redraw 0 hsvcolor cnt/2,255,255 gmode 0,200,200 grect x,y,double(cnt)*0.07 pos 482,442:color 0,0,0:mes m pos 480,440:color 255,255,255:mes m
sample\basic\grect.hsp - 2009/07/28
groll.hsp
マウスドラッグで描画領域をスクロールさせる ( groll命令を使用したテスト ) screen 0,1200,600,0,,,480,360 repeat 6 y=cnt*100:i=cnt repeat 12 x=cnt*100 if i&1 : color 255,0,0 : else : color 0,0,255 boxf x,y,x+100,y+100 i++ loop loop color 255,255,255 font msgothic,120 pos 20,320: mes
sample\basic\groll.hsp - 2009/03/10
grotate.hsp
title "grotate" buffer 3,256,256,0 picload "../game/face.bmp" screen 0,640,480,0 cls 4 font "Arial",14 m="HSP3 grotate sample" max=20 dim xx,max dim yy,max dim px,max dim py,max dim rot,max dim prot,max repeat max xx.cnt=rnd(640) yy.cnt=rnd(480)
sample\basic\grotate.hsp - 2009/07/28
groupbox.hsp
Group Box例 syscolor 15:boxf sdim bb,1024 st1="" st2="Static Text Message..." objsize 300,100 pos 10,20 mesbox st1,280,70,2 pos 40,40 mesbox st2,200,40,2 pos 0,0 button "GROUPBOX",*dummy sendmsg objinfo_hwnd(2),$f4,7,0 pos 0,120 input bb stop *dummy
sample\basic\groupbox.hsp - 2009/03/10
gsel.hsp
gsel命令サンプル (3つのボタンで、もう1つのウインドゥの状態をコントロール) width 320,200 mes "MAIN" button "OFF",*sc0 button "ON1",*sc1 button "ON2",*sc2 screen 2,320,200 cls 4 mes "screen2" gsel 0,1 stop *sc0 gsel 2,-1 stop *sc1 gsel 2,1 stop *sc2 gsel 2,2 stop
sample\basic\gsel.hsp - 2009/03/10
gsquare.hsp
title "gsquare" randomize buffer 3 picload dir_exe+"\\doclib\\hsp3ttl.jpg" screen 0,640,480,0 gmode 0,640,200 tx.0=0:ty.0=0 tx.1=640:ty.1=0 tx.2=640:ty.2=200 tx.3=0:ty.3=200 repeat redraw 0 color 64,64,64:boxf n = cnt&127:if n>=64 : n=63-(n-64)
sample\basic\gsquare.hsp - 2009/07/28
gstyle.hsp
gstyle命令テスト screen 0,320,24 cls 3 color 255,255,255 mes "新しいウインドゥスタイル" screen 2,320,120,4 cls 2 mes "ID2以降のサイズ固定Window" screen 3,320,120,8 cls 2 mes "ツールWindow(タスクバーに出ません)" screen 4,320,120,16 cls 2 mes "縁の深いWindow" stop
sample\basic\gstyle.hsp - 2009/03/10
hsv.hsp
HSV sample y=0 repeat 256 x=0:px=2 repeat 256 hsvcolor y,cnt,255 boxf x,y,x+px,y x+=px loop y+ await 0 loop stop
sample\basic\hsv.hsp - 2009/03/10
htcopy1.hsp
半透明コピーテスト1 screen 0,640,200,0 buffer 4,640,200,0 color 255,0,0 boxf 0,0,640,200 color 0,0,255 boxf 320,0,640,100 boxf 0,100,320,200 buffer 3,640,200,0 picload dir_exe+"\\doclib\\hsp3ttl.jpg" gsel 0 *start pos 0,0 repeat 32 redraw 0 gmode 0,640,200
sample\basic\htcopy1.hsp - 2009/07/28
htcopy2.hsp
半透明コピーテスト2 screen 0,640,200,0 buffer 4,640,200,0 color 255,0,0 boxf 0,0,640,200 color 0,0,255 boxf 320,0,640,100 boxf 0,100,320,200 buffer 3,640,200,0 picload dir_exe+"\\doclib\\hsp3ttl.jpg" gsel 0 *start pos 0,0 repeat 33 redraw 0 gmode 0,640,200
sample\basic\htcopy2.hsp - 2009/07/28
line.hsp
redraw命令によるバッファ書き込みの速度テスト。 line命令を400回実行する際の違いを見ることができます。 ノーマルな描画の速度に比べて、redrawスイッチを0にして書き込んで おき、最後にredraw 1を実行した方が圧倒的に速度が違うのがわかると思います。
sample\basic\line.hsp - 2009/03/10
memcpy.hsp
メモリコピーテスト a="TEST MESSAGE" b="" memcpy b,a,16,0,5 mes "A="+a mes "B="+b memset b,'@',16,5 mes "B="+b stop
sample\basic\memcpy.hsp - 2009/03/10
memfile.hsp
bloadで読み込んだ画像データをpicloadで表示する (メモリストリームの例) notesel buf 読み込みバッファをbufに指定 fname=dir_exe+"\\doclib\\hsp3ttl.jpg" noteload fname サイズ可変バッファbufにファイルを読み込み memfile buf ストリームの直前で指定してください picload "MEM:a.jpg" 画像の拡張子識別のためダミー名a.jpgを使用 sdim buf,64
sample\basic\memfile.hsp - 2009/07/28
memnote.hsp
メモリノートパッド命令テスト a="abc\ndef\nhij" notesel a noteload "memnote.hsp" mes "行数="+notemax mes "文字数="+notesize repeat notemax noteget b,cnt mes "#"+cnt+":"+b loop noteunsel stop
sample\basic\memnote.hsp - 2009/03/10
menusample.hsp
#include "mod_menu.as" #define CMD_OPEN 1 #define CMD_QUIT 2 oncmd gosub *OnCommand, WM_COMMAND メッセージ割り込み サブメニュー作成 newmenu hfilemenu,1 addmenu hfilemenu, "開く(&O)", CMD_OPEN addmenu hfilemenu, "終了(&Q)", CMD_QUIT トップメニュー作成 newmenu hmenu,0 addmenu
sample\basic\menusample.hsp - 2009/03/10
mesinfo.hsp
title "MES命令の表示範囲取得" screen 0,640,240 font msgothic,50,font_bold|font_antialias a="Hot Soup Processor":gosub *test a="Ver3.0 testing":gosub *test stop *test color 0,0,0 cx=ginfo_cx:cy=ginfo_cy mes a mx=ginfo_mesx:my=ginfo_mesy mes "SX="+mx+"/SY="+my
sample\basic\mesinfo.hsp - 2009/03/10
moji.hsp
mes/printサンプル (オプションを指定することで改行されません) font msgothic,20 s1="" x=0:y=0 repeat 5 moji="This is mes/print sample for HSP3.5." gosub *sub moji="1文字ずつ表示するサンプルスクリプトです。
sample\basic\moji.hsp - 2025/07/28
mouse.hsp
マウスカーソルの座標を調べて表示します。 ボタンを押すとマウスカーソル表示ON/OFF、ランダムジャンプが可能です。
sample\basic\mouse.hsp - 2009/03/10
mouse2.hsp
title "Check mouse pointer" cx=160:cy=120 pos 0,60 button gosub "OFF",*moff button gosub "ON",*mon repeat redraw 0 color 255,255,255:boxf color 0,0,0:pos 0,0 mes "mouse=("+mousex+","+mousey+")" mes "wheel="+mousew color 255,0,0
sample\basic\mouse2.hsp - 2009/03/10
note1.hsp
メモリノートパッド命令テスト1 "note1.hsp"にインデックス番号をつけて表示 nmax=0 b="" notesel a noteload "note1.hsp" idx=0 repeat notemax noteget b,idx print "index"+idx+"="+b idx++ loop stop
sample\basic\note1.hsp - 2009/03/10
note2.hsp
メモリノートパッド命令テスト2 選んだファイルをメッセージボックスに表示。
sample\basic\note2.hsp - 2009/03/10
noteadd.hsp
title "テキストファイル作成" screen 0,320,240 cls 1 mes "指定範囲の数をテキストファイルに出力" objmode 1 pos 0,40:input p_start pos 80,40:mes "to" pos 110,40:input p_end pos 0,80:button "作成",*go stop *go buf="#NUM FILE" notesel buf i = p_end-p_start+1:if i<0 : end repeat i
sample\basic\noteadd.hsp - 2009/03/10
objimage.hsp
objimage命令によるカスタムボタンの作成 buffer 1 picload "btn_normal.bmp" screen 0,640,480 gradf ,,,, 1, 0, $c0 font "Arial",20 objmode 2 objsize 128,32 objimage 1, 0,0, 0,64, 0,32 ボタン画像の指定 button gosub "CALL",*call button "JUMP",*jmp objimage -1 通常のボタンに戻す button
sample\basic\objimage.hsp - 2017/10/02
objmode.hsp
title "press [TAB] key" cls 1 objsize 160,24 pos 20,20 objmode 1,1 button "BYE",*ok objmode 2,1 font "Modern",14 chkbox "Check Box",a bb="OBJECT TEST" font "Lucida Console",14,1 input bb sysfont 11 ed="MesBox Test..." mesbox ed,160,100,0 ly=0
sample\basic\objmode.hsp - 2009/03/10
omedetai.hsp
グラフィック機能を使ったサンプル おめでたい感じの画面が出ます wx=800:wy=600 画面サイズ screen 0,wx,wy cx=wx/2:cy=wy/2 dist=int(sqrt( cx*cx + cy*cy ))+8 dim x,4 dim y,4 kai=16 角数 tt=0 plus=3.141592/kai*2 x(0)=cx:y(0)=cy x(3)=cx:y(3)=cy r1=255:g1=0:b1=0 1つ目の色 r2=255:g2=255:b2=0 2つ目の色
sample\basic\omedetai.hsp - 2017/10/02
onerror.hsp
エラートラップ onerror *emsg a="kkk"*4 エラーが起こります stop *emsg エラー発生時にここに飛んできます dialog "エラーが発生しました。
sample\basic\onerror.hsp - 2009/03/10
onexit.hsp
onexit *exit mes "スクリプト終了テスト(クローズボックスを押してみてください)" button "END",*owari stop *exit dialog "終了していいですか?",2,"On exit prompt" if stat=7 : stop *owari end
sample\basic\onexit.hsp - 2009/03/10
onkey.hsp
onexit goto *owari 終了時にジャンプ onkey goto *inkey キー入力時にジャンプ onclick goto *inmouse マウスクリック時にジャンプ btnmes="END" mes "メッセージを入力して[Enter]" objsize 600,24 a="" input a button btnmes,*owari ボタン名に変数も使用できます *ao stop *inkey if iparam=229 : goto *ao IMEからの日本語入力 if
sample\basic\onkey.hsp - 2009/03/10
picfont.hsp
#include "mod_picfont.as" buffer 3 picload "fontchr.bmp" screen 0,640,480 cls 3 テクスチャフォント表示の準備 picfont 3,16,16,2,-4 id, sizex, sizey, mode, offset フォントの表示 pos 32,32 picfprt "[MOD_PICFONT.AS Sample Script]" picfprt "Refer to 'picfont' and
sample\basic\picfont.hsp - 2017/10/02
picload.hsp
JPEGロード & BMPセーブをするスクリプト width 320,80 objsize 300,24 button "画像ファイルロード",*fload button "BMPセーブ",*fsave screen 2,640,480 gsel 2,-1 stop *fload dialog "bmp *.jpg *.gif",16,"画像ファイル" if stat=0 : goto *failed gsel 2,1 picload refstr stop *fsave dialog
sample\basic\picload.hsp - 2009/03/10
sample_ai_tools.hsp
#include "iron_ai_tools.hsp" mes "ai_tools sample (requires API key)"
sample\basic\sample_ai_tools.hsp - 2026/04/18
sample_ai_tts.hsp
#include "iron_ai_tts.hsp" mes "ai_tts sample (requires API key)"
sample\basic\sample_ai_tts.hsp - 2026/04/18
sample_ai_vision.hsp
#include "iron_ai_vision.hsp" mes "ai_vision sample (requires API key)"
sample\basic\sample_ai_vision.hsp - 2026/04/18
sample_array2.hsp
#include "iron_array2.hsp" dim a, 5 a = 3, 1, 4, 1, 5 mes "sum=" + array_sum(a, 5) mes "min=" + array_min(a, 5) mes "max=" + array_max(a, 5) mes "unique=" + array_unique(a, 5)
sample\basic\sample_array2.hsp - 2026/04/17
sample_audioloop.hsp
#include "iron_audioloop.hsp" audioloop_start "loopback.wav" if stat == 0 { mes "Recording system audio for 3 seconds..." repeat 60 audioloop_poll await 50 loop audioloop_stop mes "Saved to loopback.wav" } else { mes "Failed: " + stat }
sample\basic\sample_audioloop.hsp - 2026/04/17
sample_bigdec.hsp
title "BigDecimal sample ? Machin's formula" font "MS Gothic", 14 objsize 200, 28 1) 1/3 を 30 桁 - mes " 1/3 (30 decimals) " a = bigdec("1") b = bigdec("3") q = bigdec_div(a, b, 30, BIGDEC_HALF_UP) mes bigdec_str(q) bigdec_release a
sample\basic\sample_bigdec.hsp - 2026/04/18
sample_bigint.hsp
title "BigInt demo ? 100!" bi_push result = bi("1") repeat 100, 1 term = bi_from(cnt) next_r = bi_mul(result, term) result = next_r ポインタ更新 (旧 result は pool が解放) loop mes "100! =" mes bi_str(result) mes "" mes "bit length = " +
sample\basic\sample_bigint.hsp - 2026/04/18
sample_bloom.hsp
#include "iron_bloom.hsp" bloom_init 1024 bloom_add "hello" bloom_add "world" mes "hello: " + bloom_contains("hello") mes "xyz: " + bloom_contains("xyz")
sample\basic\sample_bloom.hsp - 2026/04/17
sample_cache.hsp
#include "iron_cache.hsp" cache_set "key1", "value1", 60 mes "key1=" + cache_get("key1") mes "has=" + cache_has("key1")
sample\basic\sample_cache.hsp - 2026/04/17
sample_capture.hsp
#include "iron_capture.hsp" capture_init if stat == 0 { capture_save "screenshot.bmp" mes "Screenshot saved! stat=" + stat capture_bye } else { mes "capture_init failed: " + stat }
sample\basic\sample_capture.hsp - 2026/04/17
sample_chart.hsp
title "Monthly Sales" chart_labels "Jan","Feb","Mar","Apr","May" chart_data "Sales", 120, 200, 150, 300, 250 chart_data "Cost", 80, 100, 90, 120, 110 chart_show
sample\basic\sample_chart.hsp - 2026/04/16
sample_collection.hsp
#include "iron_collection.hsp" stack_push 10 : stack_push 20 : stack_push 30 mes "pop=" + stack_pop() mes "peek=" + stack_peek() mes "size=" + stack_size()
sample\basic\sample_collection.hsp - 2026/04/17
sample_color.hsp
#include "iron_color.hsp" mes color_rgb2hex(255, 0, 0) color_hex2rgb "#00FF00", r, g, b mes "R=" + r + " G=" + g + " B=" + b
sample\basic\sample_color.hsp - 2026/04/17
sample_combinatorics.hsp
#include "iron_combinatorics.hsp" mes "5! = " + factorial(5) mes "10C3 = " + combination(10, 3) mes "gcd(12,8) = " + gcd(12, 8) mes "is_prime(17) = " + is_prime(17)
sample\basic\sample_combinatorics.hsp - 2026/04/17
sample_complex.hsp
#include "iron_complex.hsp" dimtype a, 3, 2 : a(0)=3.0:a(1)=4.0 dimtype b, 3, 2 : b(0)=1.0:b(1)=2.0 dimtype c, 3, 2 complex_mul a, b, c mes "(3+4i)*(1+2i) = " + c(0) + "+" + c(1) + "i" mes "|3+4i| = " + complex_abs(a)
sample\basic\sample_complex.hsp - 2026/04/17
sample_crypto.hsp
#include "iron_crypto.hsp" Blowfish sdim txt, 64 : txt = "Hello Blowfish" sdim enc, 64 : sdim dec, 64 bf_encrypt "SecretKey123", txt, 14, enc mes "encrypted " + stat + " bytes" bf_decrypt "SecretKey123", enc, stat, dec mes "decrypted: " + dec
sample\basic\sample_crypto.hsp - 2026/04/16
sample_curvefit.hsp
#include "iron_curvefit.hsp" dimtype x, 3, 5 dimtype y, 3, 5 x=1.0:x(1)=2.0:x(2)=3.0:x(3)=4.0:x(4)=5.0 y=2.1:y(1)=3.9:y(2)=6.0:y(3)=8.1:y(4)=9.8 curvefit_linear x, y, 5, slope, intercept mes "y = " + slope + " * x + " + intercept mes "R2 = " +
sample\basic\sample_curvefit.hsp - 2026/04/17
sample_darkmode.hsp
#include "iron_darkmode.hsp" mes "Dark mode: " + darkmode_is_enabled() mes "BG color: " + darkmode_bg()
sample\basic\sample_darkmode.hsp - 2026/04/17
sample_datetime.hsp
#include "iron_datetime.hsp" mes "now: " + datetime_now() mes "date: " + date_today() mes "time: " + time_now() mes "year: " + datetime_year() mes "weekday: " + datetime_weekday() mes "unix: " + datetime_unix()
sample\basic\sample_datetime.hsp - 2026/04/17
sample_diff.hsp
#include "iron_diff.hsp" old = "line1\nline2\nline3" new2 = "line1\nmodified\nline3\nline4" diff_text old, new2 mes refstr
sample\basic\sample_diff.hsp - 2026/04/17
sample_dns.hsp
#include "iron_dns.hsp" dns_lookup "google.com", ip mes "google.com = " + ip
sample\basic\sample_dns.hsp - 2026/04/18
sample_dotenv.hsp
#include "iron_dotenv.hsp" dotenv_load ".env" mes "dotenv sample - create .env file first"
sample\basic\sample_dotenv.hsp - 2026/04/17
sample_download.hsp
#include "iron_download.hsp" dl_start "https: httpbin.org/image/png", "test_dl.png" mes "download status=" + stat
sample\basic\sample_download.hsp - 2026/04/18
sample_dpi.hsp
#include "iron_dpi.hsp" dpi_set_awareness 2 mes "System DPI: " + dpi_get_system() mes "Current DPI: " + dpi_get() mes "100px scaled: " + dpi_scale(100)
sample\basic\sample_dpi.hsp - 2026/04/17
sample_envarg.hsp
sample_envarg.hsp ? 環境変数・コマンドライン引数サンプル 実行例: hsp3cl_net_64.exe sample_envarg.ax --name=太郎 --count 5 --verbose #runtime "hsp3cl" #cmpopt utf8 1 mes " == 環境変数 ==" 環境変数の取得 s = getenv("USERNAME") mes "ユーザー名: " + s デフォルト値付き s =
sample\basic\sample_envarg.hsp - 2026/04/16
sample_exif.hsp
#include "iron_exif.hsp" exif_open "photo.jpg" if stat == 0 { exif_get_str EXIF_MODEL mes "Camera: " + refstr exif_get_str EXIF_DATETIME mes "Date: " + refstr exif_close } mes "EXIF sample - provide a JPEG file to test"
sample\basic\sample_exif.hsp - 2026/04/16
sample_faker.hsp
#include "iron_str2.hsp" #include "iron_faker.hsp" repeat 5 mes fake_name() + " | " + fake_email() + " | " + fake_phone() loop
sample\basic\sample_faker.hsp - 2026/04/17
sample_fft.hsp
#include "iron_fft.hsp" dimtype re, 3, 8 dimtype im, 3, 8 re=1.0:re(1)=1.0:re(2)=1.0:re(3)=1.0 fft_compute re, im, 8 mes "DC=" + re(0) repeat 8 : mes "bin "+cnt+": "+re(cnt) : loop
sample\basic\sample_fft.hsp - 2026/04/17
sample_folder.hsp
#include "iron_folder.hsp" mes "Desktop: " + folder_desktop() mes "Documents: " + folder_documents() mes "AppData: " + folder_appdata() mes "Profile: " + folder_profile() mes "ProgramFiles: " + folder_programfiles()
sample\basic\sample_folder.hsp - 2026/04/17
sample_forms.hsp
#include "hsp3_net_64.as" #include "iron_forms.hsp" screen 0, 640, 480 button "OK", *ok ctrl_anchor stat, ANCHOR_BOTTOM | ANCHOR_RIGHT mes "Resize the window - button follows!" stop *ok mes "clicked" return
sample\basic\sample_forms.hsp - 2026/04/17
sample_fs.hsp
#include "iron_fs.hsp" tmp = fs_tempfile() mes "temp: " + tmp fs_writetext tmp, "hello" mes "read: " + fs_readtext(tmp) mes "size: " + fs_size(tmp) mes "is_file: " + fs_is_file(tmp) mes "is_dir(.): " + fs_is_dir(".") mes "locked: " +
sample\basic\sample_fs.hsp - 2026/04/17
sample_ftp.hsp
#include "iron_ftp.hsp" ftp_connect "ftp.example.com", "user", "pass" if stat == 0 { ftp_list "*" mes refstr ftp_disconnect } mes "FTP sample - edit connection info to test"
sample\basic\sample_ftp.hsp - 2026/04/16
sample_fwatch.hsp
#include "iron_fwatch.hsp" mes "monitoring current dir for 5 seconds..." fwatch_start dir_cur, FWATCH_ALL hw = stat repeat 10 fwatch_check hw if stat : mes "change detected!" await 500 loop fwatch_stop hw mes "done"
sample\basic\sample_fwatch.hsp - 2026/04/16
sample_ga.hsp
#include "iron_ga.hsp" ga_init 20, 100 Simple: maximize value (fitness = value) dim fit, 20 repeat 50 repeat 20 : fit(cnt) = ga_get(cnt) : loop ga_evaluate fit ga_evolve loop mes "Best after 50 gen: " + ga_best()
sample\basic\sample_ga.hsp - 2026/04/17
sample_game.hsp
#include "iron_game.hsp" mes " HitTest " mes "rect: " + hit_rect(0,0,100,100, 50,50,100,100) mes "circle: " + hit_circle(0,0,50, 80,0,50) mes "point_rect: " + hit_point_rect(25,25, 0,0,50,50) mes " Easing " mes "in_quad(0.5) = " + ease_in_quad(0.5)
sample\basic\sample_game.hsp - 2026/04/17
sample_geometry.hsp
#include "iron_geometry.hsp" mes "triangle area = " + tri_area(0.0, 0.0, 4.0, 0.0, 0.0, 3.0) mes "circle area = " + circle_area(5.0) mes "sphere volume = " + sphere_volume(3.0)
sample\basic\sample_geometry.hsp - 2026/04/17
sample_graph.hsp
#include "iron_graph.hsp" 4-node graph: 0-1, 0-2, 1-3, 2-3 dim adj, 16 adj(0*4+1)=1 : adj(1*4+0)=1 adj(0*4+2)=1 : adj(2*4+0)=1 adj(1*4+3)=1 : adj(3*4+1)=1 adj(2*4+3)=1 : adj(3*4+2)=1 dim dist, 4 graph_bfs adj, 0, 4, dist mes "BFS from 0: " +
sample\basic\sample_graph.hsp - 2026/04/17
sample_hotkey.hsp
#include "iron_hotkey.hsp" mes "Press Ctrl+F1 to trigger hotkey" mes "Press ESC to exit" hotkey_register 1, MOD_CONTROL, 0x70 Ctrl+F1 (VK_F1=0x70) onkey gosub *on_key stop *on_key if iparam == 27 { hotkey_unregister 1 : end } return
sample\basic\sample_hotkey.hsp - 2026/04/17
sample_html.hsp
#include "iron_html.hsp" html = "<html><body><h1>Title</h1><a href='http: example.com'>Link1</a><p>Hello</p><a href='http: test.org'>Link2</a></body></html>" html_parse html mes "tags: " + stat html_find "a" mes "links: " + stat repeat stat mes "
sample\basic\sample_html.hsp - 2026/04/16
sample_http_net.hsp
#include "hsp3_net_64.as" #include "iron_http_net.hsp" httpn_get "https: httpbin.org/get", body mes "status=" + stat mes body
sample\basic\sample_http_net.hsp - 2026/04/18
sample_humanize.hsp
#include "iron_humanize.hsp" mes humanize_bytes(2621440) mes humanize_seconds(3661) mes humanize_number(1234567)
sample\basic\sample_humanize.hsp - 2026/04/17
sample_image_net.hsp
#include "hsp3_net_64.as" #include "iron_image_net.hsp" imgn_screenshot h imgn_save h, "screenshot.png" imgn_close h mes "saved screenshot.png"
sample\basic\sample_image_net.hsp - 2026/04/18
sample_ime.hsp
#include "iron_ime.hsp" mes "IME state: " + ime_get_state() ime_on mes "After ime_on: " + ime_get_state() ime_off mes "After ime_off: " + ime_get_state()
sample\basic\sample_ime.hsp - 2026/04/17
sample_kmeans.hsp
#include "iron_kmeans.hsp" dimtype x, 3, 6 dimtype y, 3, 6 x=1.0:x(1)=1.5:x(2)=2.0:x(3)=8.0:x(4)=8.5:x(5)=9.0 y=1.0:y(1)=2.0:y(2)=1.0:y(3)=8.0:y(4)=9.0:y(5)=8.0 dim labels, 6 kmeans_cluster x, y, 6, 2, labels repeat 6 : mes "point "+cnt+"
sample\basic\sample_kmeans.hsp - 2026/04/17
sample_log.hsp
#include "iron_log.hsp" log_init "", LOGLV_DEBUG log_debug "debug message" log_info "info message" log_warn "warning" log_error "error!"
sample\basic\sample_log.hsp - 2026/04/17
sample_magnify.hsp
#include "iron_magnify.hsp" mag_init if stat == 0 { mes "Magnifying 1.5x for 3 seconds..." mag_fullscreen_on 150 wait 300 mag_fullscreen_off mag_bye mes "Done" }
sample\basic\sample_magnify.hsp - 2026/04/17
sample_map.hsp
sample_map.hsp ? 連想配列 (MAP) サンプル dimmap 命令で連想配列を作成し、map("key") でアクセスします。
sample\basic\sample_map.hsp - 2026/04/16
sample_markdown.hsp
#include "iron_markdown.hsp" md = "# Hello\n\n- item1\n- item2\n\n**bold** and *italic*" md_to_html md mes refstr
sample\basic\sample_markdown.hsp - 2026/04/17
sample_mathex_hspvar.hsp
#include "hspmathex.as" - 1.
sample\basic\sample_mathex_hspvar.hsp - 2026/04/18
sample_matrix.hsp
#include "iron_matrix.hsp" 2x2 matrix multiply dimtype A, 3, 4 A(0)=1.0 : A(1)=2.0 : A(2)=3.0 : A(3)=4.0 dimtype B, 3, 4 B(0)=5.0 : B(1)=6.0 : B(2)=7.0 : B(3)=8.0 dimtype C, 3, 4 mat_mul A, B, C, 2 mes "[1,2 3,4]*[5,6 7,8] = [" + C(0) + "," + C(1) +
sample\basic\sample_matrix.hsp - 2026/04/17
sample_montecarlo.hsp
#include "iron_montecarlo.hsp" mes "Pi estimate (1000): " + mc_estimate_pi(1000) mes "Pi estimate (10000): " + mc_estimate_pi(10000) mes "Pi estimate (100000): " + mc_estimate_pi(100000)
sample\basic\sample_montecarlo.hsp - 2026/04/17
sample_netinfo.hsp
#include "iron_netinfo.hsp" mes "Connected: " + netinfo_connected() mes "Type: " + netinfo_type() mes "Hostname: " + netinfo_hostname() mes "IP: " + netinfo_ip()
sample\basic\sample_netinfo.hsp - 2026/04/17
sample_oauth.hsp
#include "iron_oauth.hsp" oauth_start_listener 8080 if stat == 0 { mes "Listener started on port 8080" mes "Open browser and authorize, then redirect to http: localhost:8080/callback?code=XXX" exec auth_url, 16 oauth_wait_code 30 if stat == 0 { mes
sample\basic\sample_oauth.hsp - 2026/04/16
sample_path.hsp
#include "iron_path.hsp" mes "combine: " + path_combine("C:\\Users", "test.txt") mes "ext: " + path_ext("photo.jpg") mes "filename: " + path_filename("C:\\dir\\file.txt") mes "stem: " + path_stem("C:\\dir\\file.txt") mes "temp: " + path_temp() mes
sample\basic\sample_path.hsp - 2026/04/17
sample_pcre2.hsp
#include "iron_pcre2.hsp" pcre2_search "[0-9]+", "abc123def456" mes "first number: " + refstr pcre2_search "(?<=@)\w+", "user@example.com" mes "domain: " + refstr pcre2_replace "[aeiou]", "hello world", "*" mes "replaced: " + refstr n =
sample\basic\sample_pcre2.hsp - 2026/04/16
sample_ping.hsp
#include "iron_ping.hsp" ping_send "google.com", 3000, t if stat = 0 : mes "ping OK: " + t + " ms"
sample\basic\sample_ping.hsp - 2026/04/18
sample_pptx.hsp
#include "hsp3_net_64.as" #include "iron_pptx.hsp" pptx_create "test.pptx" pptx_add_slide "Title", "Content here" pptx_save mes "pptx sample - hsp3net GUI required"
sample\basic\sample_pptx.hsp - 2026/04/17
sample_process.hsp
#include "iron_process.hsp" process_exec "cmd /c echo Hello from subprocess" mes "stdout: " + refstr mes "exit code: " + stat
sample\basic\sample_process.hsp - 2026/04/17
sample_quaternion.hsp
#include "iron_quaternion.hsp" dimtype q, 3, 4 quat_from_axis_angle q, 0.0, 0.0, 1.0, 1.5708 mes "q = " + q(0) + ", " + q(1) + ", " + q(2) + ", " + q(3) px = 1.0 : py = 0.0 : pz = 0.0 quat_rotate q, px, py, pz mes "rotated (1,0,0) = " + px + ", " +
sample\basic\sample_quaternion.hsp - 2026/04/17
sample_rag.hsp
#include "iron_rag.hsp" mes "rag sample (requires API key)"
sample\basic\sample_rag.hsp - 2026/04/18
sample_random_dist.hsp
#include "iron_random_dist.hsp" mes "Normal(0,1):" repeat 5 : mes " " + rand_normal(0.0, 1.0) : loop mes "Exponential(1.0):" repeat 5 : mes " " + rand_exponential(1.0) : loop
sample\basic\sample_random_dist.hsp - 2026/04/17
sample_regex.hsp
#include "iron_regex.hsp" パターンマッチ regex_match "^[0-9]+$", "12345" mes "12345 は数字のみ: " + stat 検索 regex_search "[A-Z][a-z]+", "Hello World" mes "最初の単語: " + refstr 置換 regex_replace "[0-9]+", "TEL: 03-1234-5678", " *" mes "電話番号マスク: " +
sample\basic\sample_regex.hsp - 2026/04/16
sample_registry.hsp
#include "iron_registry.hsp" reg_read HKEY_CURRENT_USER, "Environment", "TEMP", result if stat == 0 { mes "TEMP = " + result } mes "exists PATH: " + reg_exists(HKEY_CURRENT_USER, "Environment", "Path")
sample\basic\sample_registry.hsp - 2026/04/17
sample_report.hsp
#include "iron_report.hsp" report_init report_template "<html><head><style>body{font-family:sans-serif}table{border-collapse:collapse width:100%}th,td{border:1px solid #333
sample\basic\sample_report.hsp - 2026/04/16
sample_rest.hsp
#include "iron_rest.hsp" rest_set_base "https: jsonplaceholder.typicode.com" rest_get "/posts/1", body mes "status=" + stat mes body
sample\basic\sample_rest.hsp - 2026/04/18
sample_sentiment.hsp
#include "iron_sentiment.hsp" mes sentiment_label("This is great and amazing") mes sentiment_label("This is terrible") mes sentiment_label("This is normal")
sample\basic\sample_sentiment.hsp - 2026/04/17
sample_simd.hsp
title "iron_simd benchmark" screen 0, 640, 600 objmode 2 font "MS Gothic", 14 - CPU 機能表示 iron_simd_cpu_name cpu_name iron_simd_features feat mes "CPU : " + cpu_name mes "SIMD: " + feat mes "" N = 1000000 mes "要素数 N = " + N ddim a, N
sample\basic\sample_simd.hsp - 2026/04/18
sample_smtp.hsp
#include "iron_smtp.hsp" mail_send "smtp.example.com", 587, "from@example.com", "to@example.com", "Test", "Hello!" if stat != 0 : mes "Error: " + mail_error() mes "SMTP sample - edit server info to test"
sample\basic\sample_smtp.hsp - 2026/04/16
sample_ssh.hsp
#include "iron_ssh.hsp" ssh_connect "192.168.1.100", 22, "user", "password" if stat == 0 { ssh_exec "ls -la" mes refstr ssh_disconnect } mes "SSH sample - edit connection info to test"
sample\basic\sample_ssh.hsp - 2026/04/16
sample_stat.hsp
#include "iron_stat.hsp" テストデータ dim scores, 10 scores = 80, 90, 70, 100, 60, 85, 95, 75, 65, 88 mes " 基本統計量 " mes "合計 = " + stat_sum(scores, 10) mes "平均 = " + stat_mean(scores, 10) mes "中央値 = " + stat_median(scores, 10) mes "標準偏差 = " +
sample\basic\sample_stat.hsp - 2026/04/16
sample_statemachine.hsp
#include "iron_statemachine.hsp" sm_add_state "idle" sm_add_state "running" sm_add_state "done" sm_set_state 0 sm_add_transition 0, "start", 1 sm_add_transition 1, "finish", 2 mes sm_state_name() sm_fire "start" mes sm_state_name() sm_fire "finish"
sample\basic\sample_statemachine.hsp - 2026/04/17
sample_stopwatch.hsp
#include "iron_stopwatch.hsp" sw_start repeat 10000 : loop mes "elapsed: " + sw_elapsed_ms() + " ms" mes "elapsed: " + sw_elapsed_us() + " us"
sample\basic\sample_stopwatch.hsp - 2026/04/17
sample_str2.hsp
#include "iron_str2.hsp" mes str_starts_with("hello", "he") mes str_repeat("ab", 3) mes str_trim(" hello ") mes str_upper("hello") mes str_count("abcabc", "a")
sample\basic\sample_str2.hsp - 2026/04/17
sample_strbuf.hsp
#include "iron_strbuf.hsp" sb_init 0 repeat 100 sb_append "item" + cnt + " " loop mes "length: " + sb_length() mes strmid(sb_tostr(), 0, 80) + "..."
sample\basic\sample_strbuf.hsp - 2026/04/17
sample_synth.hsp
#include "iron_synth.hsp" synth_sine "sine440.wav", 440.0, 1.0, 44100 mes "Generated sine440.wav (440Hz, 1sec)" synth_noise "noise.wav", 0.5, 44100 mes "Generated noise.wav (0.5sec)"
sample\basic\sample_synth.hsp - 2026/04/17
sample_taskdialog.hsp
#include "iron_taskdialog.hsp" 例1: コマンドリンク形式の選択ダイアログ taskdlg "保存の確認", "変更を保存しますか?", "ファイルに未保存の変更があります。
sample\basic\sample_taskdialog.hsp - 2026/04/18
sample_tcp.hsp
#include "iron_tcp.hsp" mes "tcp sample (requires server)"
sample\basic\sample_tcp.hsp - 2026/04/18
sample_test.hsp
#include "iron_test.hsp" test_begin "example" assert_eq "1", "1", "one is one" assert_true 1, "true is true" test_end
sample\basic\sample_test.hsp - 2026/04/17
sample_uri.hsp
#include "iron_uri.hsp" uri_parse "https: example.com:8080/api/v1?key=val&n=1#section" mes "scheme: " + uri_scheme() mes "host: " + uri_host() mes "port: " + uri_port() mes "path: " + uri_path() mes "query: " + uri_query() mes "fragment: " +
sample\basic\sample_uri.hsp - 2026/04/17
sample_urlencode.hsp
#include "iron_urlencode.hsp" mes "encode: " + urlencode("hello world & foo=bar") mes "decode: " + urldecode("hello%20world%20%26%20foo%3Dbar")
sample\basic\sample_urlencode.hsp - 2026/04/17
sample_uuid.hsp
#include "iron_uuid.hsp" repeat 5 mes uuid_generate() loop
sample\basic\sample_uuid.hsp - 2026/04/17
sample_validate.hsp
#include "iron_validate.hsp" mes "required: " + validate_required("hello") mes "required empty: " + validate_required("") mes "email: " + validate_email("test@example.com") mes "email bad: " + validate_email("invalid") mes "numeric: " +
sample\basic\sample_validate.hsp - 2026/04/17
sample_variadic.hsp
sample_variadic.hsp ? 可変長引数 (...) サンプル #func / #cfunc のパラメータリスト末尾に ... を書くことで、 C の printf 系のような可変長引数 DLL 関数を呼べます。
sample\basic\sample_variadic.hsp - 2026/04/16
sample_vcam.hsp
#include "iron_vcam.hsp" 仮想カメラの解像度とフレームレート cam_w = 640 cam_h = 480 cam_fps = 30 HSP ウィンドウをカメラと同じサイズに設定 screen 0, cam_w, cam_h title "IronHSP Virtual Webcam Demo" 仮想カメラ初期化 vcam_init cam_w, cam_h, cam_fps if stat != 0 { dialog
sample\basic\sample_vcam.hsp - 2026/04/18
sample_wasapi.hsp
title "WASAPI 録音サンプル" WASAPI 初期化 wasapi_init if stat < 0 { dialog "WASAPI の初期化に失敗しました" end } キャプチャデバイス一覧を表示 wasapi_device_list WASAPI_DIR_CAPTURE, devnames dev_count = stat mes "キャプチャデバイス数: " + dev_count if dev_count <= 0 { dialog
sample\basic\sample_wasapi.hsp - 2026/04/18
sample_websocket.hsp
#include "iron_websocket.hsp" mes "websocket sample (requires server)"
sample\basic\sample_websocket.hsp - 2026/04/18
sample_yaml.hsp
#include "iron_str2.hsp" #include "iron_yaml.hsp" yml = "name: IronHSP\nversion: 3.8\nauthor: inovia" yaml_load yml mes "name=" + yaml_get("name") mes "version=" + yaml_get("version")
sample\basic\sample_yaml.hsp - 2026/04/17
sample_zip_net.hsp
#include "hsp3_net_64.as" #include "iron_zip_net.hsp" mes "zip_net sample"
sample\basic\sample_zip_net.hsp - 2026/04/18
star.hsp
randomize screen 0,320,240,0 cls 4 buffer 3,320,240,0 cls 4 font "MS ゴシック",40,1 buffer 4,,,0 cls 0 *main gsel 3 gmode 0,320,240 pos 5,5:gzoom 310,230,0 gmode 6,320,240,2 pos 0,0:gcopy 4,0,0 x=rnd(320)-20: y=rnd(240)-20 color
sample\basic\star.hsp - 2009/03/10
starmove.hsp
test2 buffer 1,320,240 color 12,12,12 boxf screen 0,320,240 cls 1 font "MS ゴシック",40,1 cvalue=0.0 *main redraw 0 gmode 6,320,240,256 pos 0,0:gcopy 1 dir=cvalue size=70+sin(cvalue)*30 repeat 16 x=150+sin(dir+cvalue)*size y=102+cos(dir-cvalue)*size
sample\basic\starmove.hsp - 2009/03/10
stars.hsp
test1 randomize cls 4 font "MS ゴシック",40,1 repeat color rnd(256),rnd(256),rnd(256) pos rnd(640)-20,rnd(480)-20:mes "★" wait 1 loop stop
sample\basic\stars.hsp - 2009/03/10
statusbar.hsp
#include "mod_stbar.as" screen 0,640,480 stbar_ini ステータスバー作成 screen 1,640,480 stbar_ini ステータスバー作成 oncmd gosub *event_WM_SIZE, 0x0005 WM_SIZE割り込み gsel 0 stbar_text "テストです" テキストを設定 gsel 1 stbar_text "リサイズに対応しています" テキストを設定 stop *event_WM_SIZE
sample\basic\statusbar.hsp - 2009/05/18
stick.hsp
stick命令によるメニュー選択サンプル cls 4 color 255,255,255 pos 300,180:mes "SELECTION-1" pos 300,200:mes "SELECTION-2" pos 300,220:mes "SELECTION-3" pos 300,240:mes "PROGRAM END" a=0 x=280:y=180:sel=0:maxsel=3 *selmain color 0,0,0:boxf x,y,x+20,y+20 y=sel*20+180
sample\basic\stick.hsp - 2009/03/10
str.hsp
10進数<->16進数変換サンプル a=0 b="" pos 0,0:input a pos 0,30:input b pos 70,2:mes "10進数" pos 70,32:mes "16進数" pos 0,60 objsize 200,24 button "10進->16進変換",*in10 button "16進->10進変換",*in16 button "終了",*owari stop *in10 n=strf("%x",a) objprm 1,n stop *in16
sample\basic\str.hsp - 2009/03/10
strf.hsp
書式指定付き文字列変換(strf)テスト a=123 mes strf("10進[%d]",a) mes strf("16進[%x]",a) mes strf("10進桁数指定付き[%05d]",a) mes strf("16進桁数指定付き[%05x]",a) a=sqrt(2) mes strf("10進実数[%f]",a) mes strf("10進実数桁数指定付き[%3.10f]",a) stop
sample\basic\strf.hsp - 2009/03/10
strmid.hsp
i=" -" mes i a="ABCDEFG" mes "もとの文字列="+a b=strmid(a,0,3) mes "左から3文字を取り出す="+b b=strmid(a,-1,3) mes "右から3文字を取り出す="+b b=strmid(a,2,3) mes "2文字目から3文字を取り出す="+b mes i c=instr(a,0,"FG") mes "文字列「FG」のある場所="+c c=instr(a,0,"AB") mes "文字列「AB」のある場所="+c
sample\basic\strmid.hsp - 2009/03/10
switch.hsp
title "SWITCH~CASE Test" screen 0,240,160 a=-1 combox a,100,"青\n赤\n緑" *main while bak_a=a:wait 5:wend bak_a=a switch a case 0 color 0,0,255 swbreak case 1 color 255,0,0 swbreak case 2 color 0,255,0 swbreak default color 128,128,128 swbreak swend
sample\basic\switch.hsp - 2009/03/10
sysinfo.hsp
OS環境の情報を表示する mes "OS = "+sysinfo(0) mes "USER = "+sysinfo(1) mes "MACHINE = "+sysinfo(2) mes "CPU CODE = "+sysinfo(16) mes "CPU NUM = "+sysinfo(17) mes "USED MEMORY % = "+sysinfo(33) mes "TOTAL MEMORY = "+sysinfo(34) mes "FREE MEMORY = "+sysinfo(35)
sample\basic\sysinfo.hsp - 2009/03/10