xboxscene.org forums

Pages: 1 ... 3 4 [5] 6 7 ... 9

Author Topic: Share Scripts For Others  (Read 1570 times)

chilin_dude

  • Archived User
  • Hero Member
  • *
  • Posts: 3068
Share Scripts For Others
« Reply #60 on: October 01, 2003, 07:53:00 AM »

QUOTE (BenJeremy @ Oct 1 2003, 04:48 PM)
QUOTE (onthereal @ Oct 1 2003, 11:34 AM)
QUOTE (chilin_dude @ Oct 1 2003, 07:52 AM)
Edit:
biggrin.gif  biggrin.gif  biggrin.gif  Just had a great but simple idea for a script!
How about one that makes your xbox shutdown after 30 minutes (obviously this would only work IN MXM,) this would be great for people who listen to music as they go to sleep  biggrin.gif

This might work, but I think MXM halts all music and movies while a action script is running.  Since I’m at work I can’t test it.

CODE

;##############################
;#                            #
;#  Sleep Timer Script        #
;#  Version: 0.5              #
;#  By: The Anticrust         #
;#                            #
;##############################

SET seconds "1800"

; !!!DO NOT EDIT Below if you do not know what you are doing!!!

:Count
If %seconds% == 0 GOTO Halt
If %seconds% != 0 GOTO Subtract
QUIT

:Subtract
BeginDraw UseCurrent
MessageBox "Xbox will be going to sleep in %seconds% seconds"
EndDraw
DELAY 1
SUB %seconds% 1
GOTO Count
QUIT

:Halt
BeginDraw UseCurrent
MessageBox "Good night..."
EndDraw
DELAY 5
Shutdown
QUIT

Correct, but I will look at some triggers and such to fire ActionScripts.

So short answer: not at the moment. Soon.

Well thanks on the real that will be handy when it can be used... i take it where 1800 seconds is i could change this to whatever i want?
Then say name one script xbox off 10min. another xbox off 20 min etc?

Ben J must say these scripts are turning out damn nice... i think you should include the dvd ripping one in the default.xbe or something so that the n00bs to mxm see it can rip there games too!
Thanks for the hard work again BJ!
Logged

DBZRacer

  • Archived User
  • Full Member
  • *
  • Posts: 239
Share Scripts For Others
« Reply #61 on: October 01, 2003, 02:37:00 PM »

Action Script Name: PxHDDLoader Folder Renamer

Purpose: This action script searches for folders created by PxHDDLoader in your E and F drive and prompts you if you want to rename the undescriptive PXGame0000 folder name to the more descriptive XBE Title.

Please note: This script is based off the latest MXM 9n6 WIP binaries and will not be useable by 9n5 users...  tongue.gif

PxHDDLoaderRenamer.xas
CODE

;PxHDDLoader Renamer MXM Action Script
;Written by DBZRacer
;Purpose: This MXM action script searches for folders created by PxHDDLoader in your E and F drive and
;prompts you if you want to rename the undescriptive PXGame0000 folder name to the more descriptive XBE Title.

:Start
BeginDraw UseCurrent
  MessageBox "  - PxHDDLoader Folder Renamer - $eol$Press X to Rename folders in Drive E$eol$Press Y to Rename folders in Drive F$eol$Press B to Cancel"
EndDraw
Input
 If %_GP_Y% == "1" GOTO FDriveSelected
 If %_GP_X% == "1" GOTO EDriveSelected
 If %_GP_B% == "1" GOTO Cancel
Quit

:FDriveSelected
SETFUNC FolderEmpty PATHEMPTY F:\hddloader
IF %FolderEmpty% == "1" GOTO FolderNotFound
SET HDDLoaderPath "F:\\hddloader"
GOTO DefineSearch

:EDriveSelected
SETFUNC FolderEmpty PATHEMPTY E:\hddloader
IF %FolderEmpty% == "1" GOTO FolderNotFound
SET HDDLoaderPath "E:\\hddloader"
GOTO DefineSearch

:FolderNotFound
BeginDraw UseCurrent
  MessageBox "PxHDDLoader Root Folder Not Found on Drive"
EndDraw
Delay 2
QUIT

:DefineSearch
BEGINSEARCH %HDDLoaderPath%\pxgame*
GOTO SearchTop

