Author Topic: Examine Window pops up .... BLANK ??  (Read 645 times)

Legacy_Grieyls

  • Jr. Member
  • **
  • Posts: 58
  • Karma: +0/-0
Examine Window pops up .... BLANK ??
« on: June 14, 2011, 06:38:48 am »


               Greetings fellow scripters, how are you all today? I'm good but have run inot a little snag.

Anyway to explain I have a book placeable that when a player clicks on will add a relevant book item into their inventory. The book placeable then destroys itself as if it had been picked up. This I got working fine, however I also wanted the Examine Window to pop up automatically so that the player could start to read the books description, ie the text written on the pages. Now I get the examine window popping up but for some reason it is totally blank and is not displaying the descriptive text of the book the PC has only just aquired.

Now does anybody have any insight as to why this might be? I will include my script which is on the OnUsed handle of the Book placeable.

void main()
{
    object oPC = GetLastUsedBy();
    CreateItemOnObject("le_item046", oPC);
    FloatingTextStringOnCreature("You pick up the dusty tome and open the cover", oPC, TRUE);
    ActionWait(2.0);
    AssignCommand(oPC, ActionExamine(GetItemPossessedBy(oPC, "LE_ITEM046")));
    DestroyObject(OBJECT_SELF, 0.0);
}


Revised Script that works.

void main()
{
    object oTome = OBJECT_SELF;
    object oPC = GetLastUsedBy();
    object oBook = CreateItemOnObject("le_item046", oPC);
    string sBookDis = GetDescription(oBook, TRUE, FALSE);

     //Add description of oBook to oTome.
    SetDescription(oTome, sBookDis);

     //Floating Text above oPC
    FloatingTextStringOnCreature
    ("You blow dust off the cover as you pick up the journal.", oPC, TRUE);

     // Examine oTome
    AssignCommand(oPC, ClearAllActions(TRUE));
    AssignCommand(oPC, DelayCommand(1.0, ActionExamine(oTome)));

     // Destroy oTome
    DelayCommand(2.0, DestroyObject(OBJECT_SELF, 0.0));
}


               
               

               


                     Modifié par Grieyls, 16 juin 2011 - 03:31 .
                     
                  


            

Legacy_Alex Warren

  • Sr. Member
  • ****
  • Posts: 326
  • Karma: +0/-0
