Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#26 1970-01-01 00:33:30

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 283/3,508

Re: Scripting problems

I can't remember off the top of my head how it determines this, but that might be right. I'll check when I'm at the house cause i don't have my notes here.

Offline

#27 1970-01-01 00:33:30

Miksy91
Member
Registered: 2010-10-16
Post 141/2,317

Re: Scripting problems

It actually does that (not sure why I didn't bother checking it before posting).
Function for items is for example 1 (in GoldMap) and for trainers in red colours, 130 (82)

Offline

#28 1970-01-01 00:33:30

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 284/3,508

Re: Scripting problems

Nice

Offline

#29 2010-12-22 22:06:20

Miksy91
Member
Registered: 2010-10-16
Post 209/2,317

Re: Scripting problems

I'm having a problem with repointing text data at 0x101E69 "(5A)'s SPCL.DEF rose!"
However, it doesn't seem any normal pointer would lead to that offset.

What I wanted to do, is to make it say instead of SPCL.DEF, Intelligence.
So not much of a job really, just can't find any pointer that would lead to the original offset.

Offline

#30 2010-12-22 23:05:16

Tauwasser
Member
Registered: 2010-10-16
Post 58/448

Re: Scripting problems

Those texts in these blocks are usually addressed by in-text command 16, a three byte pointer to the text. So basically, search for that and determine if you have found false positives.

cYa,

Tauwasser

Offline

#31 2010-12-24 06:33:03

Miksy91
Member
Registered: 2010-10-16
Post 212/2,317

Re: Scripting problems

I've something to ask about BitTable commands.
I've now made a couple of scripts by using bit numbers that aren't named in this table in the Additional table B.

I was just wondering if it's save to do so...
The bit numbers I've used are 2120 and 2020 btw.

Last edited by Miksy91 (2010-12-24 06:33:59)

Offline

#32 2011-02-11 23:50:25

Miksy91
Member
Registered: 2010-10-16
Post 276/2,317

Re: Scripting problems

Let's bump up this thread; this time, I'm trying to manage to create a somewhat complicated script :D
This shouldn't be too hard but I'm not familiar with all those ram commands yet so I believe some of you can help me figure out a way to do this.

What I'm planning to do:
1) In the script, the game checks if you have at least two pokemon in your party
2) In case you do, the script continues further and if you don't, it should continue from another offset which will eventually end the script

I tried to use this command but it won't work because in case you have only one pokemon in your party, byte in 0xDA24 is set to FF.
I'm not planning to add missigno number 0xFF in the game. Any ideas how to fix this ? :)
Part of the script: 19 24 DA 08 EB 49...


Party pokemon
DA22 - Total
DA23 - Pokemon 1
DA24 - Pokemon 2
DA25 - Pokemon 3
DA26 - Pokemon 4
DA27 - Pokemon 5
DA28 - Pokemon 6
DA23 - End of list


P.S
I was also trying to find a way how to make it check that byte in 0xDA22 is not set to 01.
That would work perfectly too.

Last edited by Miksy91 (2011-02-11 23:52:48)

Offline

#33 2011-02-12 08:26:09

Tauwasser
Member
Registered: 2010-10-16
Post 108/448

Re: Scripting problems

Use command 1C with argument 01 and then use commands 0A or 0B to check if it's less than or greater than some number or 06 if you're sure the script cannot be called with 0 pokemon present.

With 0x08 and 0x09 you will only test if it's == 00 or <> 00, which is not what you want, since 0x00 is never put into the list in the first place.

So basically do this:

[1C][01][0A][02][Pointer less_than_2_pkmn]... script >= 2 pokemon present...

cYa,

Tauwasser

Offline

#34 2011-02-12 09:01:00

Miksy91
Member
Registered: 2010-10-16
Post 278/2,317

Re: Scripting problems

Okay, thanks :)
Actually, I already figured out a way to do it.
That 1C code looks a little less complicated but anyways, it works now.

Now the script is type: 19 22 DA 06 01 XX YY :D
And yes, you can't access that script without a pokemon so I won't bother avoiding that "glitch" which youtube recorders might call it.

Edit:
It wouldn't have been hard to figure out how to do it unless you had written more info about the RAM codes.
Other ram codes (06, 07, 0A and 0B) seem to contain 4 bytes while codes 08 and 09 contain only 3 bytes.
I don't think that's well-explained in there :|