:SearchTop
IF %search_type% == "dir" GOTO DIRFound
IF %search_type% == "file" GOTO NextSearch
GOTO DoneSearch

:DIRFound
SETFUNC GameTitle XBETITLE %HDDLoaderPath%\%search_name%\default.xbe
BeginDraw UseCurrent
  MessageBox "%GameTitle% found in %search_name% folder$eol$Press Y to RENAME %search_name% to %GameTitle%$eol$Press A to Skip to next folder$eol$Press B to Cancel Script"
EndDraw

Input
 If %_GP_Y% == "1" GOTO RenameFolder
 If %_GP_A% == "1" GOTO NextSearch
 If %_GP_B% == "1" GOTO Cancel
Quit

:RenameFolder
RENAME  %HDDLoaderPath%\%search_name% %HDDLoaderPath%\%GameTitle%
BeginDraw UseCurrent
  MessageBox "%search_name% has been renamed to %GameTitle%$eol$Press A to find next match$eol$Press B to Cancel Script"
EndDraw

Input
 If %_GP_A% == "1" GOTO NextSearch
 If %_GP_B% == "1" GOTO Cancel
Quit

:NextSearch
SearchNext
GOTO SearchTop

:Cancel
BeginDraw UseCurrent
  MessageBox "PHDDLoader Folder Renamer Action Script Cancelled"
EndDraw
DELAY 5
QUIT

:DoneSearch
EndSearch
BeginDraw UseCurrent
  MessageBox "PxHDDLoader Folder Renamer$eol$              Completed $eol$ Please REBOOT XBOX NOW $eol$    for changes to take effect"
EndDraw
DELAY 10
ResetMenuCache
QUIT


Script has been updated/cleaned. I have tested this as much as I can so please post feedback if theres any errors that you guys encounter with the script...
Logged

vexx22

  • Archived User
  • Newbie
  • *
  • Posts: 42
Share Scripts For Others
« Reply #62 on: October 01, 2003, 03:32:00 PM »

Cool Script DBZRacer, i have a question because your %search_name%string%, i know what it is and what it do, but by me it has no function, how old is your wip version?
Logged

DBZRacer

  • Archived User
  • Full Member
  • *
  • Posts: 239
Share Scripts For Others
« Reply #63 on: October 01, 2003, 03:38:00 PM »

QUOTE (vexx22 @ Oct 1 2003, 04:32 PM)
Cool Script DBZRacer, i have a question because your %search_name%string%, i know what it is and what it do, but by me it has no function, how old is your wip version?

I was using yesterdays WIP binaries. It shouldnt matter if you're using todays WIP as the %search_name% wasnt affected by yesterdays bug.

If you're getting empty results for %search_name% then that means you dont have any folders that start with "pxgame" in your hddloader directory... I can add a check in there later to display a message if it can't find a folder to rename...
Logged

vexx22

  • Archived User
  • Newbie
  • *
  • Posts: 42
Share Scripts For Others
« Reply #64 on: October 01, 2003, 04:24:00 PM »

Can somebody explain me this string?  "IF#" i treid to programm an automatic script that should go through the whole ABC to search folder who begin with thi letters. But i need more, or automatic change the T* to the letter U* after going to IF string ABC_* and the * change through the ABC.


Set useit "P*"
GOTO los
:ABC_T
Set useit "T*"
GOTO los


:los
BEGINSEARCH d:\data\%useit%


IF %search_type% == "dir" GOTO run
IF %search_type% != "dir" GOTO ABC_T
Logged

BenJeremy

  • Archived User
  • Hero Member
  • *
  • Posts: 5645
Share Scripts For Others
« Reply #65 on: October 01, 2003, 04:35:00 PM »

QUOTE (vexx22 @ Oct 1 2003, 08:24 PM)
Can somebody explain me this string?  "IF#" i treid to programm an automatic script that should go through the whole ABC to search folder who begin with thi letters. But i need more, or automatic change the T* to the letter U* after going to IF string ABC_* and the * change through the ABC.


Set useit "P*"
GOTO los
:ABC_T
Set useit "T*"
GOTO los


:los
BEGINSEARCH d:data%useit%


IF %search_type% == "dir" GOTO run
IF %search_type% != "dir" GOTO ABC_T

