xboxscene.org forums

Author Topic: Actionscript Collection  (Read 370 times)

Yuyu

  • Archived User
  • Hero Member
  • *
  • Posts: 908
Actionscript Collection
« on: February 12, 2004, 05:48:00 PM »

Please when posting your actionscripts to this thread include the following:
Name of Actionscript
Author
Version
Purpose or Reason for Use
Special Instructions of Use
THe script itself and supporting files
Link to thread for questions and answers

I have posted an example for you all....
Thanks Guys

P.S. Sorry, but to keep this thread organized I will delete any posts that are not actionscripts, and are questions or other ramblings...

This post has been edited by Yuyu: Feb 15 2004, 01:41 AM <
Logged

Yuyu

  • Archived User
  • Hero Member
  • *
  • Posts: 908
Actionscript Collection
« Reply #1 on: February 12, 2004, 06:02:00 PM »

Actionscript Name: Fan Speed Adjuster
Author: KoldFuzion, Min-Max mod by fastTOE,Original concept by vexx22, additional motivation by Taiger
Version: 1.1
Purpose: Allows user to set fan speed manually between 10-50%
Instructions: Follow on-screen dialog
For Q&A's about this script visit this thread: N/A

Save As - FanSpeed.xas
CODE
;#################################
;#  Fan Speed Adjuster
;#  Author: KoldFuzion, Min-Max mod by fastTOE
;#          Original concept by vexx22, aditional motivation by Taiger
;#  Filename: FanSpeed.xas
;#  Date: 11-10-2003
;#  Version 1.1
;#  Purpose:  allows user to set fan speed manually between 10-50%
;##################################

SET NEWFANSPEED $FanSpeed$

GOTO START

:START
BeginDraw UseCurrent
MessageBox "FanSpeed is currently : $FanSpeed$$eol$$eol$A to Increase speed 1$eol$X to Increase speed 5$eol$B to Decrease speed 1$eol$Y to Decrease speed 5$eol$START to Maximize speed$eol$BACK to Minimize speed$eol$BLACK TO QUIT"
EndDraw
Input
 If %_GP_A% == "1" GOTO INCREASEONE
 If %_GP_X% == "1" GOTO INCREASEFIVE
 If %_GP_B% == "1" GOTO DECREASEONE
 If %_GP_Y% == "1" GOTO DECREASEFIVE
 If %_GP_START% == "1" GOTO MAXIMIZE  
 If %_GP_BACK% == "1" GOTO MINIMIZE
 If %_GP_BLACK% == "1" GOTO QUIT
GOTO START


:INCREASEONE
ADD NEWFANSPEED 1
GOTO DOFAN

:INCREASEFIVE
ADD NEWFANSPEED 5
GOTO DOFAN


:DECREASEONE
SUB NEWFANSPEED 1
GOTO DOFAN

:DECREASEFIVE
SUB NEWFANSPEED 5
GOTO DOFAN

:MAXIMIZE
SETFANSPEED Manual 50
SETFANSPEED Manual 50
SET NEWFANSPEED 50
BeginDraw UseCurrent
MessageBox "FanSpeed is at it's maximum"
EndDraw
Delay 2
GOTO START

:MINIMIZE
SETFANSPEED Manual 10
SETFANSPEED Manual 10
SET NEWFANSPEED 10
BeginDraw UseCurrent
MessageBox "FanSpeed is at it's minimum"
EndDraw
Delay 2
GOTO START

:DOFAN
IF# %NEWFANSPEED% <= 9 GOTO TOOLOW
IF# %NEWFANSPEED% >= 51 GOTO TOOHIGH
SETFANSPEED Manual %NEWFANSPEED%
GOTO START

:TOOLOW
SETFANSPEED Manual 10
SET NEWFANSPEED 10
BeginDraw UseCurrent
MessageBox "WARNING!!$eol$Setting FanSpeed BELOW 10 is not permitted$eol$Doing so may damage your xbox.$eol$$eol$Press A to Continue"
EndDraw
Input
 If %_GP_A% == "1" GOTO START
 If %_GP_BLACK% == "1" GOTO QUIT
GOTO TOOLOW

:TOOHIGH
SETFANSPEED Manual 50
SET NEWFANSPEED 50
BeginDraw UseCurrent
MessageBox "Unable to set FanSpeed ABOVE 50.$eol$$eol$Press A to Continue"
EndDraw
Input
 If %_GP_A% == "1" GOTO START
 If %_GP_BLACK% == "1" GOTO QUIT
GOTO TOOHIGH


:QUIT
QUIT


This post has been edited by Yuyu: Feb 13 2004, 03:48 AM <
Logged

flattspott

  • Archived User
  • Hero Member
  • *
  • Posts: 1220
Actionscript Collection
« Reply #2 on: February 12, 2004, 07:48:00 PM »

Actionscript Name: Entry Maker
Author: flattspott
Version: 6
Purpose: Allows user to make MXM Entries on the xbox
Instructions: Included in the script file
For Q&A's and more info about this script visit this thread: EntryMaker

EDIT: Sorry guys this is a WIP script.  

This post has been edited by flattspott: May 27 2004, 10:32 AM <
Logged

tayior7

  • Archived User
  • Full Member
  • *
  • Posts: 195
Actionscript Collection
« Reply #3 on: February 16, 2004, 08:29:00 PM »

Actionscript Name: MXMPasswordScript
Author: tayior7
Version: 1.1
Purpose: Alternate password option, hides actauly password
Instructions: view readme.txt (below)
For Q&A's about this script visit this thread: N/A

Readme:
CODE

MXMPasswordScript V1.1
WRITTEN BY tayior7
thanks to kthulu for helping me get around that bug in MXM!

this script will ask for a password before launching a user specified file.  Unlike the original passcode, this will use the buttons on your controller and will not be visable to the user.  You can use this on as many items as u want, each with a different password, or whatever you want.  To use on more than one item, just use different variables (duh)

How to use script in menu.xml


Game1

 SET DIGIT1a A
 SET DIGIT2a B
 SET DIGIT3a X
 SET DIGIT4a Y
 SET DIGIT5a A
 SET PWSCRIPTPATH "E:\\scripts"
 SET PATHNAME "C:\\folder\\anotherfolder"
 SET FILENAME "default.xbe"
 Callfile %PWSCRIPTPATH%\pw.xas




What each line is:

################################################################
 SET DIGIT1a A
 SET DIGIT2a B
 SET DIGIT3a X
 SET DIGIT4a Y
 SET DIGIT5a A
================================================================
These lines are used to define the password, in this example, the password would be A,B,X,Y,A.  You can change each variable however you want, using these...
A = A button
B = B button
X = X button
Y = Y button
BLACK = black button
WHITE = white button
START = start button
BACK = back button
DUP = d-pad up
DDN = d-pad down
DRT = d-pad right
DLF = d-pad left
TRLF = left thumbstick
TRRT = right thumbstick
for some reason the triggers wont work, but if for some reason you wanna try, u need to use:
TRT = right trigger
TLT = left trigger
################################################################



################################################################
 SET PWSCRIPTPATH "E:\\scripts"
================================================================
This line tells MXM where the scripts are.  The above line would tell MXM that pw.xas and pwscreen.xas are in E:\scripts\pw.xas and  E:\scripts\pwscreen.xas
################################################################



################################################################
 SET PATHNAME "C:\\folder\\anotherfolder"
 SET FILENAME "default.xbe"
================================================================
These lines tell the script what to launch if the password is correct.  This above example would launch "C:\folder\anotherfolder\default.xbe"
MAKE SURE THAT YOU HAVE DOUBLE \'S!!! IF YOU DONT, IT WONT WORK! ALSO MAKE SURE YOU HAVE QUOTES AROUND IT!
################################################################



################################################################
 Callfile %PWSCRIPTPATH%\pw.xas
================================================================
This line executes the password script.  Do not modify this line unless you know what ur doin.
################################################################


You can also put all the lines (except the Callfile line) inside pw.xas for added security.


Final Example:
IF YOU WANT THE PASSWORD TO BE BLACK,WHITE,DPAD UP, DPAD DOWN, BLACK  AND IT TO LAUCH "E:\DASHBOARDS\EVOX\EVOXDASH.XBE" THEN YOU WOULD DO THIS:


LAUNCH EVOX

 SET DIGIT1a BLACK
 SET DIGIT2a WHITE
 SET DIGIT3a DUP
 SET DIGIT4a DDN
 SET DIGIT5a BLACK
 SET PWSCRIPTPATH "E:\\scripts"
 SET PATHNAME "E:\\dashboards\\evox"
 SET FILENAME "evoxdash.xbe"
 Callfile %PWSCRIPTPATH%\pw.xas




Save As - pw.xas
CODE

;##################################################
;#  Name: MXMPasswordScript
;#  Author: tayior7
;#  Date: 3-20-2004
;#  File Name: pw.xas
;#  Version: 1.1
;#  Purpose: Alternate password option, hides actauly password
;#  Save file as: pw.xas
;##########################################################

:DIGIT1
SET PWTEXT "Enter password"
Callfile %PWSCRIPTPATH%\pwscreen.xas
Input
IF %_GP_A% == "1" GOTO A1
IF %_GP_B% == "1" GOTO B1
IF %_GP_X% == "1" GOTO X1
IF %_GP_Y% == "1" GOTO Y1
IF %_GP_BLACK% == "1" GOTO BLACK1
IF %_GP_WHITE% == "1" GOTO WHITE1
IF %_GP_START% == "1" GOTO START1
IF %_GP_BACK% == "1" GOTO BACK1
IF %_GP_D_UP% == "1" GOTO DUP1
IF %_GP_D_DN% == "1" GOTO DDN1
IF %_GP_D_RT% == "1" GOTO DRT1
IF %_GP_D_LF% == "1" GOTO DLF1
IF %_GP_TRG_RT% == "1" GOTO TRT1
IF %_GP_TRG_LT% == "1" GOTO TLT1
IF %_GP_THUMB_LF% == "1" GOTO TRLF1
IF %_GP_THUMB_RT% == "1" GOTO TRRT1
QUIT

:A1
SET digit1 A
GOTO digit2
:B1
SET digit1 B
GOTO digit2
:X1
SET digit1 X
GOTO digit2
:Y1
SET digit1 Y
GOTO digit2
:BLACK1
SET digit1 BLACK
GOTO digit2
:WHITE1
SET digit1 WHITE
GOTO digit2
:START1
SET digit1 START
GOTO digit2
:BACK1
SET digit1 BACK
GOTO digit2
:DUP1
SET digit1 DUP
GOTO digit2
:DDN1
SET digit1 DDN
GOTO digit2
:DRT1
SET digit1 DRT
GOTO digit2
:DLF1
SET digit1 DLF
GOTO digit2
:TRT1
SET digit1 TRT
GOTO digit2
:TLT1
SET digit1 TLT
GOTO digit2
:TRLF1
SET digit1 TRLF
GOTO digit2
:TRRT1
SET digit1 TRRT
GOTO digit2


