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?