Author Topic: Repeat field script musing  (Read 2711 times)

Synergy Blades

  • Guest
Repeat field script musing
« on: 2006-07-09 21:59:00 »
Halkun's post reminded me. I was going to post to see if anyone can shed any light on repeated script offsets. Here's one from uutai1, the entity is savel0:



Now, as far as I have it down, the multiple 0x1607 means that there's no actual script for these offsets where the offset is repeated. But as you'll see, rather than continue to the end of the 32 offsets, further on down the row the offset does change and all of a sudden we have new scripts after 4 repeats of 0x1607. So, ignoring these, I read the script as:

Code: [Select]
Script 1: Init

LINE (79,FD,5A,04,00,00,D7,FD,6C,04,00,00)
RET ()
RET ()

--

Script 2:

RET ()

--

Script 3:

Sound (00,67,01,40)
IfUByte (D0,5B,01,0A,16)
UC (01)
MENU2 (01)
window (00,3E,00,0A,00,B4,00,39,00)
message (00,15)
UC (00)
MENU2 (00)
BIT-ON (D0,5B,01)
SET-WORD (20,1E,00,00)
RET ()

--

Script 4:

BIT-OFF (D0,5B,01)
SET-WORD (20,1E,00,02)
OR2 (20,1E,00,01)
RET ()

So I reduced the repeated offsets to just one to see if it had any effect. Visually there were no problems with the save point, but actually going to use it caused some unusual behaviour, notably that moving through the save point repeatedly brings up the Save dialog (Access the menu and select... etc.) instead of it just appearing once until you leave and go back in (quite difficult to get out of the save point), and it also becomes difficult to get Save enabled in the menu (you seem to have to go to an exact point rather than just generally on the object).

So it would seem the repeats would be necessary; how does this affect the reading in of the script? What should the above script output really read when there are these repeats? I'm beginning to think I shouldn't have that second script, the single RET() there, but then what's the point in having these repeats? Any help is appreciated.
« Last Edit: 2006-07-09 22:03:53 by Synergy Blades »

halkun

  • Global moderator
  • *
  • Posts: 2097
  • NicoNico :)
    • View Profile
    • Q-Gears Homepage
Re: Repeat field script musing
« Reply #1 on: 2006-07-09 22:06:17 »
In my script dumper, I parse it like this... (from startmap)

Quote
#################### Entity 2 (tifa) ####################
                                                                               
ENTITY(2) = tifa
                                                                               
tifa (script 0)
{
      INIT:
1d1:    char(1)
1d3:    pc(2)
1d5:    ret
      BASE:
1d6:    ret
}
                                                                               
tifa (script 1)
{
1d7:    ret
}

alias tifa (script 1 to 31)
                                                                         

######### EDIT ############

If you want to muse over something... Check this out... This is from md1stin

Quote
#################### Entity 2 (ba) ####################
                                                                               
ENTITY(2) = ba
                                                                               
ba (script 0)
{
      INIT:
531:    char(1)
533:    pc(1)
535:    if-sw(20,0,0,1,0,5,c)
53d:    xyzi(0,0,51,f,61,6b,43,1,1e,0)
548:    ret
      BASE:
549:    jmpb(0)
}
                                                                               
ba (script 1)
{
54b:    ret
}
                                                                               
alias ba (script 1 to 2)
                                                                               
ba (script 3)
{
54c:    tlkon(0)
54e:    solid(0)
550:    visi(1)
552:    msped(0,0,c)
556:    move(0,17,e,40,6c)
55c:    dir(0,75)
55f:    canm!2(3,0,27,1)
564:    wait(28,0)
567:    canm!2(3,27,30,1)
56c:    ret
}
                                                                               
ba (script 4)
{
56d:    move(0,fc,e,6f,72)
573:    move(0,fa,d,b0,72)
579:    ret
}
                                                                               
alias ba (script 4 to 31)


The question is, why the break in the middle? That's pretty odd huh?
« Last Edit: 2006-07-09 22:12:52 by halkun »

Synergy Blades

  • Guest
Re: Repeat field script musing
« Reply #2 on: 2006-07-09 22:11:21 »
I get that too. However, startmap has none of the repeats like those in the image I posted. Give uutai1 a go and see what your dumper comes up with for that one.

I tried removing the second script with the single RET and now the entire save point doesn't work, so I suppose it does need to be there.



EDIT: Yeah, there you go, there's one of the repeats I'm talking about. The thing is, they do seem to need to be there, as I say - taking them out of uutai1 disrupts the save point's functioning. My question, I guess, is - why, and why four for the save point, two for that ba script...?
« Last Edit: 2006-07-09 22:20:05 by Synergy Blades »

halkun

  • Global moderator
  • *
  • Posts: 2097
  • NicoNico :)
    • View Profile
    • Q-Gears Homepage
Re: Repeat field script musing
« Reply #3 on: 2006-07-09 22:21:49 »
This is what I have.
Quote
#################### Entity 27 (savel0) ####################
                                                                               
ENTITY(27) = savel0
                                                                               
savel0 (script 0)
{
      INIT:
1626:   line(79,fd,5a,4,0,0,d7,fd,6c,4,0,0)
1633:   ret
      BASE:
1634:   ret
}
                                                                               
savel0 (script 1)
{
1635:   ret
}
                                                                               
alias savel0 (script 1 to 2)
                                                                               
savel0 (script 3)
{
1636:   sound(0,67,1,40)
163b:   if-ub(d0,5b,1,a,16)
1641:   uc(1)
1643:   menu2(1)
1645:   window(0,3e,0,a,0,b4,0,39,0)
164f:   message(0,15)
1652:   uc(0)
1654:   menu2(0)
1656:   bit-on(d0,5b,1)
165a:   set-word(20,1e,0,0)
165f:   ret
}

savel0 (script 4)
{
1660:   bit-off(d0,5b,1)
1664:   set-word(20,1e,0,2)
1669:   or2(20,1e,0,1)
166e:   ret
}
                                                                               
alias savel0 (script 4 to 31)

However, my alias routine has a  bug it and spitting out the wrong numbers (I corrected them here, but I might be wrong)

#### EDIT ####

At least we are getting the same results
« Last Edit: 2006-07-09 22:46:24 by halkun »