xboxscene.org forums

OG Xbox Forums => Official MediaXMenu (MXM) Forum => Dashboard Forums => MXM ActionScripting Forum => Topic started by: geniusalz on November 02, 2003, 11:38:00 PM

Title: Menu Builder Script
Post by: geniusalz on November 02, 2003, 11:38:00 PM
wink.gif
Title: Menu Builder Script
Post by: geniusalz on November 03, 2003, 02:17:00 PM
CODE

 
  Games
 
    e:Games
 

 
   
      e:Apps
   

 




Instead of
CODE


 
    Games
   
      e:Games
   

 


 
    Apps
   
      e:Apps
   

 




Edit:
PM me if you have worked with XML in actionscripts and can help out.
Title: Menu Builder Script
Post by: geniusalz on November 03, 2003, 04:57:00 PM
No, we're creating the xml from scratch, seraching through folders on E: or F:

Another major roadblock I'm facing is that during recursive actionscript calls, the exact error message isn't displayed.
All it says is "ERROR (line 1): (callfile) "ActionScript file failed execution"

BJ, if you can help me get the proper error messages, it would be great.
Title: Menu Builder Script
Post by: BenJeremy on November 03, 2003, 05:02:00 PM
QUOTE (geniusalz @ Nov 3 2003, 08:57 PM)
No, we're creating the xml from scratch, seraching through folders on E: or F:

Another major roadblock I'm facing is that during recursive actionscript calls, the exact error message isn't displayed.
All it says is "ERROR (line 1): (callfile) "ActionScript file failed execution"

BJ, if you can help me get the proper error messages, it would be great.

Yeah, I'll be digging into that this week. I improved the error messages in the root script, but not in the subscripts  ohmy.gif Ah well, later this week I'll have an update that will fix this.
Title: Menu Builder Script
Post by: BenJeremy on November 03, 2003, 08:07:00 PM
It should be done. Give it a whirl (I didn't test it) with the latest "WIP" binaries.

So much for "later in the week".....
Title: Menu Builder Script
Post by: geniusalz on November 03, 2003, 09:19:00 PM
QUOTE

2) Second, would it be possible to include a menu editor integrated into the dashboard? No other dash has this, and i think this would provide a good chance to get ahead in the game.

ONce again great work. Im probably asking for a lot.


laugh.gif
Title: Menu Builder Script
Post by: geniusalz on November 06, 2003, 07:18:00 AM
wink.gif

But here it is anyway

Alpha version, will NOT WORK properly!
Call menubuilder.xas from your menu, and it will also need getMenuPos.

menubuilder.xas : Goes through all the directories and subdirectories on E.  Change to F if you need
CODE
SETFUNC TRI TRIM %_rdir%
SETFUNC LE LENGTH TR
IF# LE == 0 GOTO makedir

GOTO BLAH

:makedir
SET _rdir E:\*
COPY C:\Default.xml C:\TestMenu.xml
XMLOPEN TestXML C:\TestMenu.xml
XMLCreate TestXML Menu
XMLCLOSE TestXML


:BLAH
BeginDraw UseCurrent
MessageBox "Searching %_rdir%"
EndDraw
INPUT

BEGINSEARCH %_rdir%



:TOP
SEARCHTYPE s_type
SEARCHITEM s_name
SEARCHSIZE s_size

SETFUNC newfoldername REPLACE "\\*" "" "%s_name%"
IF %s_type% == "dir" GOTO DIRFOUND
IF %s_type% == "file" GOTO SKIPFILE
GOTO QU

:DIRFOUND
BeginDraw UseCurrent
MessageBox "%newfoldername% found.$eol$Press A to search subdirectories,$eol$Press B to add it to your menu.$eol$Press X to Skip Folder$eol$Press Y to quit"
EndDraw

 Input
   If %_GP_A% == "1" GOTO SearchSubdir
   If %_GP_B% == "1" GOTO AddToMenu
   If %_GP_Y% == "1" GOTO QU
   If %_GP_X% == "1" GOTO SKIPFILE
GOTO DIRFOUND

:SearchSubdir
SET _rdir %newfoldername%\*
CallFile c:\menubuilder.xas
SEARCHNEXT

:AddToMenu
SET _menuLoc "!"
Set _FinalMenuLoc "!"
CallFile c:\getMenuPos.xas

BeginDraw
Messagebox "Adding to %_FinalMenuLoc%"
EndDraw
INPUT

XMLOPEN TestXML C:\TestMenu.xml
XMLSetNodePtr TestXML %_FinalMenuLoc%
XMLGetNodeCount TestXML Counter
XMLCreateNode TestXML SubMenu
XMLSetValue TestXML %_FinalMenuLoc%.SubMenu:%Counter%.Title %search_name%
XMLSetValue TestXML %_FinalMenuLoc%.SubMenu:%Counter%.Item.Autodir %newfoldername%
XMLSave TestXML C:\TestMenu.xml
XMLCLOSE TestXML

:SKIPFILE
SEARCHNEXT
GOTO TOP


:QU
SET _rdir ""
ENDSEARCH
QUIT


getMenuPos.xas : goes through the current TestMenu.xml and finds a place to put the game.  If there are no submenus, just puts the game in root
CODE
XMLOPEN TestXML "C:\TestMenu.xml"
XMLSetNodePtr TestXML %_menuLoc%
SET curNod %_menuLoc%

BeginDraw UseCurrent
MessageBox "Searching %_menuLoc%"
EndDraw
INPUT

SET INDEX -1

:TOP
ADD INDEX 1
XMLGetValue TestXML SubMenuName %_menuLoc%.Submenu:%INDEX%.Title
SETFUNC TR TRIM %SubMenuName%
SETFUNC LENG LENGTH TR
IF# LENG == 0 GOTO NOMORE

BeginDraw UseCurrent
MessageBox "%SubMenuName% found.$eol$Press A to search SubMenus,$eol$Press B to add here.$eol$Press X to skip submenu.$eol$Press Y to quit"
EndDraw
GOTO NEXT

:NOMORE
BeginDraw UseCurrent
MessageBox "No More SubMenus Here.  Press A to add here"
EndDraw
INPUT
GOTO AddHere

:NEXT
 INPUT
   If %_GP_A% == "1" GOTO SearchSubMenu
   If %_GP_B% == "1" GOTO AddHere
   If %_GP_Y% == "1" GOTO QU
   If %_GP_X% == "1" GOTO SKIP

:SearchSubMenu
SET _MenuLoc %_MenuLoc%.Submenu:%INDEX%
XMLCLOSE TestXML
CallFile c:\getMenuPos.xas
XMLOPEN TestXML "C:\TestMenu.xml"
XMLSetNodePtr TestXML %curNod%

:RETURN
QUIT

:AddHere
SET _FinalMenuLoc %curNod%
QUIT

GOTO TOP

:QU
XMLCLOSE TESTXML
QUIT


Not very well-written, I know.

Tell me if you get it working properly

Edit: fixed \'s