Decorate ACS string sharing

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: Decorate ACS string sharing

Re: Decorate ACS string sharing

by Nash » Sun Apr 08, 2012 5:36 pm

If ACS gets real strings, would that mean [wiki]StrCpy[/wiki] become obsolete?

Re: Decorate ACS string sharing

by randi » Sun Apr 08, 2012 3:42 pm

I have decided to deny this.
  1. Names are case-insensitive. This may or may not be a problem for people using this.
  2. There is no way to do proper bookkeeping to keep track of names stored in ACS variables across savegames.
  3. Giving ACS real strings would be a better solution. Despite protestations, I can probably get it done within a day.

Re: Decorate ACS string sharing

by Major Cooke » Sat Sep 10, 2011 5:10 pm

Oh my... Holy mother of...

Testing this hot shit out ASAP!

Decorate ACS string sharing

by FDARI » Wed Sep 07, 2011 3:23 pm

When trying to write relatively generic ACS scripts for mods, I frequently struggle with the inability to pass strings from decorate

My proposed solution is to extend the print and strparam functions for ACS with the ability to reference "names" (globally available strings valid throughout the lifetime of the application) by their integer indexes.

The ACS print syntax is extended with the instruction "g: ‹name index›"

Decorate is extended with a new expression that takes any string and returns the permanent index of that string. It will have one, or one will be created automatically. Definition: int strIndex (string converttoindex)

Using this you can pass arbitrary class names, variable names, states and any other kind of message to a script that expects the index of a globally stored name.

It is assumed that the name index assignment is a deterministic process. As long as the executable remains unmodified, and the same (unmodified) wads are loaded in the same order, I expect that the name indexes will also be valid when loaded from previously save games. If this is not true, then the return value from STRindex would have to be considered a short-life value that should be used and discarded immediately (ideally not allowing a single tick to pass, which mandates the use of ACS_executewithresult for instant script triggering).
Spoiler: Example purposes
Attachments
acc.zip
Modified ACC binary
(30.45 KiB) Downloaded 73 times
Fname.zip
Extremely simple test
(867 Bytes) Downloaded 64 times
fname.zip
Patches
(1.32 KiB) Downloaded 69 times

Top