PenUltima Online

It is currently Sun Oct 12, 2008 5:14 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: bug in parameters?
PostPosted: Thu Apr 19, 2007 4:01 pm 
Offline

Joined: Fri Feb 10, 2006 10:06 am
Posts: 79
Location: Italy
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....

_________________
Zandor


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 21, 2007 4:25 am 
Offline
POL Developer
User avatar

Joined: Sun Feb 12, 2006 9:50 pm
Posts: 836
Location: Indiana, USA
First off, calling line builds the struct incorrectly. Look into fixing that first and see if it still does it.

_________________
POL Developer - The Penguin Scripter


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Style based on FI Subice by phpBBservice.nl