 |
Castle Paradox
|
View previous topic :: View next topic |
Author |
Message |
Mr B
Joined: 20 Mar 2003 Posts: 382
|
Posted: Thu May 17, 2007 7:57 am Post subject: Misc. Plotscripting Problems |
|
|
Primarily, I remember that a long time ago hspeak.exe would print "...taxing the peasants..." when compiling a script. I miss that. Is there a compile setting that will bring it back?
Is there any way to read whether a bitset is on or off for a hero? I suspect there is not, but I feel pretty confused with the plotscript dictionary -- it's so vast now, and I'm not sure that I've seen all of the entries or correctly understood them.
Is there any way to force game.exe to rescan the equipment-affected tags so the variable delay between when it is equipped and the tags are changed is reduced? I made a status bar that relies on equipment tags in order to function, and it gives horrifically incorrect data. Of course, it may be incorrectly scripted as well.
Code: | script, status bar, begin
# this script updates the status bar to reflect character effects
$11=" "
if(((check tag(3),or,check tag(8)),or,(check tag(12),or,check tag(13))),or,check tag(14)) then
(
$10="+++"
overwrite string(STATUS_BAR_STRING, 10, REGEN_POS)
) else ( overwrite string(STATUS_BAR_STRING, 11, REGEN_POS) )
if(((check tag(4),or,check tag(9)),or,(check tag(12),or,check tag(13))),or,check tag(14)) then
(
$10="!!!"
overwrite string(STATUS_BAR_STRING, 10, RECOVER_POS)
) else ( overwrite string(STATUS_BAR_STRING, 11, RECOVER_POS) )
if((check tag(5),or,check tag(10)),or,check tag(14)) then
(
$10=">>>"
overwrite string(STATUS_BAR_STRING, 10, HUSTLE_POS)
) else ( overwrite string(STATUS_BAR_STRING, 11, HUSTLE_POS) )
if((check tag(6),or,check tag(8)),or,((check tag(9),or,check tag(10)),or,(check tag(11),or,check tag(13)))) then
( replace char(STATUS_BAR_STRING, INVIS_POS, INVIS_ASCII) )
else ( replace char(STATUS_BAR_STRING, INVIS_POS, 32) ) # 32 = ASCII "space"
if(check tag(7),or,check tag(11)) then
( replace char(STATUS_BAR_STRING, PHEONIX_POS, PHEONIX_ASCII) )
else ( replace char(STATUS_BAR_STRING, PHEONIX_POS, 32) ) # 32 = ASCII "space"
end |
For part of the game I need to have enemies be visible or invisible depending on the equipment (as refered to in the above script). This is the relevant script, called by the script that triggers the battles:
Code: | script, process invisible enemies, begin
# This script makes the clear/invisible/weft enemies visible or invisible
if(((check tag(6),or,check tag(8)),or,(check tag(9),or,check tag(10))),or,(check tag(11),or,check tag(13))) then
(
set enemy appearance(09, enemy:picture, 09)
set enemy stat(09, stat:Dog, 0)
# lots of entries deleted
set enemy appearance(78, enemy:picture, 34)
set enemy stat(78, stat:Dog, 0)
) else (
show value(99)
set enemy appearance(09, enemy:picture, 0)
set enemy stat(09, stat:Dog, 999)
# lots of entries deleted
set enemy appearance(78, enemy:picture, 0)
set enemy stat(78, stat:Dog, 999)
)
end |
The script seems to correctly set the dodge values -- that hasn't been a problem. However, the pictures are not being changed. Ever. Can anyone explain this? ("show value(99)" definitely works, so those commands are being processed)
I don't really need the status bar, though it would be nice to have. However, making enemies visible and invisible is very important for the game. And as for the peasants, well... |
|
Back to top |
|
 |
Moogle1 Scourge of the Seas Halloween 2006 Creativity Winner


Joined: 15 Jul 2004 Posts: 3377 Location: Seattle, WA
|
Posted: Thu May 17, 2007 8:18 am Post subject: |
|
|
Could be that you've got the enemy numbers wrong. A quick test:
for(ctr,0,99) do (
set enemy appearance(ctr,enemy picture,0)
)
I seem to recall that the enemy numbers for plotscripts are offset by 1, so this might be the cause of your woes in this script. _________________
|
|
Back to top |
|
 |
Bob the Hamster OHRRPGCE Developer

