Jump to content


Photo

Menu Script


  • Please log in to reply
No replies to this topic

#1 geniusalz

geniusalz

    Team MXM

  • Head Moderators
  • PipPipPipPipPip
  • 1,827 posts
  • Gender:Male
  • Xbox Version:v1.1
  • 360 version:unknown

Posted 27 December 2003 - 06:41 PM

This script reads a list of items from a text file, and shows a menu, letting the user select an item from there.

Here is the script (works with the latest WIP only):
CODE
OPENREAD listFile c:test.txt
READFILELN listFile numLines

XMLCreate lst "Main"
set temp %numlines%
add temp 1
FOR i = 1 to %temp%
READFILELN listFile curLine
XMLSetValue lst !.%i%  %curLine%
XMLGetValue lst TEMP !.%i%
NEXT

CLOSEFILE listFile

SET pos 1
SET top 0

GOSUB DRAWMENU

:Start
IQWaitMsg UI_UP UI_DN UI_RT UI_LF UI_SELECT UI_BACK

IF %MSG_ID% == "UI_SELECT" GOTO DONE
IF %MSG_ID% == "UI_UP" GOTO label1
IF %MSG_ID% == "UI_DN" GOTO label2
QUIT
GOTO label3
:label1
SET temp %pos%
ADD temp %top%
IF# %temp% > 1 GOTO label4
GOTO label5
:label4
IF# %pos% > 1 GOTO label6
SUB top 1
GOTO label7
:label6
SUB pos 1
:label7
:label5
GOTO label3
:label2
SET TEMP1 %pos%
ADD TEMP1 %top%
ADD temp1 1
IF# %TEMP1% > %numlines% GOTO label3
ADD pos 1
IF# %pos% > 7 GOTO label8
GOTO label9
:label8
SUB pos 1
ADD top 1
:label9
:label3

GOSUB DRAWMENU
GOTO START


:DONE
SET _selectNum %pos%
ADD _selectNum %top%

XMLGetValue lst _selectName !.%_selectNum%
Begindraw
Messagebox "%_selectName% was selected at position %_selectNum%"
IQWaitMsg any
ENddraw


:DRAWMENU
BEGINDRAW

SET temp %pos%
MULT temp 20
BOX 0 %temp% 640 20 0x00000000 WHITE

FOR j = 1 TO 8
SET TEMP %j%
MULT TEMP 20
SET linenumb %top%
ADD linenumb %j%
XMLGetValue lst TEM !.%linenumb%
;Begindraw
;Messagebox %TEM%%linenumb%
;IQWaitMsg any
;ENddraw
Text 320 %TEMP% CENTER %TEM% WHITE
NEXT

ENDDRAW

RETURN


Here is a test menu file (C:test.txt):
CODE
20
first
second
third
fourth
fifth
sixth
seventh
eigth
ninth
tenth
eleventh
twelfth
thirteenth
fourteenth
fifteenth
sixteenth
seventeenth
eighteenth
nineteenth
twentieth

Edited by geniusalz, 27 December 2003 - 07:19 PM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users