:DIGIT2
SET DIGIT1e "#"
Callfile %PWSCRIPTPATH%\pwscreen.xas
Input
IF %_GP_A% == "1" GOTO A2
IF %_GP_B% == "1" GOTO B2
IF %_GP_X% == "1" GOTO X2
IF %_GP_Y% == "1" GOTO Y2
IF %_GP_BLACK% == "1" GOTO BLACK2
IF %_GP_WHITE% == "1" GOTO WHITE2
IF %_GP_START% == "1" GOTO START2
IF %_GP_BACK% == "1" GOTO BACK2
IF %_GP_D_UP% == "1" GOTO DUP2
IF %_GP_D_DN% == "1" GOTO DDN2
IF %_GP_D_RT% == "1" GOTO DRT2
IF %_GP_D_LF% == "1" GOTO DLF2
IF %_GP_TRG_RT% == "1" GOTO TRT2
IF %_GP_TRG_LT% == "1" GOTO TLT2
IF %_GP_THUMB_LF% == "1" GOTO TRLF2
IF %_GP_THUMB_RT% == "1" GOTO TRRT2
QUIT

:A2
SET digit2 A
GOTO digit3
:B2
SET digit2 B
GOTO digit3
:X2
SET digit2 X
GOTO digit3
:Y2
SET digit2 Y
GOTO digit3
:BLACK2
SET digit2 BLACK
GOTO digit3
:WHITE2
SET digit2 WHITE
GOTO digit3
:START2
SET digit2 START
GOTO digit3
:BACK2
SET digit2 BACK
GOTO digit3
:DUP2
SET digit2 DUP
GOTO digit3
:DDN2
SET digit2 DDN
GOTO digit3
:DRT2
SET digit2 DRT
GOTO digit3
:DLF2
SET digit2 DLF
GOTO digit3
:TRT2
SET digit2 TRT
GOTO digit3
:TLT2
SET digit2 TLT
GOTO digit3
:TRLF2
SET digit2 TRLF
GOTO digit3
:TRRT2
SET digit2 TRRT
GOTO digit3

:DIGIT3
SET DIGIT2e "#"
Callfile %PWSCRIPTPATH%\pwscreen.xas
Input
IF %_GP_A% == "1" GOTO A3
IF %_GP_B% == "1" GOTO B3
IF %_GP_X% == "1" GOTO X3
IF %_GP_Y% == "1" GOTO Y3
IF %_GP_BLACK% == "1" GOTO BLACK3
IF %_GP_WHITE% == "1" GOTO WHITE3
IF %_GP_START% == "1" GOTO START3
IF %_GP_BACK% == "1" GOTO BACK3
IF %_GP_D_UP% == "1" GOTO DUP3
IF %_GP_D_DN% == "1" GOTO DDN3
IF %_GP_D_RT% == "1" GOTO DRT3
IF %_GP_D_LF% == "1" GOTO DLF3
IF %_GP_TRG_RT% == "1" GOTO TRT3
IF %_GP_TRG_LT% == "1" GOTO TLT3
IF %_GP_THUMB_LF% == "1" GOTO TRLF3
IF %_GP_THUMB_RT% == "1" GOTO TRRT3
QUIT

:A3
SET digit3 A
GOTO digit4
:B3
SET digit3 B
GOTO digit4
:X3
SET digit3 X
GOTO digit4
:Y3
SET digit3 Y
GOTO digit4
:BLACK3
SET digit3 BLACK
GOTO digit4
:WHITE3
SET digit3 WHITE
GOTO digit4
:START3
SET digit3 START
GOTO digit4
:BACK3
SET digit3 BACK
GOTO digit4
:DUP3
SET digit3 DUP
GOTO digit4
:DDN3
SET digit3 DDN
GOTO digit4
:DRT3
SET digit3 DRT
GOTO digit4
:DLF3
SET digit3 DLF
GOTO digit4
:TRT3
SET digit3 TRT
GOTO digit4
:TLT3
SET digit3 TLT
GOTO digit4
:TRLF3
SET digit3 TRLF
GOTO digit4
:TRRT3
SET digit3 TRRT
GOTO digit4

:DIGIT4
SET DIGIT3e "#"
Callfile %PWSCRIPTPATH%\pwscreen.xas
Input
IF %_GP_A% == "1" GOTO A4
IF %_GP_B% == "1" GOTO B4
IF %_GP_X% == "1" GOTO X4
IF %_GP_Y% == "1" GOTO Y4
IF %_GP_BLACK% == "1" GOTO BLACK4
IF %_GP_WHITE% == "1" GOTO WHITE4
IF %_GP_START% == "1" GOTO START4
IF %_GP_BACK% == "1" GOTO BACK4
IF %_GP_D_UP% == "1" GOTO DUP4
IF %_GP_D_DN% == "1" GOTO DDN4
IF %_GP_D_RT% == "1" GOTO DRT4
IF %_GP_D_LF% == "1" GOTO DLF4
IF %_GP_TRG_RT% == "1" GOTO TRT4
IF %_GP_TRG_LT% == "1" GOTO TLT4
IF %_GP_THUMB_LF% == "1" GOTO TRLF4
IF %_GP_THUMB_RT% == "1" GOTO TRRT4
QUIT

:A4
SET digit4 A
GOTO digit5
:B4
SET digit4 B
GOTO digit5
:X4
SET digit4 X
GOTO digit5
:Y4
SET digit4 Y
GOTO digit5
:BLACK4
SET digit4 BLACK
GOTO digit5
:WHITE4
SET digit4 WHITE
GOTO digit5
:START4
SET digit4 START
GOTO digit5
:BACK4
SET digit4 BACK
GOTO digit5
:DUP4
SET digit4 DUP
GOTO digit5
:DDN4
SET digit4 DDN
GOTO digit5
:DRT4
SET digit4 DRT
GOTO digit5
:DLF4
SET digit4 DLF
GOTO digit5
:TRT4
SET digit4 TRT
GOTO digit5
:TLT4
SET digit4 TLT
GOTO digit5
:TRLF4
SET digit4 TRLF
GOTO digit5
:TRRT4
SET digit4 TRRT
GOTO digit5

:DIGIT5
SET DIGIT4e "#"
Callfile %PWSCRIPTPATH%\pwscreen.xas
Input
IF %_GP_A% == "1" GOTO A5
IF %_GP_B% == "1" GOTO B5
IF %_GP_X% == "1" GOTO X5
IF %_GP_Y% == "1" GOTO Y5
IF %_GP_BLACK% == "1" GOTO BLACK5
IF %_GP_WHITE% == "1" GOTO WHITE5
IF %_GP_START% == "1" GOTO START5
IF %_GP_BACK% == "1" GOTO BACK5
IF %_GP_D_UP% == "1" GOTO DUP5
IF %_GP_D_DN% == "1" GOTO DDN5
IF %_GP_D_RT% == "1" GOTO DRT5
IF %_GP_D_LF% == "1" GOTO DLF5
IF %_GP_TRG_RT% == "1" GOTO TRT5
IF %_GP_TRG_LT% == "1" GOTO TLT5
IF %_GP_THUMB_LF% == "1" GOTO TRLF5
IF %_GP_THUMB_RT% == "1" GOTO TRRT5
QUIT

:A5
SET digit5 A
GOTO CHECKPW
:B5
SET digit5 B
GOTO CHECKPW
:X5
SET digit5 X
GOTO CHECKPW
:Y5
SET digit5 Y
GOTO CHECKPW
:BLACK5
SET digit5 BLACK
GOTO CHECKPW
:WHITE5
SET digit5 WHITE
GOTO CHECKPW
:START5
SET digit5 START
GOTO CHECKPW
:BACK5
SET digit5 BACK
GOTO CHECKPW
:DUP5
SET digit5 DUP
GOTO CHECKPW
:DDN5
SET digit5 DDN
GOTO CHECKPW
:DRT5
SET digit5 DRT
GOTO CHECKPW
:DLF5
SET digit5 DLF
GOTO CHECKPW
:TRT5
SET digit5 TRT
GOTO CHECKPW
:TLT5
SET digit5 TLT
GOTO CHECKPW
:TRLF5
SET digit5 TRLF
GOTO CHECKPW
:TRRT5
SET digit5 TRRT
GOTO CHECKPW

:CHECKPW
SET DIGIT5e "#"
:DIGIT1t
IF %digit1% == %DIGIT1a% GOTO DIGIT2t
IF %digit1% != %DIGIT1a% GOTO URWRONG

:DIGIT2t
IF %digit2% == %DIGIT2a% GOTO DIGIT3t
IF %digit2% != %DIGIT2a% GOTO URWRONG

:DIGIT3t
IF %digit3% == %DIGIT3a% GOTO DIGIT4t
IF %digit3% != %DIGIT3a% GOTO URWRONG

:DIGIT4t
IF %digit4% == %DIGIT4a% GOTO DIGIT5t
IF %digit4% != %DIGIT4a% GOTO URWRONG

:DIGIT5t
IF %digit5% == %DIGIT5a% GOTO PWCORRECT
IF %digit5% != %DIGIT5a% GOTO URWRONG

:URWRONG
SET PWTEXT "Password Incorrect"
Callfile %PWSCRIPTPATH%\pwscreen.xas
Delay 3
QUIT

:PWCORRECT
SET PWTEXT "Password Correct"
Callfile %PWSCRIPTPATH%\pwscreen.xas
Delay 2
CD %PATHNAME%
EXEC "%FILENAME%"
QUIT


Save As - pwscreen.xas
CODE

;##################################################
;#  Name: MXMPasswordScript
;#  Author: tayior7
;#  Date: 3-20-2004
;#  File Name: pwscreen.xas
;#  Version: 1.1
;#  Purpose: Alternate password option, hides actauly password
;#  Save file as: pwscreen.xas
;##########################################################

BeginDraw
 Box 180 160 195 55 0xFF000000 0x00000000
 Box 195 175 25 25 0xFF000000 0x00000000
 Box 230 175 25 25 0xFF000000 0x00000000
 Box 265 175 25 25 0xFF000000 0x00000000
 Box 300 175 25 25 0xFF000000 0x00000000
 Box 335 175 25 25 0xFF000000 0x00000000
 Text 200 175 LEFT "%DIGIT1e%" 0xFFFFFFFF
 Text 235 175 LEFT "%DIGIT2e%" 0xFFFFFFFF
 Text 270 175 LEFT "%DIGIT3e%" 0xFFFFFFFF
 Text 305 175 LEFT "%DIGIT4e%" 0xFFFFFFFF
 Text 340 175 LEFT "%DIGIT5e%" 0xFFFFFFFF
 Box 180 230 195 25 0xFF000000 0x00000000
 Text 185 230 LEFT %PWTEXT% 0xFFFFFFFF
