Jump to content

Show message causes crash when using the %n switch


lorenzo19

Recommended Posts

This is such a simple problem I feel silly for having a problem with it. But here goes...

 

I have this code in a onAdd block of a armor that I am using as a token. I am trying to create a generic token and message that I can use for any actor.

 

begin OnAdd
set rMyContainer to GetContainer
if rMyContainer.isActor
rMyContainer.EquipItem CherryNeedsToken
ShowMessage aaCherryNeeds rSelf rMyContainer
endif
end OnAdd

 

The message is

 

%n has needs.

 

So, it should show a message that says... Cherry has needs. But it doesnt. It crashes.

 

If I remove the %n or change it to %i. It works fine and the token is equipped. Except %i prints the numeric ID which looks dumb.

 

I am also trying to figure out how to print the name of the token in a generic way, so I dont need a different message for every token.

 

I want to do something like this.... %n %n. Where the first switch is the name of the actor and the second is the name of the token. GetSelf causes a compiler error when used in a armor script.

Edited by lorenzo19
Link to comment
Share on other sites

The %n format specifier is FOSE and cannot be used with ShowMessage.

The only way you could have used it for your purpose would be with MessageEx and MessageBoxEx. Alas, those two functions were never implemented in FOSE.

Link to comment
Share on other sites

This is the 2nd time i heard that %n cannot be used with showmessage. But all the documentaion I have read on Betheda and silverlock says it does.

 

Not sayiing you're wrong. You making more sense than they are at this point. %i is FOSE too and it works in showmessage. Just wondering how you came to that conclusion.

 

I really really want to get this to work cause then i need only one message instead of a hundred.

Link to comment
Share on other sites

I had a very similar problem when making a Fallout 3 version of one of my mods (originally made for New Vegas). To my great disappointments, after some experimenting, I had to conclude that the %n format specifier simply doesn't work with ShowMessage.

 

The GECK wiki page of ShowMessage is confusing, because it lists many format specifiers that are confirmed to only work with Script Extender functions, not with ShowMessage (notice that all the code examples there use SE functions).

Link to comment
Share on other sites

Yeah thanks, I am beginning to think almost every function is bugged or documented incorrectly. I spend half my time tracking down bugs in the functions.

 

I am starting to come up with some funky work arounds. Like the obj ID and ref of inventory items are hidden from scripters in onadd, on equip, etc. I got 26 tokens so far and need their obj id to create a generic script for all of them. So i made a list of them and put each one's index into the value field. Then it just two functions to get their obj id from the list. Still cant get the ref ID.

 

As for the %n, I am going to try using the %a switch (print ascii) and spell out the name one character at a time. Going to take a bit of code and the names have to be hard coded into the script, but at least the script will still be generic

 

Don't tell me the %a switch doesn't work either. Better test it first before I jump into a lot of code.

Link to comment
Share on other sites

Good news is that %a does not crash the game. Bad news is it displays garbage instead of the ascii character. Something like 0x0.0000000p+ instead of the character. Neither does %{ %} work. Funny that %i works fine. That is FOSE. Too bad it is entirely useless.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...