• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Help Needed]Can't find Emerald script commands anywhere.

15
Posts
6
Years
    • Seen Feb 27, 2020
    I'm trying to make a rom hack (just a simple one), and I'm trying to script an npc to give you an item. I have laid out exactly how I want the script to run, but I don't know the commands to make it do so. The line I'm having trouble with says:

    checkitem OLDSEAMAP 1
    compare LASTRESULT 0x1
    if == jump @OSM ' Equal To

    This is all what I want, except I don't want the script to jump if you DO have the old sea map already. I want the script to jump if you DON'T already have the item. I know this is the way to script a "compare equal to 0x1" because I see this everywhere in the regular emerald scripts, but i've never seen a situation where you would want it to not equal what you've set above. I hope this makes sense. Another thing I guess I could do is instead compare the LASTRESULT to equal 0 rather than having 1. I'm not sure how I would go about that either, tho. And i'm not 100% sure I even know what i'm talking about. But any and all help would be much appreciated. Thank you in advance!
     

    TheBatPrince

    Banned
    76
    Posts
    4
    Years
  • I'm trying to make a rom hack (just a simple one), and I'm trying to script an npc to give you an item. I have laid out exactly how I want the script to run, but I don't know the commands to make it do so. The line I'm having trouble with says:

    checkitem OLDSEAMAP 1
    compare LASTRESULT 0x1
    if == jump @OSM ' Equal To

    This is all what I want, except I don't want the script to jump if you DO have the old sea map already. I want the script to jump if you DON'T already have the item. I know this is the way to script a "compare equal to 0x1" because I see this everywhere in the regular emerald scripts, but i've never seen a situation where you would want it to not equal what you've set above. I hope this makes sense. Another thing I guess I could do is instead compare the LASTRESULT to equal 0 rather than having 1. I'm not sure how I would go about that either, tho. And i'm not 100% sure I even know what i'm talking about. But any and all help would be much appreciated. Thank you in advance!

    Oh whoa man...so it's true! The Pokemon Language for this game is like a Assembly language!

    So basically, what you do is learn these 7 sets of Instructions native to ALL Programming Languages dating back to 1960 (give or take the name of some of em being a bit off perhaps)!:

    Data Transfer/Storage (MOV)
    Procedural (CALL, RETURN)
    Control (JMP, CMP)
    Logical (AND, OR, NOT)
    Arithmetic (ADD, SUB, DIV, MUL)
    Miscellaneous (HLT, INT)
    ? (And 1 more other I forgot)


    But basically, Data Transfer or Storage is to do with making Objects. Objects are things like Variables, and some other stuff (usually all things, but ignore that for now). So if I make a String variable (another word for a "word" variable) like:

    String myVariable = "hello"

    That would make a Word variable. Where I could use a Print Instruction and directly say,

    CALL printBattleMessage(myVariable)

    And it will print "hello"! This is an example of using a Variable in there, or you can just type your message in there (this is general "pseudo code", meaning for any Language; but I don't know how it applies to this one). Basically printBattleMessage in my example would be a Procedure. In Assembly you usually put a CALL there to do it. It's just a way to put a bunch of Instructions all into a little Procedure, so rather than copying and pasting it several times making the File Size bigger, it can just simply "call" the same one over and over!

    However a Function can also take what they call "Parameters", which is just a simple way of saying that when calling the Procedure, you can send a little data from what they call "the Calling Code" to be used in that Procedure if it allows for it, and specifically the above printBattleMessage takes a Parameter of a String. That was an example of a 1 Parameter Procedure (or Function, which although is a specific type of Procedure; is just commonly called Function in today's Languages), but there are many others that will use more than 1 sometimes. You would separate them with a Comma, like:

    CALL multiplyThreeNumbers(5, 10, 2)

    And it will in order match those 3 with the 3 Parameters you can specify when making your own Procedures! Where it will multiply those 3 to make 100! Careful though, if you don't match the order of things to the order that the Procedure requires, you'll see that accidentally putting a String variable as a Parameter for something that was supposed to be a Number will crash the Program!

    So what I'm seeing by that Code you posted above, is that this is DEFINETLY an Assembly Language. They tend to call this more of a "Procedural Language", versus other ones like "Object Oriented" and such; where nearly every line of code is using a Procedure to do all of the work. So I recommend you go into my Post History (I'm too tired to :P) and find my last Post before this one on what I taught another person in a Thread about Hexadecimal Numbers. It's just a neat little Number System of 0 to 15 (16 total numbers) rather than our 0 to 9 Decimal symbol set. It'll help to understand when you see a "0x" type thing followed by a number. It's just an old tradition to use "0x" when using a Hex number versus a normal one, or even a Binary one.

    But, the way it used to be was you call CMP which will Compare the first Parameter with the 2nd Parameter, and set certain Data behind-the-scenes. Then, you can do JL (Jump If Less Than) if the 2nd was smaller than the 1st or whatever, JG for Greater Than, JGE for Greater Than or Equal To, which will be able to Jump to a certain section of Code. You would have typically called that a Label, where you add a little name Label next to the code with a Colon, and it will Jump to that, and then return back to where the Instruction Pointer was before!

    However this Language seems to take the "If" line from later Languages, but I just cannot seem to figure out what you're trying to do with the way you're using it. Is "OSM" a Label you defined? Why the Apostrophe? Why the EQUAL TO after?
     
    Last edited:
    15
    Posts
    6
    Years
    • Seen Feb 27, 2020
    However this Language seems to take the "If" line from later Languages, but I just cannot seem to figure out what you're trying to do with the way you're using it. Is "OSM" a Label you defined? Why the Apostrophe? Why the EQUAL TO after?

    So i'm still learning a lot of this scripting language, and I definitely don't feel as though I am well experienced with it. But you raise some good questions. A couple I can answer, and one i've never known but always wondered myself. As i've been learning this scripting language, i've always studied the similarities of the code that's already in the game and figured out how to apply it to custom scripts. I've essentially been copy and pasting commands and stuff while changing offsets as to not override current scripts. The @OSM is a dynamic offset that I created. It stands for the item i'm trying to script the NPC to give the player. "Old Sea Map." So for the sake of making it easier for me to read, I label it in that format (#org @OSM). When this script is compiled into it's game language, the script software automatically replaces the @OSM with a (seemingly) random string of 7 numbers and letters to create a unique offset. With dynamic offsets, the script software automatically finds unused offsets making it easier for me to add information to the game rather than replacing current information. As far as I am aware, the "check item" checks the player's bag for the item of my choosing. In this case, it's the old sea map. So it checks for the old sea map. I then set the amount of old sea maps I want to check for. The next line compares the amount of old sea maps in the bag with the amount I set with the "0x." In this example, the script is checking for "0x1" old sea map. So 1 of them. The next line is supposed to mean that if the compare equals the amount set, then it's going to jump through the script all the way to the "@OSM" offset. So the amount is set to look for 1 old sea map. If the player in fact has 1 old sea map, the result for the "compare" command would be ==. Because it equals the set amount. If it doesn't equal the previous amount set, it will skip the "jump @OSM" part and move on. I'm not sure why the apostrophe is there. That's one of the many things I just do because the game needs it to be that way. It's the same reason why I put the "checkitem" with no space followed by a space and then the item I want the game to check for. I don't know why the game reads it that specific way, but I've just learned by studying the script that it needs to be there. Same with the double equals sign and the apostrophe. I don't know why, but I just put it there lol
     
    Back
    Top