Restore game macro

Chris H.'s Ultima / ACS-style game development system!

Moderators: Ice Cream Jonsey, Chris H

Post Reply
rld
Posts: 223
Joined: Sun Jan 25, 2009 2:17 am
Location: Dallas, TX

Restore game macro

Post by rld » Thu Mar 10, 2011 9:51 am

Code: Select all

BlueTemplar:

But I still have a problem, I can't use your modification that call a macro after a load game, it did not work and I don't know what is the problem with my macro. Can you help me ? Here's what I have done :

It's a macro that load once when a new game begin, not at every launch of the game.
Macro 11: MACRO LANCEMENT  ()
        1: DRAW 999 100 TO 1 0 OF O O
        2: DRAW 999 99 TO 1 0 OF 0 0
        3: SET Z = 13056
        4: SET V = 12
        5: SET V = V * 256
        6: SET T = T & 255
        7: SET T = T | V
        8: STOP

And the macro that is called :

Macro 12: MACRO T 
        1: IF LOC[RG] = 1 THEN 7
        2: IF LOC[RG] = 2 THEN 4
        3: STOP 
        4: DRAW 999 100 TO 0 0 OF 0 0
        5: DRAW 999 99 TO 0 0 OF 0 0
        6: STOP 
        7: DRAW 999 100 TO 1 0 OF 0 0
        8: DRAW 999 99 TO 1 0 OF 0 0
        9: STOP 

This macro works when I load it in debug mode but is not called ... Where have I made a mistake ?

In the ACK configuration editor (page 1) do you have macro 11 set to run as the TITLE SEQUENCE MACRO or the INTRO SEQUENCE MACRO?

Also, just before you restore the game, check the value of Z using the debug function. Is Z still set to 13056?

What about after you restore the game? What is the value of Z at this point?

BlueTemplar
Posts: 8
Joined: Sat Jan 15, 2011 7:23 am
Location: France, near Bordeaux

Post by BlueTemplar » Fri Mar 11, 2011 4:11 am

Hi,
Macro 11 is set to run as an INTRO SEQUENCE MACRO, so it runs just once.

Before and after the restore game, the value of Z is set to 13056, V is set to 3072, T is set to 3072.

I think everything's fine, I don't know why it's not working.

rld
Posts: 223
Joined: Sun Jan 25, 2009 2:17 am
Location: Dallas, TX

Post by rld » Fri Mar 11, 2011 9:50 am

If you email me your game files, I will take a look and see if I can figure anything out.

BlueTemplar
Posts: 8
Joined: Sat Jan 15, 2011 7:23 am
Location: France, near Bordeaux

Post by BlueTemplar » Fri Mar 11, 2011 10:22 am

Ok I'll send you my game file with the ackx.exe modified with my version (translate) of the source code. I hope you can figured what's going on.

BlueTemplar
Posts: 8
Joined: Sat Jan 15, 2011 7:23 am
Location: France, near Bordeaux

Post by BlueTemplar » Sun Mar 13, 2011 5:13 am

I finally found what was wrong with my macro.

In fact the IF LOC[RG] doesn't work.

So I use a variable (C) that is the number of a region, a macro is launched when entering a region that set C to the number of the region. When macro T is called, the C variable will launch the good DRAW command. See the macro :
Macro 12: MACRO T
1: IF C = 1 THEN 7
2: IF C = 2 THEN 4
3: STOP
4: DRAW 999 100 TO 0 0 OF 0 0
5: DRAW 999 99 TO 0 0 OF 0 0
6: STOP
7: DRAW 999 100 TO 1 0 OF 0 0
8: DRAW 999 99 TO 1 0 OF 0 0
9: STOP

Macro 13: ENTER RG 1
1: SET C = 1
2: MACRO 12
3: STOP


Macro 14: ENTER RG 2
1: SET C = 2
2: MACRO 12
3: STOP
I hope it can helps someone. Thanks rld for the help !

User avatar
Tdarcos
Posts: 5781
Joined: Fri May 16, 2008 9:25 am
Location: Arlington, Virginia
Contact:

Post by Tdarcos » Sun Mar 13, 2011 2:41 pm

BlueTemplar wrote:
Macro 14: ENTER RG 2
1: SET C = 2
2: MACRO 12
3: STOP
I hope it can helps someone. Thanks rld for the help!
This reminds me of the Basic Programming Language.

I prefer the way IBM/370 assembler uses macros. Basically, you have a label in column 1, a pseudoinstruction, an op code or a macro name in column 10, and options for the item in column 16. (These are the conventions, the only real requirement is a space between the three items.) If column 1 is empty, it's no label. If the second and third entry are blank, it's an error (unless it's a blank line). If the third item is blank, it's usually error if not a macro (everything except macros and a few items have arguments; a macro can have or not have arguments). A macro can have just about any name with a few exceptions.

You declare a macro with the MACRO pseudoinstruction. The next line is the optional label template, the macro name and any arguments. Macros end with the MEND pseudoinstruction.

To use a macro you just use its name. And they did this on machines having less than 64K available for a user's program. To require numbers for macro identifiers in todays environment of computers with gigabytes of memory is inexcusable lasiness! Whoever set that up needs their programmer's license suspended and forced to get a McJob. A few months of having to do "would you like fries with that" at minimum wage might teach them a lesson.

Visit My Site; now with more than 103,716% more content than Pnback's!
"The lessons of history teach us, if they teach us anything, that no one learns the lessons that history teaches us."

rld
Posts: 223
Joined: Sun Jan 25, 2009 2:17 am
Location: Dallas, TX

Post by rld » Mon Mar 14, 2011 10:49 am

BlueTemplar wrote:I finally found what was wrong with my macro.

In fact the IF LOC[RG] doesn't work.

So I use a variable (C) that is the number of a region, a macro is launched when entering a region that set C to the number of the region. When macro T is called, the C variable will launch the good DRAW command.
I took a look at the source code for this. The problem seems to be that when a new region is entered, and the 'entrance macro' is called, the internal variable that LOC[RG] refers to has not yet been set to point to the new region.

This appears to be a simple fix that [probably] will not break anything else, so I will try to roll it into the next ACK patch to make LOC[RG] behave properly.

BlueTemplar
Posts: 8
Joined: Sat Jan 15, 2011 7:23 am
Location: France, near Bordeaux

Post by BlueTemplar » Mon Mar 14, 2011 11:18 am

Thanks rld, it will help me save some Macro. A macro = a region, I hope I'll have enough macro :).

Garth

Post by Garth » Sun Apr 10, 2011 8:26 am

Good work tracking down the bug guys!

Post Reply