Model3D::Poser::GetStringRes - Perl extension to emulate the GetStringRes() function called in the Poser 3d application
use Model3D::Poser::GetStringRes; my $stringVal = GetStringRes(1024, 1); print $stringVal; # prints "Body"; use Model3D::Poser::GetStringRes (':all'); my $string = " name GetStringRes(1024, 1)"; my $converted = ParseStringRes($string); print $converted # prints " name Body";
Model3D::Poser::GetStringRes duplicates as closely as reasonable the functionality of the GetStringRes function used in the Poser program, from, depending on when, Aldus, Metacreations, Curious Labs, E-Frontier, or (at the time of this module being written) Smith Micro.
This is not a locale-sensitive module because I don't know these strings in any language besides English, so I couldn't fill them in anyway. of course, this is ironic because the reason this function exists in Poser is to support multiple languages in source files.
By default, if GetStringRes is called on an address pair that does not have a definition in the strings matrix, or does not exist at all, it will return undef.
To modify this behaviour, set $Model3D::Poser::GetStringRes::emulation to either 'poser' or 'verbose'.
If the variable is set to 'poser' this module will attempt to emulate as closely as possible the actual behaviour of Poser, which is to return the entire "GetStringRes(x, y)" string if x is not defined, or to return an empty string if x is defined but y is not.
The one aspect that cannot be emulated (and you probably don't want it to) is causing your script to behave erratically if x index 1031 is asked for, which Poser does (in Poser, using, e.g. GetStringRes(1031, 1) in an actor, prop, or whatnot will cause that prop to refuse to fully load, but also not completely not-load, which will lead to the source file being locked, an actor or prop in the list, and an inability to delete it or completely select it). The fact that it does not emulate this bug exactly should be understood to be a good feature, not a shortcoming.
If emulation is se to 'verbose', ReadScript will return a verbose string explaining the missing value.
Emulation type names are not case sensitive. 'Verbose', 'verbose', 'VERBOSE', and 'vErBOsE' all work the same.
ParseStringRes uses GetStringRes internally, so changes to the emulation variable will affect this method as well.
ParseStringRes is not exported by default. GetStringRes is.
This module is not designed to function in an object-oriented manner. It merely exports functions.
GetStringRes() -- See above
Lemurtek and Bloodsong's original GSR Lookup page.
Rob Whisenant's appears to be offline, but as a Flash page with no Copy-Paste capacity, it was of limited use anyway.
Copyright (C) 2009 by XFX Publishing, LLC
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.006 or, at your option, any later version of Perl 5 you may have available.
These will almost definitely never happen because this does all I need it to right now. However, I recognise that the following things would be nice, and bid anyone who wants to update this welcome to do so:
* Locale support (or at least the capability thereof) * DAZ|Studio emulation (if different than Poser -- I'm not sure, really) * Reverse replacement lookups. However, this would be complicated, because if a Poser source file can only have these in string areas -- names, files, and the like. Control directives cannot be replaced with a GetStringRes() call. On the other hand, they don't have much opportunity to show up in the wrong places -- except IDs (like GROUND, UNIVERSE, etc) -- which I am not sure if can be replaced with a GetStringRes() call or not. Haven't tried it.