EndDraw


This post has been edited by tayior7: Mar 20 2004, 08:08 PM <
Logged

Kthulu

  • Archived User
  • Hero Member
  • *
  • Posts: 787
Actionscript Collection
« Reply #4 on: February 19, 2004, 06:14:00 PM »

CODE

;ABCDEFGHIJKLMNOPQRST  UVWXYZ
;abcdefghijklmnopqrst  uvwxyz
;01234-+*()>&!=56789.,/[]<#|^
;$~`;_@'?:\"%                
;###############################################################################

;# Name: virtualkb.xas
;# Author: Kthulu
;# Version: 1.0
;# Purpose: Provide a virtual keyboard for users of MXM 9.n6 and below.
;# Instructions:
;#  (See the Help screen by pressing the White button)
;#
;# Returns:
;#   _kthuluKBinput - contains the user-entered text
;#   _kthuluKBclipboard - contains the copied text
;#
;# Special Features:
;# - The first 4 lines of this file are read by the script and used as the
;# keyboard keys.  If you want to customize your keypads, just edit those lines,
;# but make sure you have at least 28 alpha-numeric characters per line
;# (29 chars counting the;)
;# - Has copy/paste functionality
;#
;# Xbox-scene Thread:
;# http://forums.xbox-scene.com/index.php?showtopic=160431
;#
;###############################################################################

:BEGININITIALIZATION
;###############################################################################

SET X 45
SET Y 400
SET W 25
SET H 25
SET curKeyPad 1
SET curPad ""
set keyboardInput %1%
SET leftString ""
SET rightString %keyboardInput%
SETFUNC aChar LEFT 1 %rightString%
SETFUNC strLen LENGTH %keyboardInput%
SET cursor 0
SET offset 50
OPENREAD keyFile c:\mxm\scripts\virtualkb.xas
READFILELN keyFile kpad1
READFILELN keyFile kpad2
READFILELN keyFile kpad3
READFILELN keyFile kpad4
CLOSEFILE keyFile
SETFUNC kpad1 RIGHT 28 %kpad1%
SETFUNC kpad2 RIGHT 28 %kpad2%
SETFUNC kpad3 RIGHT 28 %kpad3%
SETFUNC kpad4 RIGHT 28 %kpad4%
:ENDINITIALIZATION

;###############################################################################

:BEGINOUTPUT
;###############################################################################

BeginDraw UseCurrent
 BOX 0 370 640 175 BLACK YELLOW
 BOX 0 370 640 25 BLACK YELLOW
 BOX %X% %Y% %W% %H% BLACK GREEN
 TEXT %offset% 370 LEFT "%leftstring%^%rightString%" WHITE
 TEXT 500 400 LEFT "press$eol$for menu" WHITE
 BOX 560 410 10 10 WHITE BLACK
 If# %curKeyPad% > 1 GOTO KPADTWO
 SET curPad %kpad1%
 TEXT 50 400 LEFT "%kpad1keys%" YELLOW
 GOTO KPADEND

:KPADTWO
 If# %curKeyPad% > 2 GOTO KPADTHREE
 SET curPad %kpad2%
 GOTO KPADEND

:KPADTHREE
 If# %curKeyPad% > 3 GOTO KPADFOUR
 SET curPad %kpad3%
 GOTO KPADEND

:KPADFOUR
 If# %curKeyPad% > 4 GOTO KPADONE
 SET curPad %kpad4%

:KPADEND
 SET i 0
:OUTPUTROW1
 If# %i% > "13" GOTO EXITOUTPUTROW1
 SET j %i%
 MULT j 25
 ADD j 50
 SETFUNC aKey MID %i% 1 %curPad%
 TEXT %j% 400 LEFT "%aKey%" YELLOW
 ADD i 1
 GOTO OUTPUTROW1
:EXITOUTPUTROW1

 SET i 14
:OUTPUTROW2
 If# %i% > "27" GOTO EXITOUTPUTROW2
 SET j %i%
 SUB j 14
 MULT j 25
 ADD j 50
 SETFUNC aKey MID %i% 1 %curPad%
 TEXT %j% 425 LEFT "%aKey%" YELLOW
 ADD i 1
 GOTO OUTPUTROW2
:EXITOUTPUTROW2

 TEXT 410 400 LEFT "QUIT$eol$DONE" GREEN

 IF %showMenu% == "true" GOTO BEGINMENUOUTPUT

:ENDOUTPUT
EndDraw

;###############################################################################

:BEGININPUT
;###############################################################################

INPUT
If %_GP_D_LF% == "1" GOTO LF
If %_GP_D_UP% == "1" GOTO UP
If %_GP_D_DN% == "1" GOTO DN
If %_GP_D_RT% == "1" GOTO RT
If %_GP_X% == "1" GOTO BACK
If %_GP_Y% == "1" GOTO FORWARD
If %_GP_A% == "1" GOTO GETKEY
If %_GP_B% == "1" GOTO NEXTKPAD
If %_GP_BACK% == "1" GOTO LFSHIFTINPUT
If %_GP_START% == "1" GOTO RTSHIFTINPUT
If %_GP_BLACK% == "1" GOTO DELCHAR
If %_GP_WHITE% == "1" GOTO MENUON
GOTO BEGININPUT
:ENDINPUT

;###############################################################################

:EXIT
;###############################################################################

QUIT

;PROCEEDURES
;###############################################################################

:NEXTKPAD
;###############################################################################

If# %curKeyPad% > 4 GOTO KPADONE
ADD curKeyPad 1
GOTO BEGINOUTPUT
:KPADONE
SET curKeyPad "1"
GOTO BEGINOUTPUT

;###############################################################################

:UP
;###############################################################################

If# %Y% == 400 GOTO BEGINOUTPUT
SUB Y 25
GOTO BEGINOUTPUT

;###############################################################################

:DN
;###############################################################################

If# %Y% == 425 GOTO BEGINOUTPUT
ADD Y 25
GOTO BEGINOUTPUT

;###############################################################################

:LF
;###############################################################################

If# %X% <> 45 GOTO LFNORMAL
SET W 100
SET X 395
GOTO BEGINOUTPUT
:LFNORMAL
SET W 25
SUB X 25
GOTO BEGINOUTPUT

;###############################################################################

:RT
;###############################################################################

SET W 100
If# %X% >= 395 GOTO RTWRAP
ADD X 25
If# %X% == 395 GOTO BEGINOUTPUT
SET W 25
GOTO BEGINOUTPUT
:RTWRAP
SET X 45
SET W 25
GOTO BEGINOUTPUT

;###############################################################################

:GETKEY
;###############################################################################

SETFUNC   strLen LENGTH %keyboardInput%
SET charX %X%
SET charY %Y%
SUB charX 45
DIV charX 25
SUB charY 400
DIV charY 25
If# %charX% == 14 GOTO GETSPECKEY
If# %cursor% > 80 GOTO BEGINOUTPUT
MULT charY 14
ADD charX %charY%
SETFUNC aChar MID %charX% 1 %curPad%
;if# %curKeyPad% != "4" goto SETKBINPUT
;if# %charX% != "0" goto SKIPDOLLARSIGN
;set aChar "\$"
;:SKIPDOLLARSIGN
;if# %charX% < "9" goto SETKBINPUT
;set aChar "\\"
;if# %charX% == "9" goto SETKBINPUT
;set aChar " "

:SETKBINPUT
If# %cursor% == 0 GOTO GETRIGHTSTRING
SETFUNC leftString LEFT %cursor% %keyboardInput%

:GETRIGHTSTRING
SETFUNC strLen LENGTH %keyboardInput%
If# %strLen% == %cursor% GOTO GETCHAR
SUB strLen %cursor%
SETFUNC rightString MID %cursor% %strLen% %keyboardInput%

:GETCHAR
SET leftString "%leftString%%aChar%"
SET keyboardInput "%leftString%%rightString%"
ADD cursor 1
GOTO BEGINOUTPUT

;###############################################################################

:GETSPECKEY
;###############################################################################

If# %charY% == 0 GOTO CANCEL
If# %charY% == 1 GOTO ENTER
GOTO BEGINOUTPUT

;###############################################################################

:BACK
;###############################################################################

If# %cursor% <= 0 GOTO BEGINOUTPUT
SUB cursor 1
SET rightString %aChar%%rightString%
SETFUNC aChar RIGHT 2 %leftString%
SETFUNC aChar LEFT 1 %aChar%
SETFUNC leftString LEFT %cursor% %leftString%
GOTO BEGINOUTPUT

;###############################################################################

:FORWARD
;###############################################################################

SETFUNC   strLen LENGTH %keyboardInput%
If# %cursor% == %strLen% GOTO BEGINOUTPUT
ADD cursor 1
SETFUNC aChar LEFT 1 %rightString%
SET leftString %leftString%%aChar%
SETFUNC strLen LENGTH %keyboardInput%
SUB strLen %cursor%
SETFUNC rightString RIGHT %strLen% %keyboardInput%
GOTO BEGINOUTPUT

;###############################################################################

:CANCEL
;###############################################################################

SET _kthuluKBinput %1%
SET keyboardInput ""
SET keyboardInput ""
SET leftString ""
SET rightString ""
SET aChar ""
SET cursor 0
GOTO EXIT

;###############################################################################

:DELCHAR
;###############################################################################

If# %cursor% == 0 GOTO GETRTSTRING
SETFUNC leftString LEFT %cursor% %keyboardInput%

:GETRTSTRING
SETFUNC strLen LENGTH %keyboardInput%
If# %strLen% == %cursor% GOTO BEGINOUTPUT
SET nextCursor %cursor%
ADD nextCursor 1
SUB strLen %nextCursor%
SETFUNC rightString MID %nextCursor% %strLen% %keyboardInput%
SET keyboardInput %leftString%%rightString%
GOTO BEGINOUTPUT

;###############################################################################

:ENTER
;###############################################################################

SET _kthuluKBinput %keyboardInput%
GOTO EXIT

;###############################################################################

:LFSHIFTINPUT
;###############################################################################

IF# %offset% < "-499" GOTO LFSHIFTINPUTRETURN
SUB offset 10
:LFSHIFTINPUTRETURN
GOTO BEGINOUTPUT

;###############################################################################

:RTSHIFTINPUT
;###############################################################################

IF# %offset% > "49" GOTO RTSHIFTINPUTRETURN
ADD offset 10
:RTSHIFTINPUTRETURN
GOTO BEGINOUTPUT

;###############################################################################

:BEGINMENUOUTPUT
;###############################################################################

Box 243 163 154 64 0xff505050 WHITE
Box 245 %menuPos% 150 20 0xff0000aa 0xff0000aa
Text 320 165 CENTER "Help" WHITE
Text 320 185 CENTER "Copy" WHITE
Text 320 205 CENTER "Paste" WHITE
:ENDMENUOUPUT

;###############################################################################

:GETMENUINPUT
;###############################################################################

Input
IF %_GP_A% == "1" goto MENUSELECT
IF %_GP_WHITE% == "1" goto MENUOFF
IF %_GP_D_UP% == "1" GOTO MENUUP
IF %_GP_D_DN% == "1" GOTO MENUDN
GOTO GETMENUINPUT
:ENDMENUINPUT

;###############################################################################

:MENUOFF
;###############################################################################

set showMenu "false"
set menuPos 165
goto BEGINOUTPUT

;###############################################################################

:MENUON
;###############################################################################

set showMenu "true"
set menuPos 165
goto BEGINOUTPUT

;###############################################################################

:MENUUP
;###############################################################################

if# %menuPos% < "166" goto NOMENUUP
sub menuPos 20
:NOMENUUP
goto BEGINOUTPUT

;###############################################################################

:MENUDN
;###############################################################################

if# %menuPos% > "204" goto NOMENUDN
add menuPos 20
:NOMENUDN
goto BEGINOUTPUT

;###############################################################################

:MENUSELECT
;###############################################################################

set choice %menuPos%
set showMenu "false"
set menuPos 165
goto HANDLEMENU

;###############################################################################

:HANDLEMENU
;###############################################################################

set temp %choice%
sub temp 165
div temp 20
if# %temp% == "0" goto HELP
if# %temp% == "1" goto COPY
if# %temp% == "2" goto PASTE
goto BEGINOUTPUT

;###############################################################################

:HELP
;###############################################################################

BeginDraw UseCurrent
Box 45 50 550 280 BLUE WHITE
Text 320 70 CENTER "DEFAULT GAMEPAD CONTROLS:$eol$Dpad - selects letter on keyboard$eol$Back - scrolls text left$eol$Start - scrolls text right$eol$A button - 'types' the selected letter on keyboard$eol$B button - cycles through available keypads$eol$X button - moves keyboard cursor back$eol$Y button - moves keyboard cursor forward$eol$Black button - deletes a character in current keyboard text$eol$White button - toggles display of the menu"
EndDraw
Input
GOTO BEGINOUTPUT

;###############################################################################

:COPY
;###############################################################################

SET _kthuluKBclipboard %keyboardInput%
GOTO MENUOFF

;###############################################################################

:PASTE
;###############################################################################

if %_kthuluKBclipboard% == "" GOTO BEGINOUTPUT
If# %cursor% == 0 GOTO PASTEGETRTSTRING
SETFUNC leftString LEFT %cursor% %keyboardInput%

:PASTEGETRTSTRING
SETFUNC strLen LENGTH %keyboardInput%
If# %strLen% == %cursor% GOTO GETCLIPBOARD
SUB strLen %cursor%
SETFUNC rightString MID %cursor% %strLen% %keyboardInput%

:GETCLIPBOARD
SET leftString "%leftString%%_kthuluKBclipboard%"
SET keyboardInput "%leftString%%rightString%"
SETFUNC strLen LENGTH %_kthuluKBclipboard%
ADD cursor %strLen%
SETFUNC aChar RIGHT 1 %_kthuluKBclipboard%
GOTO MENUOFF



This post has been edited by Kthulu: Feb 20 2004, 05:21 AM <
Logged

Kthulu

  • Archived User
  • Hero Member
  • *
  • Posts: 787
Actionscript Collection
« Reply #5 on: February 19, 2004, 08:09:00 PM »

CODE

;###############################################################################

;# Name: fileOpen.xas
;# Author: Kthulu
;# Version: 1.0
;# Purpose: Provide a means of file browsing compatible with MXM 9.n6 and later.
;# Instructions:
;#  (See the Help screen by pressing the White button)
;#
;# Returns:
;#   _file2Open - contains the selected path\filename
;#
;# Xbox-scene Thread:
;# http://forums.xbox-scene.com/index.php?showtopic=160431
;#
;###############################################################################

:BEGININITIALIZATION
;###############################################################################

set curDir ""
XMLCreate dirList "Dir"
XMLSetValue dirList !.1  ""
XMLSetValue dirList !.2  ""
XMLSetValue dirList !.3  ""
XMLSetValue dirList !.4  ""
XMLSetValue dirList !.5  ""
XMLSetValue dirList !.6  ""
XMLSetValue dirList !.7  ""
XMLSetValue dirList !.8  ""
XMLSetValue dirList !.9  ""
XMLSetValue dirList !.10 ""
XMLSetValue dirList !.11 ""
XMLSetValue dirList !.12 ""
XMLSetValue dirList !.13 ""
set fileCount 14
set Hscroll 50
goto SKIPSEARCH

;###########
:SEARCHBEGIN
;###########
set Hscroll 50
XMLClose dirList
XMLCreate dirList "Dir"
SET fileCount 2
BEGINSEARCH "%curDir%*"

:TOP
SEARCHTYPE fileType
SEARCHSIZE fileSize
SEARCHITEM myFileName
IF %myFileName% == "" GOTO SEARCHEND
SETFUNC myFileName REPLACE "*\\" "" %myFileName%
IF %fileType% == "file" goto FOUNDFILE
setfunc myFileName REPLACE %curDir% "<" %myFileName%
set myFileName "%myFileName%>"
XMLSetValue dirList !.%fileCount%  "%myFileName%"
goto SEARCHAGAIN

:FOUNDFILE
setfunc myFileName REPLACE %curDir% "" %myFileName%
XMLSetValue dirList !.%fileCount%  %myFileName%

:SEARCHAGAIN
ADD fileCount 1
SEARCHNEXT
GOTO TOP

;###########
:SEARCHEND
;###########
ENDSEARCH

XMLSetValue dirList !.1  ".."

:SKIPSEARCH
sub fileCount 1
SET pos 1
SET top 0
:ENDINITIALIZATION

;###############################################################################

:BEGINOUTPUT
;###############################################################################

SET temp %pos%
MULT temp 20
add temp 40

BeginDraw
BOX 0 0 640 58 0xff000000 0xffffff00
Text %Hscroll% 30 LEFT "%curdir%" WHITE
BOX 0 %temp% 640 20 0xff0000ff 0xff0000ff

set j 1
:DisplayLinesLoop
if# %j% == "20" goto ENDOUTPUT
   SET TEMP %j%
   MULT TEMP 20
   add temp 40
   SET linenumb %top%
   ADD linenumb %j%
   XMLGetValue dirList TEM !.%linenumb%
   TEXT %Hscroll% %TEMP% LEFT %TEM% WHITE
   add j 1
goto DisplayLinesLoop
:ENDOUTPUT
EndDraw

;###############################################################################

:GETINPUT
;###############################################################################

Input
IF %_GP_A% == "1" GOTO SELECTED
IF %_GP_D_UP% == "1" GOTO MOVEUP
IF %_GP_D_DN% == "1" GOTO MOVEDN
IF %_GP_D_LF% == "1" GOTO MOVELF
IF %_GP_D_RT% == "1" GOTO MOVERT
IF %_GP_B% == "1" GOTO UPDIR
GOTO GETINPUT
:EXITGETINPUT

;###############################################################################

;comment the above input block and uncomment this block if you have a WIP
;:GETINPUT
;###############################################################################

;IQWaitMsg UI_SELECT UI_UP UI_DN UI_LF UI_RT UI_BACK
;IF %MSG_ID% == "UI_SELECT" GOTO SELECTED
;IF %MSG_ID% == "UI_UP" GOTO MOVEUP
;IF %MSG_ID% == "UI_DN" GOTO MOVEDN
;IF %MSG_ID% == "UI_LF" GOTO MOVELF
;IF %MSG_ID% == "UI_RT" GOTO MOVERT
;IF %MSG_ID% == "UI_BACK" GOTO UPDIR
;GOTO GETINPUT
;:EXITGETINPUT

;###############################################################################

:EXIT
;###############################################################################

XMLClose dirList
set _file2Open %curDir%%selectName%
QUIT

;###############################################################################

:MOVEUP
;###############################################################################

SET temp %pos%
ADD temp %top%
IF# %temp% > 1 GOTO ALLOWMOVEUP
GOTO MOVEUPEXIT
:ALLOWMOVEUP
IF# %pos% > 1 GOTO MOVECURSORUP
SUB top 1
GOTO MOVEUPEXIT
:MOVECURSORUP
SUB pos 1
:MOVEUPEXIT
GOTO BEGINOUTPUT

;###############################################################################

:MOVEDN
;###############################################################################

SET TEMP1 %pos%
ADD TEMP1 %top%
ADD temp1 1
IF# %TEMP1% > %fileCount% GOTO MOVEDNEXIT
ADD pos 1
IF# %pos% > 19 GOTO SCROLLTEXTUP
GOTO MOVEDNEXIT
:SCROLLTEXTUP
SUB pos 1
ADD top 1
:MOVEDNEXIT
GOTO BEGINOUTPUT

;###############################################################################

:MOVELF
;###############################################################################

if# %Hscroll% < "-499" goto BEGINOUTPUT
sub Hscroll 10
goto BEGINOUTPUT

;###############################################################################

:MOVERT
;###############################################################################

if# %Hscroll% > "49" goto BEGINOUTPUT
add Hscroll 10
goto BEGINOUTPUT

;###############################################################################

:SELECTED
;###############################################################################

SET selectNum %pos%
ADD selectNum %top%
XMLGetValue dirList selectName !.%selectNum%
setfunc fnLength LENGTH %curDir%
if %fnLength%%selectName% == "3.." goto BEGININITIALIZATION
if %selectName% != ".." goto STAYCURRENT
set temp %curDir%
sub fnLength 1
setfunc curDir LEFT %fnLength% %curDir%
setfunc curDir FNPATH %curDir%
setfunc hasDot RIGHT 1 %curDir%
if %hasDot% == "\\" goto SKIP1
set curDir "%curDir%\\"
:SKIP1
if %curDir% != %temp% goto PROCEEDNORMALLY
setfunc curDir LEFT 3 %curDir%
:PROCEEDNORMALLY
goto SEARCHBEGIN
:STAYCURRENT
setfunc isDir RIGHT 1 %selectName%
if %isDir% != ">" goto EXIT
setfunc fnLength LENGTH %selectName%
sub fnLength 2
setfunc selectName MID 1 %fnLength% %selectName%
set curDir "%curDir%%selectName%\\"
GOTO SEARCHBEGIN

;###############################################################################

:UPDIR
;###############################################################################

if %curDir% == "" goto BEGINOUTPUT
setfunc fnLength LENGTH %curDir%
if %fnLength% == "3" goto BEGININITIALIZATION
set temp %curDir%
sub fnLength 1
setfunc curDir LEFT %fnLength% %curDir%
setfunc curDir FNPATH %curDir%
setfunc hasDot RIGHT 1 %curDir%
if %hasDot% == "\\" goto SKIP1
set curDir "%curDir%\\"
:SKIP1
if %curDir% != %temp% goto PROCEEDNORMALLY
setfunc curDir LEFT 3 %curDir%
:PROCEEDNORMALLY
goto SEARCHBEGIN



This post has been edited by Kthulu: Mar 25 2004, 05:45 AM <
Logged

Kthulu

  • Archived User
  • Hero Member
  • *
  • Posts: 787
Actionscript Collection
« Reply #6 on: February 19, 2004, 08:30:00 PM »

CODE

;###############################################################################

;# Name: TextEditor.xas
;# Author: Kthulu
;# Version: 1.0
;# Purpose: Provide a means of text-editing compatible with MXM 9.n6 and later.
;# Instructions:
;# - (See the Help screen by pressing the White button)
;# USES:
;#   virtualKB.xas
;#   fileOpen.xas
;#
;# Returns:
;#   An edited text file if you save it :)
;#
;# Xbox-scene Thread:
;# http://forums.xbox-scene.com/index.php?showtopic=160431
;#
;###############################################################################

:BEGININITIALIZATION
;###############################################################################

set virtualKbPath "c:\\mxm\\scripts\\virtualKB.xas"
set fileBrowserPath "c:\\mxm\\scripts\\fileopen.xas"
set _file2Open %1%

:OPENDIALOG
if %_file2Open% != "" goto CHECKEXTENSION
CallFile %fileBrowserPath%
:CHECKEXTENSION
setfunc ext FNEXTENSION %_file2Open%
if %ext% == "txt" goto ACCEPTED
if %ext% == "xml" goto ACCEPTED
if %ext% == "nfo" goto ACCEPTED
if %ext% == "log" goto ACCEPTED
if %ext% == "ini" goto ACCEPTED
if %ext% == "xas" goto ACCEPTED
set mySaveFile ""
set _file2Open ""
goto SKIPOPENDIALOG
:ACCEPTED
set mySaveFile %_file2Open%

:SKIPOPENDIALOG
XMLClose lst
if %mySaveFile% == "" goto OPENDIALOG
set _file2Open ""
OPENREAD listFile %mySaveFile%
set temp 1
XMLCreate lst "Main"

:READLOOP
filestat listFile eofl
if# %eofl% == "0" goto READLOOPEND
READFILELN listFile curLine
XMLSetValue lst !.%temp%  %curLine%
add temp 1
goto READLOOP
:READLOOPEND
CLOSEFILE listFile

set numLines %temp%
SET yPos 1
set xPos 50
SET top 0
set menuOpen "true"
set editMode "true"
set menuPos 165
XMLGetValue lst keyboardInput !.%yPos%
:ENDINITIALIZATION

;###############################################################################

:BEGINOUTPUT
;###############################################################################

SET temp %yPos%
MULT temp 20
ADD temp 20

BeginDraw
BOX 0 %temp% 640 20 0xaa0000aa 0xaa0000aa
TEXT 320 435 CENTER "press WHITE to show/hide the menu" YELLOW

set j 1
:DisplayLinesLoop
if# %j% == "20" goto ExitDisplayLinesLoop
   SET TEMP %j%
   MULT TEMP 20
   add temp 20
   SET linenumb %top%
   ADD linenumb %j%
   XMLGetValue lst TEM !.%linenumb%
   TEXT %xPos% %TEMP% LEFT %TEM% WHITE
   add j 1
goto DisplayLinesLoop
:ExitDisplayLinesLoop

if %showMenu% == "true" goto BEGINMENUOUTPUT
EndDraw
:ENDOUTPUT

;###############################################################################

:GETINPUT
Input
If %_GP_D_LF% == "1" GOTO LFSHIFTTEXT
If %_GP_D_UP% == "1" GOTO MOVEUP
If %_GP_D_DN% == "1" GOTO MOVEDN
If %_GP_D_RT% == "1" GOTO RTSHIFTTEXT
If %_GP_A% == "1" GOTO KEYBOARDTOGGLE
If %_GP_WHITE% == "1" GOTO MENUON
GOTO GETINPUT
:EXITINPUT

;###############################################################################

:EXIT
;###############################################################################

XMLClose lst
QUIT

;###############################################################################

:MOVEUP
;###############################################################################

SET temp %yPos%
ADD temp %top%
IF# %temp% > 1 GOTO CHECKYPOS
GOTO MOVEUPEXIT
:CHECKYPOS
IF# %yPos% > 1 GOTO CURSORUP
SUB top 1
GOTO MOVEUPEXIT
:CURSORUP
SUB yPos 1
:MOVEUPEXIT
SET selectNum %yPos%
ADD selectNum %top%
XMLGetValue lst keyboardInput !.%selectNum%
GOTO BEGINOUTPUT

;###############################################################################

:MOVEDN
;###############################################################################

SET TEMP1 %yPos%
ADD TEMP1 %top%
IF# %TEMP1% >= %numLines% GOTO MOVEDNEXIT
ADD yPos 1
IF# %yPos% > 16 GOTO UPSHIFTTEXT
GOTO MOVEDNEXIT
:UPSHIFTTEXT
SUB yPos 1
ADD top 1
:MOVEDNEXIT
SET selectNum %yPos%
ADD selectNum %top%
XMLGetValue lst keyboardInput !.%selectNum%
GOTO BEGINOUTPUT

;###############################################################################

:LFSHIFTTEXT
;###############################################################################

if# %xPos% < "-599" goto LFSHIFTTEXTEXIT
sub xPos 10
sub offset 10
:LFSHIFTTEXTEXIT
goto BEGINOUTPUT

;###############################################################################

:RTSHIFTTEXT
;###############################################################################

if# %xPos% > "49" goto RTSHIFTTEXTEXIT
add xPos 10
add offset 10
:RTSHIFTTEXTEXIT
goto BEGINOUTPUT

;###############################################################################

:BEGINMENUOUTPUT
;###############################################################################

Box 243 163 154 144 0xff505050 WHITE
Box 245 %menuPos% 150 20 0xff0000aa 0xff0000aa
Text 320 165 CENTER "Help" WHITE
Text 320 185 CENTER "Insert Line" WHITE
Text 320 205 CENTER "Delete Line" WHITE
Text 320 225 CENTER "Open" WHITE
Text 320 245 CENTER "Save" WHITE
Text 320 265 CENTER "Save As" WHITE
Text 320 285 CENTER "Exit" WHITE

:GETMENUINPUT
Input
IF %_GP_A% == "1" goto MENUSELECT
IF %_GP_WHITE% == "1" goto MENUOFF
IF %_GP_D_UP% == "1" GOTO MENUUP
IF %_GP_D_DN% == "1" GOTO MENUDN
GOTO GETMENUINPUT
:ENDMENUINPUTOUPUT

;###############################################################################

:MENUOFF
;###############################################################################

set showMenu "false"
set menuPos 165
goto BEGINOUTPUT

;###############################################################################

:MENUON
;###############################################################################

set showMenu "true"
goto BEGINOUTPUT

;###############################################################################

:MENUUP
;###############################################################################

if# %menuPos% < "166" goto NOMENUUP
sub menuPos 20
:NOMENUUP
goto BEGINOUTPUT

;###############################################################################

:MENUDN
;###############################################################################

if# %menuPos% > "284" goto NOMENUDN
add menuPos 20
:NOMENUDN
goto BEGINOUTPUT

;###############################################################################

:MENUSELECT
;###############################################################################

set choice %menuPos%
set showMenu "false"
set menuPos 165
goto HANDLEMENU

;###############################################################################

:HANDLEMENU
;###############################################################################

set temp %choice%
sub temp 165
div temp 20
if# %temp% == "0" goto HELP
if# %temp% == "1" goto INSERTLINE
if# %temp% == "2" goto DELETELINE
if# %temp% == "3" goto OPENDIALOG
if# %temp% == "4" goto SAVEFILE
if# %temp% == "5" goto SAVEAS
if# %temp% == "6" goto EXIT
goto BEGINOUTPUT

;###############################################################################

:HELP
;###############################################################################

BeginDraw UseCurrent
Box 50 50 540 280 BLUE
Text 320 70 CENTER "DEFAULT GAMEPAD CONTROLS:$eol$Dpad - scrolls text in all directions$eol$A button - selects current line for editing$eol$White button - toggles the display of the menu" WHITE
EndDraw
Input
goto BEGINOUTPUT

;###############################################################################

:INSERTLINE
;###############################################################################

XMLCreate 2nd "Main"
SET selectNum %yPos%
ADD selectNum %top%
set temp2 0
add numLines 1

set i %selectNum%
:CopyTopHalf
if# %i% == %numLines% goto ExitCopyTopHalf
add temp2 1
XMLGetValue lst selectName !.%i%
XMLSetValue 2nd !.%temp2%  %selectName%
add i 1
goto CopyTopHalf
:ExitCopyTopHalf

XMLSetValue lst !.%selectNum% ""
set temp3 %selectNum%
add temp3 1
set temp2 0

set i %temp3%
:CopyBottomHalf
if# %i% == %numLines% goto ExitCopyBottomHalf
add temp2 1
XMLGetValue 2nd selectName !.%temp2%
XMLSetValue lst !.%i% %selectName%
add i 1
goto CopyBottomHalf
:ExitCopyBottomHalf

XMLClose 2nd
SET selectNum %yPos%
ADD selectNum %top%
XMLGetValue lst keyboardInput !.%selectNum%
SET leftString %keyboardInput%
SET rightString ""
SETFUNC aChar RIGHT 1 %leftString%
SETFUNC strLen LENGTH %keyboardInput%
SET cursor %strLen%
goto BEGINOUTPUT

;###############################################################################

:DELETELINE
;###############################################################################

if# %selectNum% >= %numLines% goto DELLINERETURN

XMLCreate 2nd "Main"
SET selectNum %yPos%
ADD selectNum %top%
set temp3 %selectNum%
set temp4 %numLines%
add temp4 1

set i 1
:CopyTop
if# %i% >= %selectNum% goto ExitCopyTop
XMLGetValue lst selectName !.%i%
XMLSetValue 2nd !.%i%  %selectName%
add i 1
goto CopyTop
:ExitCopyTop

:SKIPTOPOFFILE
;what if deleting last line?
set i %selectNum%
add i 1
:CopyBottom
if# %i% >= %numLines% goto ExitCopyBottom
set temp2 %i%
sub temp2 1
XMLGetValue lst selectName !.%i%
XMLSetValue 2nd !.%temp2%  %selectName%
add i 1
goto CopyBottom
:ExitCopyBottom

:SKIPBOTTOMOFFILE
XMLClose lst
XMLCreate lst
set i 1
:Reassemble
if# %i% == %numLines% goto ExitReassemble
XMLGetValue 2nd selectName !.%i%
XMLSetValue lst !.%i% %selectName%
add i 1
goto Reassemble
:ExitReassemble

:NOTOPSHIFT2
XMLClose 2nd

if# %selectNum% < %numLines% goto NOMOVEUP
sub yPos 1

:NOMOVEUP
sub numLines 1
:DELLINERETURN
SET selectNum %yPos%
ADD selectNum %top%
XMLGetValue lst keyboardInput !.%selectNum%
SET leftString %keyboardInput%
SET rightString ""
SETFUNC aChar RIGHT 1 %leftString%
SETFUNC strLen LENGTH %keyboardInput%
SET cursor %strLen%
goto BEGINOUTPUT

;###############################################################################

:SAVEFILE
;###############################################################################

OPENWrite listFile %mySaveFile%
set temp 1
set temp2 %numLines%

:WRITELOOP
if# %temp% > %temp2% goto WRITELOOPEND
XMLGetValue lst curLine !.%temp%
WRITEFILELN listFile %curLine%
add temp 1
goto WRITELOOP
:WRITELOOPEND

CLOSEFILE listFile
goto BEGINOUTPUT

;###############################################################################

:SAVEAS
;###############################################################################

Callfile %virtualKbPath% %mySaveFile%
set mySaveFile %_kthuluKBinput%
goto SAVEFILE

;###############################################################################

:KEYBOARDTOGGLE
;###############################################################################

callfile %virtualKbPath% %keyboardInput%
set keyboardInput %_kthuluKBinput%
SET selectNum %yPos%
ADD selectNum %top%
XMLSetValue lst !.%selectNum% %keyboardInput%
goto BEGINOUTPUT


This post has been edited by Kthulu: Feb 20 2004, 05:20 AM <
Logged

flattspott

  • Archived User
  • Hero Member
  • *
  • Posts: 1220
Actionscript Collection
« Reply #7 on: April 20, 2004, 11:51:00 AM »

Actionscript Name: X2 BIOS Config Script
Author: flattspott
Version: 1.0
Purpose: To allow users to enable or disable X2 BIOS features from within MXM.
Instructions: Included in the script file
For Q&A's and a screenshot about this script visit this thread: X2Config
Save As - X2Config.xas
CODE

;######################################################
;#  Script: X2 BIOS Config Script
;#  Author: flattspott
;#  Date: 04-20-2004
;#  Version: 1.0
;#  Disclaimer: Should be safe but as always use at your own risk.
;#  Info: Finally, a script from me that is MXM 0.9n.6 compatible            
;#  Purpose: To allow users to enable or disable X2 BIOS features from within MXM.
;#  Usage: A standard CallFile will do
;#
;#     CallFile \X2Config.xas
;#
;#######################################################
:X2Status
:IGRCheck
SetFunc IGR FileExists E:\x2_IGR_disabled
If# %IGR% == 1 Goto IGREnable
If# %IGR% == 0 Goto IGRDisable
:IGREnable
 Set Prompt1 "Press A to Enable: In Game Reset"
 Set Op1 Enable
Goto NROECheck
:IGRDisable
 Set Prompt1 "Press A to Disable: In Game Reset"
 Set Op1 Disable
Goto NROECheck

:NROECheck
SetFunc NROE FileExists E:\x2_NROE_disabled
If# %NROE% == 1 Goto NROEEnable
If# %NROE% == 0 Goto NROEDisable
:NROEEnable
 Set Prompt2 "Press B to Enable: No Reset on Eject"
 Set Op2 Enable
Goto XBLCCheck
:NROEDisable
 Set Prompt2 "Press B to Disable: No Reset on Eject"
 Set Op2 Disable
Goto XBLCCheck

:XBLCCheck
SetFunc XBLC FileExists E:\x2_XBLC_disabled
If# %XBLC% == 1 Goto XBLCEnable
If# %XBLC% == 0 Goto XBLCDisable
:XBLCEnable
 Set Prompt3 "Press X to Enable: Xbox Live Check"
 Set Op3 Enable
Goto CECCheck
:XBLCDisable
 Set Prompt3 "Press X to Disable: Xbox Live Check"
 Set Op3 Disable
Goto CECCheck

:CECCheck
SetFunc CEC FileExists E:\x2_CEC_disabled
If# %CEC% == 1 Goto CECEnable
If# %CEC% == 0 Goto CECDisable
:CECEnable
 Set Prompt4 "Press Y to Enable: Clock Error Check"
 Set Op4 Enable
Goto RefreshScreen
:CECDisable
 Set Prompt4 "Press Y to Disable: Clock Error Check"
 Set Op4 Disable
Goto RefreshScreen

:RefreshScreen
BeginDraw
Box 0 0 640 480 DarkBlue DarkBlue
Text 320 125 Center "X2 BIOS Config Script"
Text 320 200 Center "%Prompt1%"
Text 320 220 Center "%Prompt2%"
Text 320 240 Center "%Prompt3%"
Text 320 260 Center "%Prompt4%"
Text 320 300 Center "Press White to Exit"
EndDraw

Input
If %_GP_A% == "1" Goto %Op1%IGR
If %_GP_B% == "1" Goto %Op2%NROE
If %_GP_X% == "1" Goto %Op3%XBLC
If %_GP_Y% == "1" Goto %Op4%CEC
If %_GP_WHITE% == "1" Goto End
Goto RefreshScreen

:DisableIGR
OpenWrite X2 E:\x2_IGR_disabled
CloseFile X2
Goto X2Status

:DisableNROE
OpenWrite X2 E:\x2_NROE_disabled
CloseFile X2
Goto X2Status

:DisableXBLC
OpenWrite X2 E:\x2_XBLC_disabled
CloseFile X2
Goto X2Status

:DisableCEC
OpenWrite X2 E:\x2_CEC_disabled
CloseFile X2
Goto X2Status

:EnableIGR
Delete E:\x2_IGR_disabled
Goto X2Status

:EnableNROE
Delete E:\x2_NROE_disabled
Goto X2Status

:EnableXBLC
Delete E:\x2_XBLC_disabled
Goto X2Status

:EnableCEC
Delete E:\x2_CEC_disabled
Goto X2Status

:End
Quit
Logged

SumDumGuy3

  • Archived User
  • Newbie
  • *
  • Posts: 48
Actionscript Collection
« Reply #8 on: September 02, 2004, 10:42:00 PM »

ok, I have been waiting long enough... I am still working on the installer so it is not completely finished yet. It is very nearly finished. I am hoping I can finish it tonight, if I focus on it... Anyway, until I can finish and release the main script, I thought I would go ahead and release some of the subscripts I am using for my loader.

For those of you (probably most of you) who do not know what loader, I am talking about. I wrote a loader/autoinstaller (whatever you want to call it) similar to the Slayers awile back. It was much more advanced than slayers... I tried to get him to use my code in his release (as I can not offer the same level of support that he does) but he felt mine was just too complex (agreed... complexity is a tradeoff of flexibility, mine was MUCH More flexible and therefore was more complex) Anyway, I think he started using bits and pieces of my loader in his but that's really not important for now...

What is important is that I needed to make a new version... his is just not comprehensive enough to suit the needs of some people. Anyway, so I agreed to make a new version. I can't wait for the next release of MXM and I will never go back to using Evox for writing the installer, now that I have found out about MXM, so this loader/autoinstaller is based entirely on mxm 0.9n.6. I understand the next release will completely change everything but until then this is the best I could come up with in a short period of time...

The scripts I will be including below are based on work I have done on that loader. I still have to finish the main script and all that fun stuff... But these might prove useful for some, if for nothing else for code samples and ideas on how some things could be implemented... That said... enjoy... let me know if you have questions or comments about this code... would love to hear some feedback...


Thanks,
SumDumGuy

NotVal.xas
CODE

;###############################################################################
###
;#
;#  Title: NotVal
;#  Author: SumDumGuy
;#  Filename: NotVal.xas
;#  Date: 08-27-2004
;#  Version: 1.0
;#  Purpose: This is basically a function in a script. It accepts two arguments the Value
;#  to return the Not of and the file to return it in. It then returns the Not value of that
;#  arg (0 = 1, 1 = 0, True = False, False = True). It's basically like a toggle switch
;#
;###############################################################################
###

If %1%     == "0"  GOTO Ret1
If %1%     == "1"  GOTO Ret0
If %1%     == False   GOTO RetTrue
If %1%     == True  GOTO RetFalse
GOTO End

:Ret1
Set     RetVal  1
GOTO WriteNot

:Ret0
Set     RetVal  0
GOTO WriteNot

:RetTrue
Set     RetVal  True
GOTO WriteNot

:RetFalse
Set     RetVal  False
GOTO WriteNot

:WriteNot
OpenWrite  WFileHndl   %2%
WriteFileLn  WFileHndl   %RetVal%
CloseFile  WFileHndl
GOTO End

:End
Quit



FreeOnDrv.xas
CODE

;###############################################################################
###
;#
;#  Title: Free On Drive
;#  Author: SumDumGuy
;#  Filename: FreeOnDrv.xas
;#  Date: 09-26-2004
;#  Version: 1.0
;#  Purpose: This is basically a function in a script. It accepts two arguments the Drive
;#  to check (in the form of G_Drive, F_Drive, E_Drive & C_Drive) and the file to return it in
;#  It then returns the free space on that drive in MB with out any non-numerical characters.
;#
;###############################################################################
###

If %1%  == "G_Drive"   GOTO CheckG
If %1%  == "F_Drive"   GOTO CheckF
If %1%  == "E_Drive"   GOTO CheckE
If %1%  == "C_Drive"   GOTO CheckC
GOTO End

:CheckG
Set  FreeOnDrv   $ShortDriveGFree$
GOTO CalcFree

:CheckF
Set  FreeOnDrv   $ShortDriveFFree$
GOTO CalcFree

:CheckE
Set  FreeOnDrv   $ShortDriveEFree$
GOTO CalcFree

:CheckC
Set  FreeOnDrv   $ShortDriveCFree$
GOTO CalcFree

:CalcFree
Setfunc  FODLen  LENGTH  %FreeOnDrv%
Sub  FODLen  3
Setfunc  FreeOnDrv   RIGHT  %FODLen%   %FreeOnDrv%
Setfunc  FODLen  LENGTH  %FreeOnDrv%
Sub  FODLen  5
Setfunc  FreeOnDrv   LEFT  %FODLen%   %FreeOnDrv%
Setfunc  ByteType   Right  2  %FreeOnDrv%
Sub  FODLen  2
Setfunc  FreeOnDrv   LEFT  %FODLen%   %FreeOnDrv%
Setfunc  FreeOnDrv   REPLACE  ","  ""  %FreeOnDrv%
If %ByteType%   == "KB"  GOTO ConvertKB2MB
GOTO Finished

:ConvertKB2MB
DIV  FreeOnDrv   1024
GOTO Finished

:Finished
OpenWrite   WFileHndl   %2%
WriteFileLn   WFileHndl   %FreeOnDrv%
CloseFile   WFileHndl
GOTO End

:End
Quit



TrayPrompt.xas
CODE

;###############################################################################
###
;#                                                                                #
;#     Title: Tray Prompt and Reboot or Shutdown                                  #
;#    Author: SumDumGuy                                                           #
;#  Filename: TrayPrompt.xas                                                      #
;#      Date: 08-27-2004                                                          #
;#   Version: 1.0                                                                 #
;#   Purpose: Asks if they want to eject the DVD Tray, Then Reboots or Shutsdown  #
;#                                                                                #
;###############################################################################
###

GOTO TrayPrompt

:TrayPrompt
BeginDraw   UseCurrent
MessageBox   "Before you %1%.$eol$Would you like to Eject the DVD Drive Tray?$eol$$eol$Press the \"A\" button to Eject and %1%.$eol$$eol$Press the \"B\" button to Continue %1%$eol$without Ejecting.$eol$$eol$"
EndDraw
Input
If %_GP_B%   == "1"  GOTO PerfAction
If %_GP_A%   == "1"  GOTO EjectFirst
If %_GP_BACK%   == "1"  GOTO End
GOTO TrayPrompt

:EjectFirst
TrayOpen
BeginDraw   UseCurrent
MessageBox   "Remove the CD/DVD and then Press any button to continue with %1%...$eol$$eol$"
EndDraw
Input

:PerfAction
If %1%  == "Shutdown"   GOTO ShutDownNow
If %1%  == "Reboot"   GOTO RebootNow

:ShutDownNow
Shutdown
GOTO End

:RebootNow
Reboot
GOTO End

:End
Quit



BigDrive.xas
CODE

;###############################################################################
###
;#
;#  Title: Biggest Drive
;#  Author: SumDumGuy
;#  Filename: BigDrive.xas
;#  Date: 08-27-2004
;#  Version: 1.0
;#  Purpose: This is basically a function in a script. It accepts one argument, the
;#  file to return the results in. It returns the letter of the drive with the most
;#  most free space out of G, F, E & C.
;#
;###############################################################################
###

Set  RetValFile     Y:\RetVal.dat
Set  SelPartCMsg     "Press \"Y\" for the C Partition with %FreeOnC% MB$eol$$eol$"
Set  SelPartEMsg     "Press \"X\" for the E Partition with %FreeOnE% MB$eol$$eol$"
Set  SelPartFMsg     "Press \"A\" for the F Partition with %FreeOnF% MB$eol$$eol$"
Set  SelPartGMsg     "Press \"B\" for the G Partition with %FreeOnG% MB$eol$$eol$"

Copy  %ScriptsPath%\RetVal.dat   Y:\
CallFile   %ScriptsPath%\FreeOnDrv.xas   G_Drive  %RetValFile%
OPENREAD   FileHndl     %RetValFile%
READFILELN   FileHndl     FreeOnG
CLOSEFILE   FileHndl
Delete  %RetValFile%

Copy  %ScriptsPath%\RetVal.dat   Y:\
CallFile   %ScriptsPath%\FreeOnDrv.xas   F_Drive  %RetValFile%
OPENREAD   FileHndl     %RetValFile%
READFILELN   FileHndl     FreeOnF
CLOSEFILE   FileHndl
Delete %RetValFile%

Copy  %ScriptsPath%\RetVal.dat   Y:\
CallFile   %ScriptsPath%\FreeOnDrv.xas   E_Drive  %RetValFile%
OPENREAD   FileHndl     %RetValFile%
READFILELN   FileHndl     FreeOnE
CLOSEFILE   FileHndl
Delete %RetValFile%

Copy  %ScriptsPath%\RetVal.dat   Y:\
CallFile   %ScriptsPath%\FreeOnDrv.xas   C_Drive  %RetValFile%
OPENREAD   FileHndl     %RetValFile%
READFILELN   FileHndl     FreeOnC
CLOSEFILE   FileHndl
Delete %RetValFile%

:CheckGFree
If %FreeOnG%   !#^ "free"     GOTO CheckFFree
Set  FreeOnG    0
Set  SelPartGMsg     ""
GOTO CheckFFree

:CheckFFree
If %FreeOnF%   !#^ "free"     GOTO CheckEFree
Set  FreeOnF    0
Set  SelPartFMsg     ""
GOTO CheckEFree

:CheckEFree
If %FreeOnE%   !#^ "free"     GOTO CheckCFree
Set  SelPartEMsg     ""
GOTO ErrorPrompt

:CheckCFree
If %FreeOnC%   !#^ "free"     GOTO TestGPart
Set  SelPartCMsg     ""
GOTO ErrorPrompt

:TestGPart
If# %FreeOnG%   < %FreeOnF%     GOTO TestFPart
If# %FreeOnG%   < %FreeOnE%     GOTO TestFPart
If# %FreeOnG%   < %FreeOnC%     GOTO TestFPart
Set  BigDrive     4
Set  BigDrvLetter     G
GOTO AcceptPrompt

:TestFPart
If# %FreeOnF%   < %FreeOnE%     GOTO TestEPart
If# %FreeOnF%   < %FreeOnC%     GOTO TestEPart
Set  BigDrive     3
Set  BigDrvLetter     F
GOTO AcceptPrompt

:TestEPart
If# %FreeOnE%   < %FreeOnC%     GOTO TestCPart
Set  BigDrive     2
Set  BigDrvLetter     E
GOTO AcceptPrompt

:TestCPart
Set  BigDrive     1
Set  BigDrvLetter     C
GOTO AcceptPrompt

:AcceptPrompt
BeginDraw   UseCurrent
MessageBox   "The C partition appears to have %FreeOnC% MB$eol$The E partition appears to have %FreeOnE% MB$eol$The F partition appears to have %FreeOnF% MB$eol$The G partition appears to have %FreeOnG% MB$eol$$eol$The %BigDrvLetter% drive appears to have the most free space$eol$on it. X-Loader will attempt to use the %BigDrvLetter% Drive.$eol$$eol$Press \"Start\" to change this selection$eol$$eol$Press any other button to accept this selection$eol$$eol$"
EndDraw
Input
If %_GP_START%   != "1"    GOTO WriteDrive
GOTO TargetDrvPrompt

:TargetDrvPrompt
BeginDraw   UseCurrent
MessageBox   "Select the partition to load apps/games/etc to...$eol$$eol$%SelPartCMsg%%SelPartEMsg%%SelPartFMsg%%SelPartGMsg%"
EndDraw
Input
If %_GP_Y%   == "1"    GOTO SetCPart
If %_GP_X%   == "1"    GOTO SetEPart
If %_GP_A%   == "1"    GOTO SetFPart
If %_GP_B%   == "1"    GOTO SetGPart
GOTO TargetDrvPrompt

:SetCPart
Set  BigDrive     1
GOTO WriteDrive

:SetEPart
Set  BigDrive     2
GOTO WriteDrive

:SetFPart
Set  BigDrive     3
GOTO WriteDrive

:SetGPart
Set  BigDrive     4
GOTO WriteDrive

:WriteDrive
OpenWrite   WFileHndl     %1%
WriteFileLn   WFileHndl     %BigDrive%
CloseFile   WFileHndl
GOTO End

:ErrorPrompt
BeginDraw   UseCurrent
MessageBox   "An Error was encountered. There does not appear$eol$to be any free space on the System partitions.$eol$$eol$Press any button to Reboot.$eol$$eol$"
EndDraw
Input
Callfile   %ScriptsPath%\TrayPrompt.xas   Shutdown

:End
Quit



Edit: I updated this post on 9/26/04 to reflect corrections to the FreeOnDrv Script. It incorrectly reported because when I first wrote it I did not know (and therefore take into account) that some values were returned as KB instead of MB. This has been fixed now.

thx, sdg

This post has been edited by SumDumGuy3: Sep 26 2004, 07:06 AM <
Logged

SumDumGuy3

  • Archived User
  • Newbie
  • *
  • Posts: 48
Actionscript Collection
« Reply #9 on: September 04, 2004, 08:23:00 PM »

Ok, here is another of the scripts used in my X-Loader... This one is for a templating system... I will also add another script for repeating sections of a template. For now this script is strictly for replacing in-line template variables and not repeating ones.

So what is the point of this script you ask? Well, basically what I am using it for is to make templates for the various xbox apps configuration files. I used to make multiple copies of the configuration files, that were preconfigured for various situations. Then I would copy the appropriate config file over. But then that was when I used EvoX for my loader/auto-installer. Now that I am exploring the power of MXM for my loader, I decided to just make one config template for each program and then when the user makes their installation selections, it will go through the apps config templates replacing variables like "{TARGETDRIVE}" with the appropriate information i.e. "F:\". So the config file may some lines like:

CODE

E:\Apps\XBMC\

or
CODE

AutoAddItem "E:\Games\"


the template would have something more like:

CODE

{XBMCHOME}

or
CODE

AutoAddItem "{TARGETDRIVE}\Games\"


Then when you called this script you would do something like:

CODE

CallFile "%ScriptsPath%\\ProcTPL_IL.xas" "D:\\ConfigFiles\\XBMC.tpl" "F:\\Apps\\XBMC\\XboxMediaCenter.xml" XBMCHOME "F:\\Apps\\XBMC\\"



CODE

CallFile "%ScriptsPath%\\ProcTPL_IL.xas" "D:\\ConfigFiles\\EvoX.tpl" "F:\\Dashboards\\EvoX\\Evox.ini" TARGETDRIVE "F:"


Now, I know that you could do the xml's with MXMs xml functions but this is just a more generic script to allow you to do it for xmls, inis or any other file structure you may have the need to template... Anyway, hope it helps someone.. and even if not... it helps me... so  tongue.gif  hehe

ProcTPL_IL.xas
CODE

;##################################################################################
;#
;#  Title: Process Template In Line
;#  Author: SumDumGuy
;#  Filename: ProcTPL_IL.xas
;#  Date: 09-04-2004
;#  Version: 1.0
;#  Purpose: Read In Source (Template) File, Replace Template Variables with appropriate
;#                strings, Write New lines out to a file specified as the Target Location.
;#                Accepts a Minimum of 4 and a Maximum of 10 arguments as follows:
;#                %SourceFile%, %TargetFile%, %TMPLVAR1%, %NewSting1%, %TMPLVAR2%, %NewSting2%, ....
;#                This script is for In Line Template Variable Replacement. Use the script:
;#                ProcTemplateSec.xas for Section Template Variable Replacements.
;#
;##################################################################################


Set ScriptsPath $ActualPath$\Scripts
Set SourceFile %1%
Set TargetLoc %2%

SetFunc SourceExists FileExists %SourceFile%
If %SourceExists% == "0" Goto RaiseError
Goto OpenRWFiles

:OpenRWFiles
OpenRead RFileHndl %SourceFile%
ReadFileLn RFileHndl CurrentLine
OpenWrite WFileHndl %TargetLoc%
Goto ProcFile

:ProcFile
SetFunc NewLine Replace "{%3%}" "%4%" "%CurrentLine%"
Set CurrentLine %NewLine%
Set NewLine ""
If %5% == "" Goto WriteLine
SetFunc NewLine Replace "{%5%}" "%6%" "%CurrentLine%"
Set CurrentLine %NewLine%
Set NewLine ""
If %7% == "" Goto WriteLine
SetFunc NewLine Replace "{%7%}" "%8%" "%CurrentLine%"
Set CurrentLine %NewLine%
Set NewLine ""
If %9% == "" Goto WriteLine
SetFunc NewLine Replace "{%9%}" "%10%" "%CurrentLine%"
Set CurrentLine %NewLine%
Set NewLine ""
If %11% == "" Goto WriteLine
SetFunc NewLine Replace "{%11%}" "%12%" "%CurrentLine%"
Set CurrentLine %NewLine%
Set NewLine ""
Goto WriteLine

:WriteLine
WriteFileLn WFileHndl %CurrentLine%
FileStat RFileHndl ContinueRead
If %ContinueRead% == "0" Goto CloseRWFiles
ReadFileLn RFileHndl CurrentLine
Goto ProcFile

:CloseRWFiles
CloseFile RFileHndl
CloseFile WFileHndl
Goto End

:End
Quit

:RaiseError
BeginDraw   UseCurrent
MessageBox   "The first argument in this script$eol$%SourceFile%$eol$Must be a pre-existing template file.$eol$$eol$"
EndDraw
Input
Goto End


Regards,
SDG
Logged

SumDumGuy3

  • Archived User
  • Newbie
  • *
  • Posts: 48
Actionscript Collection
« Reply #10 on: September 10, 2004, 02:01:00 AM »

Ok, here is my little script to transfer MXM_Entry.xml and the associated video/image files from a common source folder to the appropriate game/app folder for use by MXM. Currently it does not reset the menu cache for the user, they are warned though.

To call it, use something like the following:

CODE

Callfile C:\Scripts\MXMEntries.xas F:\Games F:\Media\Info



CODE

;###############################################################################
###
;#
;#  Title: MXM Entries
;#  Author: SumDumGuy
;#  Filename: MXMEntries.xas
;#  Date: 09-09-2004
;#  Version: 1.0
;#  Purpose: This script copies MXM_Entry.xml and associated files given two arguments.
;#  first argument is the Target Patch i.e. F:\Games. The second argument is Source
;#  location for the entry info. the entry info needs to contain a set of folders with
;#  the xbeid as the foldername and containing at least a MXM_Entry.xml file and any
;#  other needed files for the prev videos, thumbs, covers, help screens....
;#
;###############################################################################
###

Set  searchPath   %1%
Set  InfoPath   %2%

:Search
BeginSearch   %searchPath%\*

:StartSearch
SearchType   sType
SearchItem   sName
If "%sName%"   == ""  Goto DoneSearch
If %sType%   == "dir"   Goto Check
If %sType%   == "file"   Goto SearchContinue

:SearchContinue
SearchNext
Goto StartSearch

:DoneSearch
EndSearch
Goto Finish

:Check
SetFunc  isExe  FileExists  %sName%\default.xbe
If %isExe%   != 1  Goto SearchContinue
SetFunc  strExeTitle   XBETITLE  %sName%\default.xbe
SetFunc  strExeID   XBEID     %sName%\default.xbe

:CheckPV
Set  strVidFound   "Was"
SetFunc  isVid  FileExists  %sName%\MXM_SS.wmv
If %isVid%   == 1  Goto CheckThm
Set  strVidFound   "Was Not"

:CheckThm
Set  strThmFound   "Was"
SetFunc  isThm  FileExists  %sName%\MXM_Thumb.jpg
If %isThm%   == 1  Goto CheckEntry
SetFunc  isThm  FileExists  %sName%\MXM_Thumb.png
If %isThm%   == 1  Goto CheckEntry
SetFunc  isThm  FileExists  %sName%\MXM_Thumb.bmp
If %isThm%   == 1  Goto CheckEntry
SetFunc  isThm  FileExists  %sName%\MXM_Thumb.tga
If %isThm%   == 1  Goto CheckEntry
Set  strThmFound   "Was Not"

:CheckEntry
Set  strEntryFound   "Was"
SetFunc  isEntry  FileExists  %sName%\MXM_Entry.xml
If %isEntry%   == 1  Goto InfoAvail
Set  strEntryFound   "Was Not"

:InfoAvail
Set  strInfoFound   "Was"
SetFunc  isInfo  FileExists  %InfoPath%\%strExeID%\MXM_Entry.xml
If %isInfo%   == 1  Goto ShowFindings
Goto SearchContinue

:ShowFindings
If %isEntry%   == 1  Goto SearchContinue
BeginDraw
MessageBox   "Game Found$eol$==========$eol$$eol$%strExeTitle%$eol$$eol$A MXM_Entry file %strEntryFound% Found$eol$A Preview Video %strVidFound% Found$eol$A Thumbnail %strThmFound% Found.$eol$$eol$Would you like to copy Media Info for this App/Game?$eol$$eol$Press \"A\" to Copy$eol$Press \"B\" to Skip$eol$$eol$"
EndDraw
Input
If %_GP_A%   == "1"  GOTO CopyInfo
Goto SearchContinue

:CopyInfo
Copy  %InfoPath%\%strExeID%\*     %sName%\
Goto SearchContinue

:Finish
BeginDraw
MessageBox   "MXMEntries has finished Running.$eol$$eol$NOTE: If you copied any of the MXM_Entry files, you will need to$eol$reset the menu cache and reboot.$eol$$eol$Press any button to exit$eol$$eol$"
EndDraw
Input
Quit



As usual, I would love to hear any feedback, suggestions, comments, questions... whatever...

Thanks
SDG  <
Logged

SumDumGuy3

  • Archived User
  • Newbie
  • *
  • Posts: 48
Actionscript Collection
« Reply #11 on: September 26, 2004, 12:22:00 AM »

In one of my above posts, I had a script called FreeOnDrv.xas. If you were using that you will want to get the corrected version. I edited the above post with the new code. At the time I wrote it I thought all values in $ShortDriveCFree$ where in MB. I was wrong as I found out. Now I check to see if it is KB, if so, I divide by 1024 to make it MB. Now all drives calculate correctly and the BigDrive.xas script can correctly choose the drive with the largest free space.

Thanks,
SDG  <
Logged

irajames1176

  • Archived User
  • Full Member
  • *
  • Posts: 192
Actionscript Collection
« Reply #12 on: December 02, 2004, 07:52:00 PM »

CODE

;#############################
;#                            
;# CREATOR: X5-176
;# DATE: 12.02.04
;# Action Script Name: XBL Cache Cleaner
;# VERSION: 1.0
;# Callfile Action Script                      
;# Function Description: Just a small action script
;# that will format your X:, Y:, Z: drives and delete
;# the cache in the E:\Cache folder. For those of
;# you who use XBL this might give you a small piece
;# of mind if you think MS is scanning your HDD
;#                                                                      
;#############################

:begin
BeginDraw UseCurrent
MessageBox "This will clear xbox cache$eol$Press A to Continue$eol$Press BACK to Cancel"
EndDraw
Input
If %_GP_A% == "1" GOTO APRESSED
If %_GP_BACK% == "1" GOTO BACKPRESSED
QUIT

:APRESSED
BeginDraw UseCurrent
MessageBox "This will FORMAT X Y Z$eol$and delete cache in E Cache$eol$Press A to confirm$eol$B to Cancel"
EndDraw

Input
If %_GP_A% == "1" GOTO A2PRESSED
If %_GP_BACK% == "1" GOTO BACKPRESSED
QUIT

:A2PRESSED
BeginDraw UseCurrent
MessageBox "Cleaning Xbox Cache$eol$Please Wait"
EndDraw
Delay 2
ALLOWFORMAT 1
FORMAT X:
FORMAT Y:
FORMAT Z:
DELETE E:\Cache\LocalCache00.bin
DELETE E:\Cache\LocalCache01.bin
DELETE E:\Cache\LocalCache02.bin
DELETE E:\Cache\LocalCache03.bin
DELETE E:\Cache\LocalCache04.bin
DELETE E:\Cache\LocalCache05.bin
DELETE E:\Cache\LocalCache06.bin
DELETE E:\Cache\LocalCache07.bin
DELETE E:\Cache\LocalCache08.bin
DELETE E:\Cache\LocalCache09.bin
DELETE E:\Cache\LocalCache10.bin
ALLOWFORMAT 0
BeginDraw UseCurrent
MessageBox "Done Cleaning Xbox Cache$eol$Press A to Shutdown$eol$Press B to return to Dash"
EndDraw

Input
If %_GP_A% == "1" GOTO A6PRESSED
If %_GP_B% == "1" GOTO BACKPRESSED
QUIT

:A6PRESSED
Shutdown

:BACKPRESSED
QUIT


This post has been edited by irajames1176: Dec 3 2004, 03:59 AM <
Logged