IF# is for numeric comparisons...

CODE

IF# %arg1% < %arg2% GOTO SOMETHING


If arg1 is 5 and arg2 is 100, IF# evaluates correctly because it converts the arguments to numbers before comparing, but IF does not (it compares the strings, and alphanumerically, "100" is less than "5" because the comparision is per character)
Logged

BenJeremy

  • Archived User
  • Hero Member
  • *
  • Posts: 5645
Share Scripts For Others
« Reply #66 on: October 03, 2003, 06:33:00 AM »

QUOTE (sandman2869 @ Oct 3 2003, 10:17 AM)
I have been playing with these scripts for the past couple of days, trying to understand the logic behind it all. This is what I have so far:

You can add an actionscript to your menu.xml as an item in the menu and then run it from there.

Well, there are a couple other ways to execute them as well...

QUOTE

This is what I need help understanding:

What are the .xas files for and how do I use them?


.xas files are text files with ActionScripts in them... think of them like DOS BATCH files. They are executed using "CallFile xxxx.xas"

You could use these so you would not need to update your MXM.xml file to modify an existing script, for example. If the calling menu item used a CallFile to load a script from an .xas file, it can be easily replaced/modified.

QUOTE

What is context and why would I want to use an actionscript in context mode?


Context means you can define custom menu items in "Game Options" - and when you execute a script in a context menu item, it gets specific information about the item selected in the menu. This means you can add, for example, a "Delete Game" option, that already knows what game you've selected, and even that it's on the hard drive, not on the DVD.

QUOTE

Is there a way to do looping? Like if I want to rename all of the PxGame* directories to the xbetitle, is there a way for me to do into f: hddloader and check to see how many directories there are, thus renaming the directories as I go?


Sure, using IF# (which does a numerical evaluation fo the variables) and labels:

CODE


SET Index 0
:TOPOFLOOP
ADD Index 1
IF# %Index% < 10 GOTO TOPOFLOOP



QUOTE

I have read the readme txt file as well as all of the clinic and am not getting it. I know I'm not the brightest apple in the bunch here, but I can't be that retarded, can I?

Please help.


Sorry if it's a little obtuse. ActionScripting shoudl be familiar to those who have created old MS-DOS Batch files, but since that's an art that's probably not been practiced regularly in 8 years, it's understandable that some might not understand too well.

QUOTE

PS. I have added the current scripts from this thread as menu items in my menu.xml and am loving them, and am currently working on a couple (very very simple) of my own, but would like to expand more on these capabilities.

Thanks in advance
Logged

BenJeremy

  • Archived User
  • Hero Member
  • *
  • Posts: 5645
Share Scripts For Others
« Reply #67 on: October 03, 2003, 07:01:00 AM »

QUOTE (sandman2869 @ Oct 3 2003, 10:49 AM)
BJ,

Plain and simple, you rock! Thank you sir...

QUOTE
.xas files are text files with ActionScripts in them... think of them like DOS BATCH files. They are executed using "CallFile xxxx.xas"

so if I understand you correctly, I would need something like this in my menu.xml:

<item>
<Title> Test </Title>
<Action>
CallFile blahblah.xas
</Action>
</Item>

Correct?


Correct.

QUOTE

You mentioned my mxm.xml file, but the only actionscript I had in there was my autoexec, should I be adding them to the mxm file instead?

Thanks again for the quick reply.


Well, you can use "CallScript" to access scripts defined in the mxm.xml file. There may be a complex script that would be better suited to calling more generic scripts to do repetitive tasks, in which case, you'd define those in the MXM.xml file.

I'm working on easier ways to integrate the stuff, as well, for example, downloading "plug-in" scripts and such, automatically from the web.
Logged

DBZRacer

  • Archived User
  • Full Member
  • *
  • Posts: 239
Share Scripts For Others
« Reply #68 on: October 03, 2003, 11:52:00 AM »

QUOTE (sandman2869 @ Oct 3 2003, 07:17 AM)
Is there a way to do looping? Like if I want to rename all of the PxGame* directories to the xbetitle, is there a way for me to do into f: hddloader and check to see how many directories there are, thus renaming the directories as I go?