Joined: 22 Feb 2003 Posts: 2526 Location: Hamster Republic (Southern California Enclave)
|
Posted: Thu May 17, 2007 8:21 am Post subject: Re: Misc. Plotscripting Problems |
|
|
Mr B wrote: | Primarily, I remember that a long time ago hspeak.exe would print "...taxing the peasants..." when compiling a script. I miss that. Is there a compile setting that will bring it back? |
Thy request hath been heard, and it shall be well considered.
Mr B wrote: | Is there any way to read whether a bitset is on or off for a hero? I suspect there is not, but I feel pretty confused with the plotscript dictionary -- it's so vast now, and I'm not sure that I've seen all of the entries or correctly understood them. |
Yes, the plotscripting dictionary is definitely in need of some organization. No command for reading hero bitsets exists at the moment.
Mr B wrote: | Is there any way to force game.exe to rescan the equipment-affected tags so the variable delay between when it is equipped and the tags are changed is reduced? I made a status bar that relies on equipment tags in order to function, and it gives horrifically incorrect data. Of course, it may be incorrectly scripted as well. |
Hmm? This delay comes as a surprise to me. How long of a delay are we talking about here? IIRC, the equipment tags get re-scanned as soon as you exit the equip screen, so I'm not sure how there could be a delay.
(..code...)
Mr B wrote: | The script seems to correctly set the dodge values -- that hasn't been a problem. However, the pictures are not being changed. Ever. Can anyone explain this? ("show value(99)" definitely works, so those commands are being processed) |
I have never personally given the 'plot:set enemy appearance' command any testing at all. Could be a bug... |
|
Back to top |
|
 |
Mr B
Joined: 20 Mar 2003 Posts: 382
|
Posted: Fri May 18, 2007 11:36 am Post subject: |
|
|
Moogle1 wrote: | Could be that you've got the enemy numbers wrong. A quick test:
for(ctr,0,99) do (
set enemy appearance(ctr,enemy picture,0)
)
I seem to recall that the enemy numbers for plotscripts are offset by 1, so this might be the cause of your woes in this script. |
Okay, great! I'll try that. Having the offset would be almost undetectable to me because of how I have the enemies organized.
James Paige wrote: | Thy request hath been heard, and it shall be well considered.
|
Yay! Would that make me an armchair autocrat?
James Paige wrote: | Hmm? This delay comes as a surprise to me. How long of a delay are we talking about here? IIRC, the equipment tags get re-scanned as soon as you exit the equip screen, so I'm not sure how there could be a delay. |
To tell the truth, it really varies (which leads me to suspect that it is at least partly my fault). It can take any amount of time. Re-equipping seems to help. Sometimes just entering and leaving the equip screen seems to help. Sometimes I just have to wait; I have that little "view active tags" menu on (F4, I believe), and sometimes the tags will just turn on.
To tell the truth, I haven't been particularly systematic in my testing. I'll look over both problems (items and enemies) and see if anything interesting appears.
Out of curiousity, does the tag-re-evaluation code run when equipment is added/removed via plotscripting? |
|
Back to top |
|
 |
Bob the Hamster OHRRPGCE Developer

Joined: 22 Feb 2003 Posts: 2526 Location: Hamster Republic (Southern California Enclave)
|
Posted: Fri May 18, 2007 2:31 pm Post subject: |
|
|
Mr B wrote: | Out of curiousity, does the tag-re-evaluation code run when equipment is added/removed via plotscripting? |
*checks*
Oh! hey! it looks like they are not. They really should be.
*changes*
Try again with tonight's 'nightly'
I wonder if there are any other places when item/hero bits are failing to be set. They *should* be set immediately after any change in your party, equipment, or inventory, but as we missed the equipment plotscripting commands we certainly could have missed other places too... |
|
Back to top |
|
 |
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
Posted: Fri May 18, 2007 6:33 pm Post subject: |
|
|
Mr B wrote: | Moogle1 wrote: | Could be that you've got the enemy numbers wrong. A quick test:
for(ctr,0,99) do (
set enemy appearance(ctr,enemy picture,0)
)
I seem to recall that the enemy numbers for plotscripts are offset by 1, so this might be the cause of your woes in this script. |
Okay, great! I'll try that. Having the offset would be almost undetectable to me because of how I have the enemies organized. |
Sounds sort of familiar, but it doesn't work that way anymore (it would have been a bug)
This seems like a good command to add as a builtin - string ID numbers make doing things like this quite awkward. _________________ "It is so great it is insanely great." |
|
Back to top |
|
 |