Otherwise, your scripting document is fantastic :)

Last edited by Miksy91 (2011-02-12 09:09:45)

Offline

#35 2011-02-12 11:47:45

Tauwasser
Member
Registered: 2010-10-16
Post 109/448

Re: Scripting problems

I actually noticed that while looking up 0x0A yesterday... It seemed clear to me, because I knew that some codes needed a byte for comparison while others didn't ;)

I'd still suggest using the 1C command. Direct memory access is kind of troublesome to decipher later on...

cYa,

Tauwasser

Offline

#36 2011-02-20 17:03:28

Miksy91
Member
Registered: 2010-10-16
Post 290/2,317

Re: Scripting problems

Help needed, once again :D

I'm trying to accomplish in making a script for opening a door (changing block to another) using a key but when you return to the map, of which door can be opened with the key, the door tile has turned back to normal (so I can change the block but when the room is left, the changed block will turn out the same as it is in the original map data).

I believe I should put something in the Map's Script but I really have no idea what to do.
By making those crystal "hacks", I remember that if I edited the door tile in Goldenrod Underground (that has to be opened with Basement Key), the door would have still stayed there. Now, I need something similar to that to make this script work.

Offline

#37 2011-02-20 17:19:04

Tauwasser
Member
Registered: 2010-10-16
Post 112/448

Re: Scripting problems

Just use a flag to indicate when the key was used and then check it in the script header and set the block accordingly.

cYa,

Tauwasser

Offline

#38 2011-02-21 06:24:08

Miksy91
Member
Registered: 2010-10-16
Post 292/2,317

Re: Scripting problems

Easier said than done; I'm having problems to make the game load the script.

The script header is now at 0x1599CC and looks like this:
00 00 00 01 03 E0 59

0x1599E0
31 2A 00 09 F0 59 49 8F

0x1599F0
79 04 00 05 49 8F


Nothing happens because, obviously, the script header structure doesn't point to the wanted script...

Offline

#39 2011-02-21 19:15:59

Tauwasser
Member
Registered: 2010-10-16
Post 113/448

Re: Scripting problems

Miksy91 wrote:

Easier said than done; I'm having problems to make the game load the script.

The script header is now at 0x1599CC and looks like this:
00 00 00 01 03 E0 59

That's the wrong layout. Right now, the script header is 00 00.

Take a look at the doc:

[[Number1 of pointers] Number1 * [2byte pointer to script][00][00]][[Number2 of pointers] Number2 * [Number][2byte pointer to script]]

Since you don't want to have the trigger parts of the script header, you set it to 0x00, which is fine. However, for some reason you chose to put two 0x00's after it. Maybe because you confused the grouping (in bold)?

So the correct header would be:

00 01 03 E0 59

Moving on:

Miksy91 wrote:

0x1599E0
31 2A 00 09 F0 59 49 8F

What's the 49 for? This will seriously screw things up. You should also use a priority jump for your script, since this will make sure it gets executed right away and halts parts of the engine during execution. So in effect, you should point to something like this:

8C F0 59 8F

@1599F0:

31 2A 00 08 @end

79 04 00 05 49

@end:

90

cYa,

Tauwasser

Offline

#40 2011-02-25 17:08:20

Miksy91
Member
Registered: 2010-10-16
Post 296/2,317

Re: Scripting problems

I'll try to get it working now, thanks for the help !

About this one:
[[Number1 of pointers] Number1 * [2byte pointer to script][00][00]]

I thought it this way:
[Number1 of pointers] = 00

So, 00 (Number1 * [2byte pointer to script]) 00 00 = 00 00 00


Edit:
I guess I didn't get it...

Right now, script header: 0x1599CC

0x1599CC
00 01 03 D2 59

0x1599D2
8C E0 59 8F

0x1599E0
79 04 00 05 49

I didn't bother making it point to the part where it checks if the bit is set or not yet as it doesn't seem to work at all.
Any ideas what's wrong this time ?

Last edited by Miksy91 (2011-02-25 17:46:49)

Offline

#41 2011-02-25 19:33:42

Tauwasser
Member
Registered: 2010-10-16
Post 115/448

Re: Scripting problems

Well, you will also have to change the ID number in the header.

0x03 means the script gets executed before any map data is actually loaded. So basically, you write stuff to RAM, then the actual mapdata is overwriting it. Try 01 for your script.

cYa,

