Jump to content

How do you measure a .sto ?


StrongArmand

Recommended Posts

Hey there,

 

I'm trying to change a value in a store : alcohol strenght. So I've started to implent these adjustements thanks to a piece of TP2 (I love TP2, that's so powerful ! :suspect: ). Here :

 

COPY_EXISTING ~#SFrere.cre~ ~override/#SFrere.cre~

 

 

 

READ_LONG 0x4c "section_boisson"

READ_LONG 0x50 "numero_de_boissons"

READ_LONG 0x10 "force_alccolique"

 

 

INSERT_BYTES "offset_drink" ?

 

However I had a problem because I haven't the .sto's size. So I can't using INSERT_BYTES command because i don't know how many bytes possess this file. Did you know a way to find this data ?

Link to comment
Should you understand, you are copying a .cre file, you need to copy the .sto file.

 

Oh yes of course i've just forgotten to change .cre into .sto. So if I understand you, that would be looks like to something like that :

 

 

COPY_EXISTING ~#SFrere.sto~ ~override/#SFrere.sto~

 

 

 

READ_LONG 0x4c "section_boisson"

READ_LONG 0x50 "numero_de_boissons"

READ_LONG 0x10 "force_alccolique"

 

READ_SHORT 0x0022 ~storage~ //capacity

WRITE_SHORT ~storage~ = ~x~

 

INSERT_BYTES "offset_drink" x

 

That's right ?

Link to comment
That's right ?
What exactly are you trying to do? As if you are trying to insert the amount of items the store/storage can hold on the fly(at the installation), I would suggest to doing it this way:
PRINT ~Enter the Storage Capacity~
 ACTION_READLN ~x~
 OUTER_WHILE !(IS_AN_INT ~%x%~) BEGIN
PRINT ~Really, enter a number for amount the Storage can hold.~
ACTION_READLN ~x~
 END
 ACTION_IF (IS_AN_INT ~%x%~) THEN BEGIN
COPY_EXISTING ~#SFrere.sto~ ~override/#SFrere.sto~
READ_SHORT 0x22 ~storage~ 
WRITE_SHORT ~storage~ = ~x~

READ_LONG 0x10 "force_alccolique"
READ_LONG 0x4c "section_boisson"
READ_LONG 0x50 "numero_de_boissons"
...

Or is it the amount of items there is in the store... if it's this... I have no idea.

Hmm, you'll need a for command to it cause the READ_LONG 0x10 "force_alccolique" is from the additional table. The for command is goes like this: FOR (i=0;i<0x50;i+=1) BEGIN ... but there goes my limit of knowledge. Yeah, Mike's to the rescue.

Link to comment

Could you explain more about what you're trying to do? If you have a .sto that sells drinks already, and you want to change the alcoholic strength of some or all of the drinks, you don't need to insert any bytes - you just need to change what's already there.

 

COPY_EXISTING ~mystore.sto~ ~override~
 PATCH_IF (SOURCE_SIZE > 0x9b) BEGIN
READ_LONG 0x4c drinks_off // find out where drink information is located in the file
READ_LONG 0x50 num_drinks // find out how many drinks are listed
FOR (i = 0; i < num_drinks; i += 1) BEGIN // for each drink
  // get old alcoholic strength
  READ_LONG (drinks_off + 0x14*i + 0x10) alcoholic_strength
  // write new alcoholic strength (increased by 5 in this example)
  WRITE_LONG (drinks_off + 0x14*i + 0x10) alcoholic_strength + 5
END
 END
 BUT_ONLY

Link to comment
If you have a .sto that sells drinks already, and you want to change the alcoholic strength of some or all of the drinks

 

Yes exactly, I would like to change the alcoholic strength of all of the drinks. So thank you for your help. Your TP2 works great. :suspect:

 

There's no such attribute as "alcohol strength" in STO files (this field is the rumor rate).

 

Oh ? are you sure ? Because with iesdp I can see that :0x0010 4 (dword) Alcoholic strength. And with near infinity :

 

screenxq.png

 

In any case, there is an intoxification amount. But maybe there is an error in IESDP ?

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...