[OBSE] GetName

Post » Tue Mar 16, 2010 6:30 pm

I made a small script to learn using GetName command, but i cannot make it work properly.

ref target
string_var name (i used: as well.)

Begin OnAdd

set target to getcontainer
set name to target.getname

messageboxEX "Mr/Mrs %n thanks you for your help." name

end

Well... the dialogue works fine, but when i get the result its like this:

Mr/Mrs thanks you for your help"

I used SetActorFullName from console to change the name , maybe it stuck, but i got the same again.
I want it to get actor's name, that uses this script. And i cannot understand where the problem is.
Any help will be great.
Thanks
User avatar
REVLUTIN
 
Posts: 3498
Joined: Tue Dec 26, 2006 8:44 pm

Post » Wed Mar 17, 2010 8:35 am

Don't you need to have the variable "name" at the end of the messagebox line in order to let the command know what %n refers to?
User avatar
Hannah Whitlock
 
Posts: 3485
Joined: Sat Oct 07, 2006 12:21 am

Post » Wed Mar 17, 2010 8:58 am

Don't you need to have the variable "name" at the end of the messagebox line in order to let the command know what %n refers to?


Ah typing mistake.... sorry.
Thats not the problem :(
User avatar
Benjamin Holz
 
Posts: 3408
Joined: Fri Oct 19, 2007 9:34 pm

Post » Wed Mar 17, 2010 1:22 am

This script is on an item in the person's inventory?
User avatar
jessica robson
 
Posts: 3436
Joined: Mon Oct 09, 2006 11:54 am

Post » Tue Mar 16, 2010 11:52 pm

This script is on an item in the person's inventory?


The script is attached on item.
When the dialogue starts, it puts the item in his inventory.
Removes it when finished.
User avatar
Sammie LM
 
Posts: 3424
Joined: Thu Nov 30, 2006 1:59 pm

Post » Wed Mar 17, 2010 10:10 am

Either use %n with a reference (i.e. "target") or %z with a string_var (i.e. "name").

In your case, it is best to stay with the %n, so you don't have to have an extra string_var (which you would have to explicitly destruct before removing the item, btw).
User avatar
Steve Bates
 
Posts: 3447
Joined: Sun Aug 26, 2007 2:51 pm

Post » Tue Mar 16, 2010 8:21 pm

Either use %n with a reference (i.e. "target") or %z with a string_var (i.e. "name").

In your case, it is best to stay with the %n, so you don't have to have an extra string_var (which you would have to explicitly destruct before removing the item, btw).

'
ref is crushing....my game.
string_var works fine with n% but i cant get the npc name.
only this value.
User avatar
Connor Wing
 
Posts: 3465
Joined: Wed Jun 20, 2007 1:22 am

Post » Tue Mar 16, 2010 9:29 pm

'
ref is crushing....my game.
string_var works fine with n% but i cant get the npc name.
only this value.

Have you changed the "%n" to "%z" as QQuix asked you to?

What you did was to first store the name of the container in the name variable, and then try to print out the non-existant name of the name variable, and not its content. To print its content (which should be the name of the container) you need to use "%z". "%n" is only for printing the name of ref variables.
User avatar
Alan Whiston
 
Posts: 3358
Joined: Sun May 06, 2007 4:07 pm

Post » Tue Mar 16, 2010 6:17 pm

Yes!!!

string_var name
%z

and worked :)
Thanks
User avatar
Greg Swan
 
Posts: 3413
Joined: Tue Jun 05, 2007 12:49 am


Return to IV - Oblivion