Skip to content
View in the app

A better way to browse. Learn more.

ResHax

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
Help us keep the site running.

Working with script arguments

Featured Replies

  • Author
  • Localization

HenryEx, posted Fri Aug 22, 2014 5:57 pm (236)


Hey, it's me again. I discovered the network functionality of QuickBMS and am using it to write a script to download Monster Hunter quests from Capcom's servers, which is usually only available via PSP. :)

I worked around my network inexperience and issues saving files to disk without using the print method in quickbms.txt. But i'll need the user to pass at least two arguments to the script: the file path to download and the 'game' region.
And apparently i have no clue how to get QuickBMS to accept more than one script argument.

I tried this one:
Code:
quickbms.exe -G -n -a QUEST/m60038.mib MHP2G_EU DownloadScript.bms "" ""
This results in "Error: wrong command-line argument (MHP2G_EU)".

And this one:
Code:
quickbms.exe -G -n -a QUEST/m60038.mib -a MHP2G_EU DownloadScript.bms "" ""
This seems to just overwrite the file in the 1st argument and quickbms_arg1 ends up being MHP2G_EU.


Aside from that: What's a good way to check in-script if an argument was passed? What's the initial value of an argument? This doesn't seem to work:
Code:
if quickbms_arg1 == ""
  Exit
endif




edit: I have a lot of questions, apparently! I mentioned doing this for downloading. Currently working on parsing the response header and reached implementing Chunked transfer coding. So there's a line before the chunks, indicating the size of the following chunk in a hex-number in text.
If i get it via "get SIZE line", how do i transfer the hex size text in SIZE into an actual hex number?
  • Author
  • Localization

aluigi, posted Sat Aug 23, 2014 6:13 am (239)


Apparently you must separate the parameters with a space or comma in -a, the function that handles it is the same that reads the arguments of the quickbms commands.
I'm going to fix immediately this behaviour by allowing also to specify two or more -a.
And I'm going also to add some examples or additional information.
I cannot change th original behaviour because there are scripts that use that method (*edit* I checked and some of my scripts use it as -a "arg1 \"arg2\" arg3" so I can't change it).

For checking if an argument has been passed doesn't exist a good way because the content of an uninitialized quickbms_arg1 is "quickbms_arg1", and so it's impossible to make real checks.
There are only work-arounds, for example:
Code:
if quickbms_arg1 & "quickbms_arg"
    cleanexit
endif
  • Author
  • Localization

HenryEx, posted Sat Aug 23, 2014 10:38 am (241)


Ah okay, comma-separated arguments work.

But your work-around to check for uninitialized arguments doesn't seem to work. I made a quick test.bms:
Code:
if quickbms_arg1 & "quickbms_arg1"
  print "No argument found: %quickbms_arg1%"
  CleanExit
else
  print "Argument passed: %quickbms_arg1%"
endif

This was the result:
Image

Apparently it triggers even if an argument is actually passed.


Edit:

OKAY, nevermind. I missed a single character, again. That's pretty clever, checking for most of the string but not all, and works like a charm. I'm still kind of puzzled by the behavior above, but at least i can pretty reliably check for arguments now. :)
  • Author
  • Localization

aluigi, posted Sat Aug 23, 2014 5:57 pm (250)


The behaviour of 'if quickbms_arg1 & "quickbms_arg1"' is caused by how quickbms handles variables and strings, almost everything you write in the commands is considered a variable but they have no content because the content is assigned at runtime.

Take the following command:
set VAR string "hello"

It creates 2 variables without content:
  • VAR
  • hello
Then at runtime "hello" will be the content of VAR.

Yeah this is not smart as python or javascript :)
But it makes the work.
Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.