zandor70
Joined: 10 Feb 2006 Posts: 79 Location: Italy
|
Posted: Thu Apr 19, 2007 8:01 pm Post subject: bug in parameters? |
|
|
I have a very strange problem:
I have a script:
| Code: |
loc := TargetCoordinates(who);
print("x trasmitted="+loc.x); //DEBUG
npc := CreateNpcTemplate(template, loc.x, loc.y, loc.z, who.realm, Struct { "facing" := who.facing } );
|
And a function:
| Code: |
function CreateNpcTemplate(template, x, y, z, realm := _DEFAULT_REALM, props := 0, cprops := 0)
print("x received="+x); //DEBUG
|
I have tryed to change name function.
Now this is strange error shown from output of the 2 print:
| Code: |
x trasmitted=5576
x received=struct{ objtype = 0, realm = "britannia", x = 5576, y = 1253, z = 0 }
|
It is a VERY strange problem... I pass Cint, loc.x but function receive entire loc struct.... why? How is this possibile?
I have tryed to read also template, y, z and the other parameters... error is only on x parameter....
Only if I use as function:
| Code: |
function CreateNpcTemplate(template, x, y, z, realm := _DEFAULT_REALM, props := 0, cprops := 0)
if (x.x)
x := x.x;
endif
print("x received="+x); //DEBUG
|
then "x_received" is ok....
I have tryed with polcore 097 RC2 RC2.1 and RC3
I have done this try:
Modified function:
| Code: |
function CreateNpcTemplate(template, temp, x, y, z, realm := _DEFAULT_REALM, props := 0, cprops := 0)
print("temp received="+temp); //DEBUG
print("x received="+x); //DEBUG
|
And function:
| Code: |
loc := TargetCoordinates(who);
//print("x trasmitted="+loc.x); //DEBUG
npc := CreateNpcTemplate(template, loc.x, loc.x, loc.y, loc.z, who.realm, Struct { "facing" := who.facing } );
|
And now print() output is:
| Code: |
temp received=struct{ objtype = 0, realm = "britannia", x = 5576, y = 1250, z =
0 }
x received=5576
|
so it is not a x member TargetCoordinates() related problem, but it seem a problem in a specific number of parameter:
the second parameter always report enture struct: first parameter see loc.x like "loc", while second parameter see "loc.x" like "loc.x"
Now I have tryed:
| Code: |
function CreateNpcTemplate(x, template, y, z, realm := _DEFAULT_REALM, props := 0, cprops := 0)
print("x received="+x); //DEBUG
loc := TargetCoordinates(who);
print("x trasmitted="+loc.x); //DEBUG
npc := CreateNpcTemplate(loc.x, template, loc.y, loc.z, who.realm, Struct { "facing" := who.facing } );
|
And print report is now:
| Code: |
x trasmitted=5575
x received=<uninitialized object>
|
Please reply me why I an thinking to be crazy.... |
|