Halstrom Posted March 26, 2015 Author Posted March 26, 2015 Ok simple one for you string guru's, I'm adding a DebugLog option to SCR pretty much copied straight from Docs script in Spunk, it works other than the VersionNumber for SCRturns into scientific notation for some reason. Â gSexoutSCRVersion == 20150326.1 Â I get this in debuglogfile instead: Â SCRStartLog:SCR version: 2.01503e+007 Â code is this: Print "SCRStartLog:SCR version: " + $gSexoutSCRVersionHad a moment's inspiration thinking it was so simple and tried this too but it won't compile: Â Print "SCRStartLog:SCR version: %8.1f" gSexoutSCRVersion
prideslayer Posted March 26, 2015 Posted March 26, 2015 The automatic tostring in the first example is doing that. NVSE doesn't actually use printf/sprintf to format strings, it uses its own bizarre version. My suggestion is to do like sexout does -- use integers rather than a float. Or use an integer and go to plain YYYYMMDDNN (ditch the decimal).
Odessa Posted March 26, 2015 Posted March 26, 2015 $ToString uses scientific notation for printing numbers that are very large, the same way as using "%g" Number. Â Print accepts string concatanation ("this" + "that" + $this) instead of string formatting, like PrintC and older NVSE functions do. This is usually more convenient/readable, but it is less flexible for printing numbers. So, I would suggest you just use PrintC in this case.
Halstrom Posted March 26, 2015 Author Posted March 26, 2015 Thanks guys I'll give PrintC a go, if not do some multiplication/division stuff
Halstrom Posted March 27, 2015 Author Posted March 27, 2015 Aggh... PrintC also rounds off floats by the looks  Stupid GECK maths is driving me nuts, spent an hour screwing with this and can't get it to work  If I do this: Set gSexoutSCRVersion to 20150327.1 Set fSCRVer to (gSexoutSCRVersion - 1) Set iSCRVer to fSCRVer Set fSCRDecimal to (gSexoutSCRVersion - iSCRVer) * 10 PrintC "SCRStartLog:SCR version: %8.0f.%1.0f " iSCRVer fSCRDecimalI Get:SCRStartLog:SCR version: 20150328.0  If I do this: Set gSexoutSCRVersion to 20150327.1 Set fSCRVer to (gSexoutSCRVersion - 2) Set iSCRVer to fSCRVer Set fSCRDecimal to (gSexoutSCRVersion - iSCRVer) * 10 PrintC "SCRStartLog:SCR version: %8.0f.%1.0f " iSCRVer fSCRDecimalI get:SCRStartLog:SCR version: 20150326.20
prideslayer Posted March 27, 2015 Posted March 27, 2015 Sweet jesus hal!! Â If we had fixed-point math I'd be with you, but floats aren't fixed point.. they're floating point. Why not just store them separately as integers, or use the bigger integer without the decimal point?
DoctaSax Posted March 27, 2015 Posted March 27, 2015 how about let iVersion := floor gSexoutSCRVersion let fVersion := gSexoutSCRVersion - iVersion let sv_version := sv_construct "%8.0" iVersion Print "SCRStartLog:SCR version: " + sv_version + "." + $fVersion
prideslayer Posted March 27, 2015 Posted March 27, 2015 It's still a float though, which means eventually you might run into precision problems.  Also of course if you do that with iVersion/floor, you can just use %g -- no need for the sv_construct.  Print "SCRStartLog:SCR version %g.%z" iVersion fVersion  Though this and yours will both print "wrong". fVersion will be something like 0.1, not 1, without a multiplication. That means it'll print 20150101.0.1 or something like that.
DoctaSax Posted March 27, 2015 Posted March 27, 2015 Ah, true about the multiplication so let fVersion := (gSexoutSCRVersion - iVersion) * 10 Â the sv_construct is really just to force the formatting specifier, although it's quite possibly not needed for just the 8-digit integer
prideslayer Posted March 27, 2015 Posted March 27, 2015 You don't need it for any integer. They will all print correctly no matter the value. The format specifier needs a type there, the '%8.0' on it's own won't work by itself -- needs to be '%8.0f' for example, and if you say %f for float (%g doesn't have precision) then you probably just end up with more scientific notation gibberish. Â Even multiplying that value by 10 will blow up once the fractional part gets to 0.11 and results in a 1.1. Â All the weird edge cases like that just aren't worth it IMHO. One big integer or a few smaller integers are the way to go.
DoctaSax Posted March 27, 2015 Posted March 27, 2015 I'm only on my second cup of coffee, man! You're right about the integers not needing format specs, and the f. Hal's been using date-based versioning for an age though, and I'm not sure switching to numbers is the best thing for him.  Something like let iInt := floor gSexoutSCRVersion let iDec := (gSexoutSCRVersion - iInt) * 10 Print "SCRStartLog:SCR version: " + $iInt+ "." + $iDec  should be fine, unless he plans on 10+ releases a day (!)
prideslayer Posted March 27, 2015 Posted March 27, 2015 What I'm thinking of is something along the lines of the version being just an integer (internal). Â iSexoutSCRVersion := 2015031505 Â This will fit in a signed integer until 2147. Â Then for display, to reintroduce the decimal.. Â printC "%g.%g" floor(iSexoutSCRVersion / 100), iSexoutSCRVersion & 63 Â I'm not suggesting he switch away from the date format, just that it be stored as an integer rather than a float to get away from all this floating point and printing stuff. Â Â Â -------- Â Err the "& 255" is wrong, it should be "& 63" which is as large as it can be without overlapping any of the date part, allowing for releases from yyyymmdd(0..63).
Odessa Posted March 27, 2015 Posted March 27, 2015 @Halstrom: Â From GECK wiki, "String Formatting" Â %X.Yf - This formats a number with minimum width X and maximum decimal points Y, replacing X and Y with that desired. Â In your example Y is 0, so no decimal point. Try this: Â PrintC "SCR Version: %.1f" gSexoutSCRVersion Â
Halstrom Posted March 28, 2015 Author Posted March 28, 2015 @Halstrom: Â From GECK wiki, "String Formatting" Â %X.Yf - This formats a number with minimum width X and maximum decimal points Y, replacing X and Y with that desired. Â In your example Y is 0, so no decimal point. Try this: Â PrintC "SCR Version: %.1f" gSexoutSCRVersion Yeah I tried that earlier, it still comes out as scientific notation. Â My other option is to go back to DebugPrint which works fine, it just means I need to turn SetDebugOn and add a condition block the few debugging messages in SCR, there's only 3 or 4 off them to block.
Guest tomm434 Posted March 29, 2015 Posted March 29, 2015 Any way to insert custom text into dialogue? (Player prompt). Â I tried to change player name and inserting "&Pcname; in prompt" and it worked but what if I need multiple dialogue choices? Â Also new NVSE version has new Events about player prompt but I couldn't get it to work. Does someone have test esp for new event?
Xpyke Posted April 9, 2015 Posted April 9, 2015 Hey guys, just a simple question, I'm having problems trying to import a custom nif I made inside GECK, and I created a post about it on the technical support general but It didn't gather much attention there, so may I put this kind of thing here as well or is it against the rules? Newbie question...
Guest Posted April 10, 2015 Posted April 10, 2015 Hey guys, just a simple question, I'm having problems trying to import a custom nif I made inside GECK, and I created a post about it on the technical support general but It didn't gather much attention there, so may I put this kind of thing here as well or is it against the rules? Newbie question... Â Well here's mainly for scripting. I'm going to take a look at your nif.
Xpyke Posted April 10, 2015 Posted April 10, 2015  Hey guys, just a simple question, I'm having problems trying to import a custom nif I made inside GECK, and I created a post about it on the technical support general but It didn't gather much attention there, so may I put this kind of thing here as well or is it against the rules? Newbie question...  Well here's mainly for scripting. I'm going to take a look at your nif.   Thanks! I made a new version in blender this time that is not on the original post so I'll put it here exportEDITED.nif  The post I've mentioned is http://www.loverslab.com/topic/45532-invisible-body-on-custom-armor/
Guest tomm434 Posted April 17, 2015 Posted April 17, 2015 Somebody knows why NPC can ignore EquipItem command?  First time bug was fixed by restarting the game. It might be connected with alternate start mod but it's not confirmed.
prideslayer Posted April 17, 2015 Posted April 17, 2015 Assuming you've already handled any "same frame" issues (don't add the item in the same frame you equip it or remove another item -- usually does work, sometimes does not) are you sure the previous item in that slot wasn't set with the nounequip flag? Was there possibly a script running that reequipped the old item?
Guest tomm434 Posted April 17, 2015 Posted April 17, 2015 My initial script made NPC equip that item only once in same frame but it  But I sent another esm where I made NPC equip that item with 0.1 sec delay and issue still stands (it happened to one of the user, today I got the same report from another user).   are you sure the previous item in that slot wasn't set with the nounequip flag? yep that might be the reason. But I just tried that case in my game and reequipping works fine.    Was there possibly a script running that reequipped the old item? Don't think there s any.
Guest tomm434 Posted April 17, 2015 Posted April 17, 2015 Hm I just tried doing the same manually via console and I couldn't - I think that's the reason - thanks a lot!
Guest tomm434 Posted April 19, 2015 Posted April 19, 2015 I've got a problem - I have 2 medium armors - one is vanilla (Combat armor), second is from one of the Courier packs (Lightweight metal armor). Both are set as "medium" in GECK. But ingame this script behaves differently:          let BitMask := GetEquipmentBipedMask Item          Print "Equipment bit mask is " +$BitMask          if BitMask == (SetBit BitMask, 3)           PrintC "Medium armor" It returns "Meium armor" for lightweight metal armor but for Combat armor it doesn't do anything. Here are pictures of their formIDs in GECK and how Print "Equipment bit mask is " +$BitMask shows up ingame.   Any ideas? Â
Halstrom Posted April 19, 2015 Author Posted April 19, 2015 Cjheck FNVEdit that they aren't being edited by a plugin perhaps.
Guest tomm434 Posted April 19, 2015 Posted April 19, 2015 Not any of them are affected by other plugins and they both have "medium" tags ingame
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now