Mr B
Joined: 20 Mar 2003 Posts: 382
|
Posted: Mon May 21, 2007 6:25 am Post subject: |
|
|
James Paige wrote: | Try again with tonight's nightly |
Thanks! I think I will.
Well, the results of my experimentation are in, and they're...weird.
Setting all of the enemies to invisible does not change a single graphic -- instead it distorts the enemies' names. I had noticed this effect before, but wasn't sure it was related. Some of the names are offset (as if there were extra spaces on the end). Some of the names had the final letter spaced way over to the right. Some of the names had missing letters.
As far as equipped-item tags goes, equipping an item does not change the tag -- instead, the tags are updated whenever the hero interacts with an NPC. Of all things. It's very odd.
The Mad Cacti wrote: | This seems like a good command to add as a builtin - string ID numbers make doing things like this quite awkward. |
Code: | script, overwrite string, dest, snippit, pos, begin
# this script overwrites part of the string "dest" with the whole string "snippet" starting at position "pos"
variable(looper)
for(looper, 1, string length(snippit)) do
(
replace char(dest, pos, ascii from string(snippit, looper))
pos += 1
)
end |
Here's how I did it, if it's any help. Note the stylish lack of bound-checking. |
|
Back to top |
|
 |
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
Posted: Tue May 22, 2007 7:18 pm Post subject: |
|
|
Oh, you're right. Seems get/setenemyappearance is totally broken. I'm not sure what happened - there's always been a great deal of confusion with the enemy commands, redundancy, they've been changed many times, different commands added and removed, and accidently lost in SVN accidents and always untested.
Anyway, I fixed it (untested), try the next nightly. Now write/readenemydata and set/getenemyappearance are identical.
I'm thinking about a "splice string" command: insert one string in another either with or without overwriting. BTW: use of trimstring and copystring would be faster than copying character-by-character, but it requires a spare string (which is the bit about the way strings are implemented which I don't like) _________________ "It is so great it is insanely great." |
|
Back to top |
|
 |
Bob the Hamster OHRRPGCE Developer

Joined: 22 Feb 2003 Posts: 2526 Location: Hamster Republic (Southern California Enclave)
|
Posted: Wed May 23, 2007 8:22 am Post subject: |
|
|
The Mad Cacti wrote: | I'm thinking about a "splice string" command: insert one string in another either with or without overwriting. BTW: use of trimstring and copystring would be faster than copying character-by-character, but it requires a spare string (which is the bit about the way strings are implemented which I don't like) |
I had an idea for a simple way to improve string usability a little without breaking anything.
We could maintain a list of bitsets for whether or not a string ID is "allocated"
Then we could make a "new string" command that would return the ID of the first unallocated string.
Another "free string" command would blank a string and mark it unused.
All the commands that modify a string would also mark a string as being allocated, so games that use fixed string ID numbers would continue to work without modification.
Also, it would provide a nice framework for a future (post-ubersetzung) raising of the string limit, or even dynamic allocation of as many strings as needed |
|
Back to top |
|
 |
Mr B
Joined: 20 Mar 2003 Posts: 382
|
Posted: Fri May 25, 2007 11:58 am Post subject: |
|
|
Oooh! That sounds nice. A bit cleaner than implementing a stack and wrapping a lot of the string functions.
I'm going to try the nightly. I'll let you know if anything..."fascinating"...happens.
Thanks for the help, everyone. I really appreciate it. |
|
Back to top |
|
 |
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
Posted: Sat May 26, 2007 1:48 am Post subject: |
|
|
Well provided you are willing to allocate/manually mark all your strings, you could do that with scripts already.
But how are strings which are referenced by id without newstring ever marked as free again? I suppose we do this whenever they are both hidden and blank, though there's a small risk then that if you preset some strings with the location/colour/style that you want, but haven't actually put stuff in them yet, that they will be stolen.
That idea would make it much harder to confuse your strings, something I'm currently having troubles with. I just wish we could manipulate strings in a functional programming style, like
Code: | show string ("Total gold: " $+ number to string (party money)) |
instead of
Code: | variable (temp)
temp := new string
$temp="Total gold: "
append number (temp, party money)
show string (temp)
free string (temp)
|
But that possibility is mostly gone. _________________ "It is so great it is insanely great." |
|
Back to top |
|
 |
Mr B
Joined: 20 Mar 2003 Posts: 382
|
Posted: Tue May 29, 2007 7:30 am Post subject: |
|
|
Just to let you know, the enemy picture changing works like a charm now. Thanks for the fix! |
|
Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|