I wrote a script, the main purpose of which is to display children of a select slice sequentially.
This mimics textboxes, but being slice based can be adapted to any resolution and display any kind of slices (obviously)
It (progressively) navigates the children of a select slice with the lookup code "select"
If the current index has a child called "skip" it will automatically progress after waiting a number of ticks equal to extra data 0 of skip
Each child in the index, when navigated to, can call a textbox (which advances automatically) and jump to e.g. another select slice in another slice collection.
The next step is to figure out conditional branching.
edit: extra data 1 is used for tag to check. Negative value means if the tag is off (I think. untested)
Code: Select all
plotscript, slice chainer, arg, begin
variable(
select,
selindx, cuindx
selindxdat0, selindxdat1, selindxdat2,
skip, check, jump, control
skip0, skip1, skip2,
check1, check2, check0,
jump0, jump1, jump2,
control0, control1, control2,
press)
suspend player
suspend NPCs
variable(hold)
hold:=load slice collection (arg)
WHILE(true)DO(
select:=lookup slice (sli:select, hold)
selindx:=get select slice index(select)
cuindx:=slice child (select, selindx)
## this is the textbox to use. it advances automatically
selindxdat0:=get slice extra (cuindx,0)
IF(selindxdat0>0)THEN(show textbox(selindxdat0), advance textbox)
## this is a tag check
selindxdat1:=get slice extra (cuindx,1)
## this allows to end the chain, and can use the tag check
selindxdat2:=get slice extra (cuindx,2)
IF(skip:=lookupslice(sli:skip,hold))THEN(
skip0:=get slice extra (skip,0)
## how many ticks to wait.
skip1:=get slice extra (skip,1)
skip2:=get slice extra (skip,2)
)
IF(check:=lookupslice(sli:check,hold))THEN(
check0:=get slice extra (check,0)
check1:=get slice extra (check,1)
check2:=get slice extra (check,2)
)
IF(jump:=lookupslice(sli:jump,hold))THEN(
jump0:=get slice extra (jump,0)
jump1:=get slice extra (jump,1)
jump2:=get slice extra (jump,2)
)
IF(control:=lookupslice(sli:control,hold))THEN(
control0:=get slice extra (control,0)
control1:=get slice extra (control,1)
control2:=get slice extra (control,2)
)
IF(skip)THEN(wait(skip0),free slice(cuindx),continue)
ELSE(wait(18))
## compare the children of the current index of select against types/codes
## skip
## full check
## wait for key. control.
IF(skip<>first child(cuindx))THEN()
ELSE(
press:=wait for key(anykey)
IF(control<>first child(cuindx))THEN()
ELSE(
IF(press:=left key&&cuindx<>first child(select))THEN(set select slice index (select, selindx--1),continue)
IF(press:=right key&&cuindx<>last child(select))THEN(set select slice index (select, selindx+1),continue)
)
)
##THEN(wait for key(anykey), exit script)
## 0 shows a textbox. 1... 2 starts a new conversation
## show textbox based on extra data of the current slice in the select's index
## change NPC ID based on the extra data 1
## IF(selindxdat1>0)THEN(change NPC ID(NPC, selindxdat1))
IF(
sign (selindxdat1)<0
)
THEN(
IF(check tag(selindxdat1)==false)
THEN(
IF(selindxdat2>0)
THEN(free slice (hold), slice chainer(selindxdat2), break, break)
ELSEIF(selindxdat2<0)
THEN(free slice (hold), resume player, resume NPCs , break, break)
)
)
ELSEIF(sign (selindxdat1)>0)
THEN(
IF(check tag(selindxdat1)==true)THEN(
IF(selindxdat2>0)THEN(free slice (hold), slice chainer(selindxdat2), break, break)
ELSEIF(selindxdat2<0)
THEN(free slice (hold), resume player, resume NPCs, break, break)
) ## THEN
)
IF(
(selindx)== (child count(select) -- 1))
THEN(
free slice (hold),
resume player,
resume NPCs,
break, break)
ELSE(
IF(cuindx<>control)THEN(
##set select slice index (select, selindx+1)
free slice(cuindx)
))
wait
) ## do
end