It is currently Fri Nov 21, 2008 11:23 pm

All times are UTC - 8 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Arrays
PostPosted: Mon Feb 13, 2006 11:35 am 
I'm not sure if this qualifies as a bug, if it's just strangeness, or if I'm missing something important. When building arrays of gump statements (and I'm fairly sure our shard is running the latest version of POL 096), I've encountered some issues that prevent the built gumps from displaying properly depending on how the array is assembled. Here is an example:

Code:
use uo;

program textcmd_test (me, text)
   var aGumpPiece1 := array;
   var aGumpPiece2 := array;
   var aGumpPiece3 := array;
   var aGumpLayout1 := array;
   var aGumpLayout2 := array;
   var aGumpLayout3 := array;
   var aGumpData := array;
   var iGumpChoice := 0;
   
   aGumpPiece1 := {
      "page 0",
      "resizepic 50 50 2620 150 150"
   };
   
   aGumpPiece2 := {
      "gumppic 60 60 14",
      "gumppic 60 90 16"
   };
   
   aGumpPiece3:= {
      "gumppic 60 120 18"
   };

   // Method 1
   aGumpLayout1 := aGumpPiece1;
   aGumpLayout1.append (aGumpPiece2);
   aGumpLayout1.append (aGumpPiece3);
   SendSysMessage(me, "Gump1: " + aGumpLayout1);
   iGumpChoice := SendDialogGump (me, aGumpLayout1, aGumpData);
   
   //Method 2
   aGumpLayout2 := aGumpPiece1 + aGumpPiece2 + aGumpPiece3;
   SendSysMessage(me, "Gump2: " + aGumpLayout2);
   iGumpChoice := SendDialogGump (me, aGumpLayout2, aGumpData);

   //Method 3
   aGumpLayout3 := aGumpPiece1;
   foreach item in aGumpPiece2;
      aGumpLayout3[len(aGumpLayout3 + 1)] := item;
   endforeach
   aGumpLayout3[len(aGumpLayout3 + 1)] := aGumpPiece3;
   SendSysMessage(me, "Gump3: " + aGumpLayout3);
   iGumpChoice := SendDialogGump (me, aGumpLayout3, aGumpData);

endprogram


Each method seems to generate extra characters that prevent parts of the gump from displaying, but I can't pin down why with any consistancy, except for the append method. With appends, I always get extra characters.

Anyone have any thoughts?


Top
  
 
 Post subject:
PostPosted: Mon Feb 13, 2006 11:09 pm 
Offline
POL Developer
User avatar

Joined: Sun Feb 12, 2006 9:50 pm
Posts: 836
Location: Indiana, USA
You are appending arrays into arrays, etc. Append only strings into the arrays (no need for the {} brackets around your stuff if you appending it into an array). That is one thing.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 14, 2006 4:07 pm 
Yup, that would certainly explain some of it, and may give me enough to figure out why I'm getting inconsistant results in pinning down my errors. Part of it is I'm trying to make arrays that are larger than single dimensional, and in one case an array of structs. Not easy sometimes keeping track of which plane I'm working with. :)


Top
  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 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