Examine Window pops up .... BLANK ??
« Reply #1 on: June 14, 2011, 06:48:56 am »


               Sorry, no idea where the problem is, maybe in ActionWait (it's assigned to the placeable). you might want to try this:

void main()
{
   object oPC = GetLastUsedBy();
   object oBook = CreateItemOnObject("le_item046", oPC);
   DestroyObject(OBJECT_SELF);
   FloatingTextStringOnCreature("You pick up the dusty tome and open the cover", oPC, TRUE);
   AssignCommand(oPC, ActionWait(2.0));
   AssignCommand(oPC, ActionExamine(oBook));
}
               
               

               


                     Modifié par Alex Warren, 14 juin 2011 - 05:49 .
                     
                  


            

Legacy_CID-78

  • Sr. Member
  • ****
  • Posts: 261
  • Karma: +0/-0
Examine Window pops up .... BLANK ??
« Reply #2 on: June 14, 2011, 09:12:27 am »


               You should use Alex method with CreateItemOnObject() instead of getting it later by tag. You can improve your own Script by getting the placeables Tag and use it to determine which blueprint you want to create.

And you will beable to reuse the script for all kind of dusty tomes.
               
               

               
            

Legacy_Grieyls

  • Jr. Member
  • **
  • Posts: 58
  • Karma: +0/-0
Examine Window pops up .... BLANK ??
« Reply #3 on: June 14, 2011, 01:54:08 pm »


               Alex tried your method... Does the same thing really, placeable vanishes, PC gains the book item examine window appears but is blank. Thanks for making the suggestion though. This is quite the mystery.. Hmmm... Perhaps I'm supposed to check something in the OnItemAquire handle on the actual module.... Meh, I'm grasping at straws now.
'Image 

Oh very good tip CID, yes I see the logic in your statement. Now if I can only figure out why the examine window is blank I'll be going on a book aquire frenzy.
'Image
               
               

               


                     Modifié par Grieyls, 14 juin 2011 - 01:00 .
                     
                  


            

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0
Examine Window pops up .... BLANK ??
« Reply #4 on: June 14, 2011, 02:33:35 pm »


               Use this instead of the wait then examine:

DelayCommand (2.0, AssignCommand(oPC, ActionExamine(oBook)));

 I just tested both ways, and the other method only shows item properties for me, while this means showed the description as well.  I'm not sure the reason for the difference, unless the other method gets the description before the book is fully made.
               
               

               
            

Legacy_Thayan

  • Sr. Member
  • ****
  • Posts: 435
  • Karma: +0/-0
Examine Window pops up .... BLANK ??
« Reply #5 on: June 14, 2011, 02:34:24 pm »


               Edit: Whoops - I misunderstood what object you were destroying in my initial post.

Still, maybe try testing with the DestroyObject line commented out. Since that is the object basically executing this script, see if Alex's revised script works without the DestroyObject line there.
               
               

               


                     Modifié par Thayan, 14 juin 2011 - 01:39 .
                     
                  


            

Legacy__Knightmare_

  • Full Member
  • ***
  • Posts: 191
  • Karma: +0/-0
Examine Window pops up .... BLANK ??
« Reply #6 on: June 14, 2011, 02:36:04 pm »


               Does it show anything at all like the book icon or the book name and it is just the actual description that is blank, or it there totally nothing to be seen?
               
               

               
            

Legacy_Grieyls

  • Jr. Member
  • **
  • Posts: 58
  • Karma: +0/-0
Examine Window pops up .... BLANK ??
« Reply #7 on: June 14, 2011, 03:08:53 pm »


               Failed.Bard, I could only get your line to work by placing the delay after the assign. ie...

AssignCommand(oPC, DelayCommand(1.0, ActionExamine(oBook)));

However, the same problem persists, the examine window is blank. 'Image

Now when I say blank what I mean is that the window appears, complete with pretty border and what not. However all the text is missing. Including item name, description and so on, the book icon is also missing.

Anyway, script in it's current rendition is as follows...

void main()
{
    object oPC = GetLastUsedBy();
    object oBook = CreateItemOnObject("le_item046", oPC);
    DestroyObject(OBJECT_SELF, 0.0);
    FloatingTextStringOnCreature("You blow the dust off the cover as you pick up the journal.", oPC, TRUE);
    AssignCommand(oPC, DelayCommand(1.0, ActionExamine(oBook)));
}


By the by, thank you all for your suggestions so far 'Image
               
               

               


                     Modifié par Grieyls, 14 juin 2011 - 02:10 .
                     
                  


            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Examine Window pops up .... BLANK ??
« Reply #8 on: June 14, 2011, 03:51:36 pm »


               

Failed.Bard wrote...

Use this instead of the wait then examine:

DelayCommand (2.0, AssignCommand(oPC, ActionExamine(oBook)));

I just tested both ways, and the other method only shows item properties for me, while this means showed the description as well. I'm not sure the reason for the difference, unless the other method gets the description before the book is fully made.


The Delay command will not work in this case.  The Placeable that the delayed command is running on is getting destroyed.  It simply will not be around to assign the command.   

I think.   


I think It would work if you cleared all the actions of the PC then feed it to his action Que with ActionDoCommand.

That way he could Open the book himself instead of having something else trying to force him to open it.
               
               

               
            

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0
Examine Window pops up .... BLANK ??
« Reply #9 on: June 14, 2011, 03:58:03 pm »


               Ah, yup, my mistake on the delay there.  When I tested it, I wasn't destroying the placeable, so I hadn't considered that it wouldn't be there to call the script off of.
               
               

               
            

Legacy_Greyfort

  • Sr. Member
  • ****
  • Posts: 442
  • Karma: +0/-0
Examine Window pops up .... BLANK ??
« Reply #10 on: June 14, 2011, 09:25:14 pm »


               Lightfoot is right, when trying to emulate IE: PC picking up book.  Its best to have the PC Run the code:
EXAMPLE:
so on placeable on use: vis effect code,floaty text,give pc item, then have pc=getlastusedby(); execute script.

in the player script you can decide delay and assign command often insures PC preforms script.
try that it should work.  The only issue quickly that comes to mind is wether the placeable will be destroyed in a timely manner.  If you have any issues let us know I'll pop something out.
               
               

               
            

Legacy_Greyfort

  • Sr. Member
  • ****
  • Posts: 442
  • Karma: +0/-0
Examine Window pops up .... BLANK ??
« Reply #11 on: June 14, 2011, 09:49:35 pm »


               OK solved the issue:

#1 must have description in both the un ided and ided and your garonteed words and book info other wise possible blank.

then place this script on placeable:

// plcbl_onuse
void main()
{
   object oPC = GetLastUsedBy();

   //Define book
   object oBook = CreateItemOnObject("le_item046", oPC);
   SetLocalObject(oPC,"le_item046",oBook);

   // destroy placeable
   DestroyObject(OBJECT_SELF, 0.0);
   FloatingTextStringOnCreature("You blow the dust off the cover as you pick up the journal.", oPC, TRUE);

   //replace with belowe this make pc read book
   //AssignCommand(oPC, DelayCommand(1.0, ActionExamine(oBook)));
   AssignCommand(oPC,ClearAllActions(TRUE));
   AssignCommand(oPC,ExecuteScript("pcread_bk",oPC));
}

use this script for player action:

// pcread_bk
void main()
{
object oPC=OBJECT_SELF;
object oBook=GetLocalObject(oPC,"le_item046");//GetObjectByTag("le_item046");//
//AssignCommand(oPC, DelayCommand(1.0, ActionExamine(oBook)));

AssignCommand(oPC,DelayCommand(1.0,ActionExamine(oBook)));
}

I was able to repeat your errors of blank and now made it work.  Remove any // comented out code I often try everything I can think of to see what might and might not work.
               
               

               


                     Modifié par Greyfort, 14 juin 2011 - 08:53 .
                     
                  


            

Legacy_Grieyls

  • Jr. Member
  • **
  • Posts: 58
  • Karma: +0/-0
Examine Window pops up .... BLANK ??
« Reply #12 on: June 15, 2011, 05:03:01 am »


               Thanks Greyfort, I'm at colledge at the moment so I'll have to try that out when I get home. I'll let you know how I go, one question though. The Player Action... My memory is kinda fuzzy, that's a handle on the placeable correct?

EDIT:-

Ok I've tried it but no go, didn't work. Most likely cause I did not undertand what you said first, in particular this...

#1 must have description in both the un ided and ided and your garonteed words and book info other wise possible blank.


I'm guesing english is not your first language, anyway what I got from that was I needed to have the description in both unidentified and the identified description text boxes on the book that the oPC gets ie; le_item046. As for the rest of your sentence I didn't understand it, so could you elaborate a bit. What do you mean by..?

and your garonteed words and book info


Thanks for the help though '<img'>
               
               

               


                     Modifié par Grieyls, 15 juin 2011 - 07:32 .
                     
                  


            

Legacy_Greyfort

  • Sr. Member
  • ****
  • Posts: 442
  • Karma: +0/-0
Examine Window pops up .... BLANK ??
« Reply #13 on: June 15, 2011, 10:27:24 pm »


               ok the garonteed is like a southern acent hurmor realy but bad spelling,  

you have two scripts above.  first one is put on the placeable on use.  the second is executed by PC

for guaranteed result place book description on both places of book unidentified and identified just in case.  I had it work every time with that.  When I tried to have book ided or not ided I started to get blank like you spoke of. also if useing F9 for teseting be sure to remove all old books from your char.  If you still have issues I could always email you the mod I made that works.  Just give me a IM

Note: The destory object is not fired until the end of the script, so it runs placeable script, then has pc execute script, then destroys placeable. but it appears to happen all at once.
               
               

               


                     Modifié par Greyfort, 15 juin 2011 - 09:30 .
                     
                  


            

Legacy_Greyfort

  • Sr. Member
  • ****
  • Posts: 442
  • Karma: +0/-0
Examine Window pops up .... BLANK ??
« Reply #14 on: June 16, 2011, 12:05:10 am »


               // plcbl_onuse
/*
    So far i have noted that, if inventory open to invy panel that the
    book is in, examine of book is correct.

    I also noticed you can Read description of placeable, so we may be able to
    change description based on book with SetDescription() / GetDescription()
    functions.  All though this brings up the string length issue.  It Worked..
*/
void main()
{
    object oTome_plc =OBJECT_SELF;

    object oPC = GetLastUsedBy();

    //reset var
    SetLocalObject(oPC,"le_item046",oPC);

    //Define book
    object oBook = CreateItemOnObject("le_item046", oPC);
    SetLocalString(oPC,"Book",GetTag(oBook));
    SetLocalObject(oPC,"le_item046",oBook);

// possible discreption fix...
//string sBook_Dis=GetDescription(oBook,TRUE,TRUE);
string sBook_Dis = GetDescription(oBook,TRUE,FALSE);
SetDescription(oTome_plc,sBook_Dis);

    // give text
    FloatingTextStringOnCreature("You blow the dust off the cover as you pick up the journal.", oPC, TRUE);

    //  Examine place ....
    AssignCommand(oPC,ClearAllActions(TRUE));
    AssignCommand(oPC,ActionExamine(oTome_plc));

    // with this, makes pc read book  via ExecuteScript still resulted in blank window
    //AssignCommand(oPC,ClearAllActions(TRUE));
    //DelayCommand(1.0,AssignCommand(oPC,ExecuteScript("pcread_bk",oPC)));

    // destroy placeable
    DelayCommand(1.0,DestroyObject(OBJECT_SELF, 0.0));


}
Ok here is result of work.  Just one script.  I commented the issues that i had found.  A little strange the blank happens always if no invy open, or if invy open to tab other then the one the book is in.  if inv opened and tab the one book is put in when created the examin is correct.  I hadn't noticed this when I tested the early script.

This new script uses get/set discription it gets discript from book and sets it on the placeable, then you get your floaty text, and you examine getting book discription...no blank window

This is a work around, I will keep looking into why this happens.  As I said in above comments of script I am able to examine book and get book discript if inventory open and on tab book is in Strange I never noticed it, probly because I was droping old books making sure it only examined new book
               
               

               


                     Modifié par Greyfort, 15 juin 2011 - 11:09 .