Author Topic: Triggered Player Speech  (Read 319 times)

Legacy_grostilzirelman

  • Newbie
  • *
  • Posts: 42
  • Karma: +0/-0
Triggered Player Speech
« on: November 24, 2012, 05:35:38 pm »


               It's pretty basic honestly. I store a string called sPopUp on my trigger, and the onEnter scrpt should make the PC say the string. My PC speaks, but nothing is in the text box. Completely blank. Anyone know why?
  • void main()
  • {
  •     object oPC = GetEnteringObject();
  •     string sPopUp;
  •     string sSpeak = GetLocalString(OBJECT_SELF, sPopUp);
  •     if ( GetLocalInt(GetModule(), "DO_ONCE__" + GetTag(OBJECT_SELF)) )
  •         return;
  •     SetLocalInt(GetModule(), "DO_ONCE__" + GetTag(OBJECT_SELF), TRUE);
  •     AssignCommand(oPC,SpeakString(sSpeak));
  • }

               
               

               


                     Modifié par grostilzirelman, 24 novembre 2012 - 05:36 .
                     
                  


            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Triggered Player Speech
« Reply #1 on: November 24, 2012, 07:14:06 pm »


               string sPopUp; creates a string with the lable sPopUp since you never give it a value it is equal to "" or a null string.

When you create
string sSpeak = GetLocalString(OBJECT_SELF, sPopUp);
you are saying
string sSpeak = GetLocalString(OBJECT_SELF, "");
since that is what sPopUp is equal to. It will return a null string that sSpeak end up being equal to.

Since you do not really need the sPopUp as a string var just get rid of that line and add quotes around the sPopUp Argg.

string sSpeak = GetLocalString(OBJECT_SELF, "sPopUp");
               
               

               


                     Modifié par Lightfoot8, 24 novembre 2012 - 07:14 .
                     
                  


            

Legacy_grostilzirelman

  • Newbie
  • *
  • Posts: 42
  • Karma: +0/-0
Triggered Player Speech
« Reply #2 on: November 24, 2012, 08:37:50 pm »


               My thanks!