麦克雷
标题:
drtc forth码进阶 简易武器摘选
[打印本页]
作者:
AlbertHen
时间:
2024-8-18 22:32
标题:
drtc forth码进阶 简易武器摘选
uses 网页链接 0 value arrow-manu-num
0 value arrow-manu-num-max
0 value arrow-weapon-num
0 stack // 这个客栈的武器可以自己替换
WEAPON_STRENGTH-INJECT shove
WEAPON_FITNESS-INJECT shove
WEAPON_SHOOTING-INJECT shove
WEAPON_VITALITY-INJECT shove
WEAPON_DEXTERITY-INJECT shove
constant WEAPON_LIST_INJECT
: list-all-in-text ( Weapon_Stack - ) // 简易forth则选
dup depths to arrow-manu-num-max
arrow-manu-num-max for
arrow-manu-num-max arrow-manu-num < if arrow-manu-num-max to arrow-manu-num then
arrow-manu-num 1 < if
1 to arrow-manu-num then
+cr
i picks weaponid$
i arrow-manu-num-max arrow-manu-num - 1 + = if .. " <-" .. then
+text
i arrow-manu-num-max arrow-manu-num - 1 + = if i to arrow-weapon-num then
next
;
作者:
AlbertHen
时间:
2024-8-18 22:32
// 流程 检测stack的深度并赋给arrow-manu-num-max
// arrow-manu-num-max次循环
// 如果stack深度比箭头指数小 那么降stack深度赋给箭头指数
// 箭头指数小于1则将1赋给箭头指数
// 空格
// 则选从上到下第n次<i>的值的id打印
// 如果i的值与箭头数相同则打印箭头
// 同时将此数赋给arrow-weapon-num
: grab-the-weapon-out-from-stack // 摘取武器
depths for
i arrow-weapon-num = if i picks 1 swap trunk.weapon+ break then
next
drop
;
// 如果i与arrow-weapon-num相等那就摘取i上的武器与1交换位置再通过trunk.weapon+函数后结束循环
defer do-test-forth-again
cyoa: last-forth
-1 ' arrow-manu-num +!
do-test-forth-again
;
cyoa: next-forth
1 ' arrow-manu-num +!
do-test-forth-again
;
cyoa: grab-the-weapon-out-from-stack-bridge
WEAPON_LIST_INJECT grab-the-weapon-out-from-stack
do-test-forth-again
;
cyoa: do-test-forth
WEAPON_LIST_INJECT list-all-in-text
choice( "Last" )choice: last-forth
choice( "Next" )choice: next-forth
choice( "Grab this" )choice: grab-the-weapon-out-from-stack-bridge
choice( "Leave" )choice
;
last to do-test-forth-again
作者:
AlbertHen
时间:
2024-8-18 22:33
那个网页链接是cyoa文件
欢迎光临 麦克雷 (http://imac.ly/)
Powered by Discuz! X3.5