Tauwasser

Offline

#42 2011-02-25 20:00:29

Miksy91
Member
Registered: 2010-10-16
Post 299/2,317

Re: Scripting problems

By changing 03 to 01, there was no affection to the game btw.

But shouldn't I be using 02 instead (it didn't work either though) ?
Also, is 02 = Number2 * [Number] in this case, (I mean that [Number] = 02 but is Number2 = [the amount of pointers] (=1) ?)
And, what does 5 in Map Change (x) mean ?

Sry if I'm bothering you with questions that you can't remember answers to...

Offline

#43 2011-02-25 21:38:16

Tauwasser
Member
Registered: 2010-10-16
Post 117/448

Re: Scripting problems

Well, you should look at the script again. If it doesn't execute at all, there is definitely something odd. However, did you make sure nothing else is wrong? As a prime rule, don't use savestates on the map to test this, since some parts of the map might not have been reloaded in ram.

Map Change (x) means it's executed as xth command when doing a map change. You will see they don't always follow the same order absolutly, however, the are always executed at the relative same positions when loading map through different mechanisms. The mechanisms themselves are described in Additional Documentation: Map Loading Processes. Some processes can be identified uniquely, which are Warpless Map Connections, Warps etc. (though I currently cannot find where I put that info...)
However, an important point to consider is the following: Not all script get executed by all forms of loading a map! For instance, scripts with ID 0x05 are not executed after returning from fights. However, all of them are executed when using warps or changing maps by warpless connection, except 0x02 which are not executed at warpless map change*.

Basically, this info was just provided for additional info concerning map loading. As for your question, you can use different IDs (which I called "[Number]" in the doc) to try to see if you get it working.
Basically, you should ake the ID which has loaded the data you try to affect. That is why there are different setups. For instance, if you take the wrong one, you will have no effect on map data, since it will be overwritten. If you use an ID that will make your script be executed after the map data has been loaded completely, you might not have an effect on blocks next to the player, since the collision data for them has already been loaded, etc.

However, before you do that, you should check if what you're doing is actually the right thing to do. You want to change a block at the very border of the map, at block (2, 0), to block 0x05. Are you sure this is what you want and what you are actually debugging with?
If you still cannot get it to work, you will have to provide more info and more data. Take a screenshot of the map you want to edit, offsets etc.

cYa,

Tauwasser

* P.S.: The reason for this is that loading tilesets and sprites is not done for warpless map changes. The ID is likely intended for changes to people event data.

Offline

#44 2011-02-26 06:11:17

Miksy91
Member
Registered: 2010-10-16
Post 300/2,317

Re: Scripting problems

As you can see, the map is a normal gate map:

gatei.png

I've double-checked that the script pointer really is 56:59CC and now have set the ID to 01 (I tried it with all the ones from 01 to 05).
Actually, I wanted to make it change block at (2,0) to block 0x04 but 0x05 was there only to make me notice the change better if it happens.


Map data of the map at 0xAA877:
02 02 2F...

Collision data of block 0x04 (71 71 00 00) and 0x2F (07 07 00 00).


So basically, in the game itself, you receive a key which can be used to open the door.
When opening the door first time, this script occurs, "79 04 00 04", and then it works properly.
In the script header, I want to write the exact same thing with a bit table check (which is set when the door is opened with the key).

Last edited by Miksy91 (2011-02-26 06:16:57)

Offline

#45 2011-03-12 08:21:52

Miksy91
Member
Registered: 2010-10-16
Post 305/2,317

Re: Scripting problems

YEEAH :DDDD


I finally got this thing working !
I'm not sure if you explained in a wrong way (or I just misunderstood it) but Priority Jump1 must not be used with scripts called from part two of the script header. Then again, they have to be ended with Return code1.

So what I did is that I re-wrote the code and it looks now like this:
00 01 02 D7 59....31 2A 00 09 E0 59 8F...79 04 00 04 49 8F


Not only that but I believe I'm able to make some Trigger scripts now as well ;)

Last edited by Miksy91 (2011-03-12 08:22:42)

Offline

#46 2011-03-12 10:07:15

Tauwasser
Member
Registered: 2010-10-16
Post 121/448

Re: Scripting problems

Ah, sorry, yeah. I was confused bakc then which script it was going to be ^^" Nice to see it working for you.

cYa,

Tauwasser

Offline

Board footer

Powered by FluxBB