If you want to do true looping, I would wait till the next rev comes out. Then you can test my xas i posted above. I was going to go the same route as you with the counter to change the string to PxGame0001 to PxGame 0002 etc but saw it to be very innefiecent. I'm glad BJ implemented the search function so quickly.  beerchug.gif

With the new search functions in the upcoming release, you can have action scripts do wildcard searches instead of doing simple counter searches now...

Hopefully the script I posted helps a little. I have tested it again and again and have had it run perfectly. It prompts me to change a PXGame000_ folder to the xbe title until it finishes runs out of PxGame000_ folders to find.

Next script I'll work on is an auto-evox-upgrade script which can be easily done now with a few changes to the PxHDDLoader folder renamer I made but I wanted to put some checks in there
Logged

DeVante

  • Archived User
  • Full Member
  • *
  • Posts: 110
Share Scripts For Others
« Reply #69 on: October 03, 2003, 03:58:00 PM »

CODE


SET SomeVar $DVDType$
TrayClose
Delay 20

:check
If %SomeVar% == "game disc" GOTO Launch
If %SomeVar% != "game disc" GOTO Begin

:begin
   trayopen
   BeginDraw UseCurrent
   MessageBox "Please insert a game.$eol$$eol$Press 'A' to Continue$eol$Press 'B' to

Cancel"
   EndDraw

   Input
 If %_GP_A% == "1" GOTO APRESSED
 If %_GP_B% == "1" GOTO BPRESSED
   QUIT

:APRESSED
   trayclose
   delay 20
   goto check

:BPRESSED
   QUIT

:Launch
   SETFUNC DVDTitle XBETITLE D:DEFAULT.XBE

   BeginDraw UseCurrent
   MessageBox "%DVDTITLE%$eol$$eol$Press 'A' to Launch Game$eol$Press 'B' to Cancel"
   EndDraw

   Input
 If %_GP_A% == "1" GOTO A2PRESSED
 If %_GP_B% == "1" GOTO BPRESSED
   QUIT

:A2PRESSED
LaunchDVD
MessageBox "%DVDTitle%$eol$$eol$Loading game..."
QUIT



Also, what is the correct format for if/then statements?
For instance, if I can't get the above to work, I'll try it with a statement such as: "IF EXIST "D:default.xbe" THEN GOTO LAUNCH"

Also, is there a way to either call a script from within a script or reset a script and start over? If I can't get the above script to work, I could try to reset or re-call the script if the disc type isn't a game.
Logged

BenJeremy

  • Archived User
  • Hero Member
  • *
  • Posts: 5645
Share Scripts For Others
« Reply #70 on: October 03, 2003, 04:08:00 PM »

CODE

IF goto


It requires a string on either side of the comparison "op" nothing else will work.
Logged

vexx22

  • Archived User
  • Newbie
  • *
  • Posts: 42
Share Scripts For Others
« Reply #71 on: October 03, 2003, 04:23:00 PM »

cool.gif . I tried it like you say there are problems but it runs corrct. And for little Changes like this one you don´t need to post the complete script again. Because it is posted in the beginning of this topic. i added the tray open in my script but forget to post it, thanks to you for remebering me to this change.
Logged

vexx22

  • Archived User
  • Newbie
  • *
  • Posts: 42
Share Scripts For Others
« Reply #72 on: October 03, 2003, 04:26:00 PM »

For launching a simple DVD it is ok i think. Problem are everywere. But if anyone can repair this script please do it and post the new code. But not something like adding delay time.
Logged

DeVante

  • Archived User
  • Full Member
  • *
  • Posts: 110
Share Scripts For Others
« Reply #73 on: October 03, 2003, 05:24:00 PM »

Alright, I moved the first SETVAR to be under the DELAY 20 and I added another SETVAR under the delay in the "APRESSED" portion of the script.

Same problem. :/

Any other ideas? I'll try to mess with a few more things.
Logged

DeVante

  • Archived User
  • Full Member
  • *
  • Posts: 110
Share Scripts For Others
« Reply #74 on: October 03, 2003, 05:49:00 PM »

So DBZRacer, does that Launch Disc script you wrote work for you?

I tried it (without altering it at all) and it just freezes/sits at the "Checking Disc Status..." message box.
Logged
Pages: 1 ... 3 4 [5] 6 7 ... 9