need help with string buffer

Started by Chicky, Sat 14/08/2004 14:15:01

Previous topic - Next topic

Chicky

hello there

having a little problem scripting GuardDuty. Im not too experienced with strings and buffers and whatnot.

this is in my GUI script:

else if (button == 0)    // Eat item?
   
    string buffer;
      GetInvName(game.inv_activated,buffer);     
      DisplaySpeech(EGO, "Are you sure you want to eat %s ?",buffer);

i get "error: unexpected string"

a little help please?


*edit*

ok, so I'm still confused. Changed the script a little

    else if (button == 0)    // Eat item?
   
      GetInvName (int item, string buffer);
      GetInvName(game.inv_activated ,item);     
      DisplaySpeech(EGO, "Are you sure you want to eat %s ?" ,item);

: Parse error in expr near "string"

I'm not all that sure what I'm doing. Just trying different things until it works :/

strazer

string buffer; // declare variable buffer
GetInvName(game.inv_activated, buffer); // copy item description to variable buffer
DisplaySpeech(EGO, "Are you sure you want to eat %s ?", buffer); // display buffer

Chicky

#2
Thanks for the reply strazer, but...
 

else if (button == 0)    // eat item?
      string buffer; // declare variable buffer
    GetInvName(game.inv_activated, buffer); // copy item description to variable buffer
    DisplaySpeech(EGO, "Are you sure you want to eat %s ?", buffer); // display buffer
    GUIOn (EAT);



it still isnt working :/  (unexpected string) Thats the new script.


and here is the eat gui script (not finished, but should work). Its right down the bottom of my gui script.

   if (interface == EAT) {
           
      SetDefaultCursor();
     
    if (button == 0) {
      // They pressed the YES button, eat current item
      GUIOff (EAT);
     
    if (button == 1) {
      // They pressed the NO button, close the GUI
      GUIOff (EAT);
   }


i dont think that would make much difference.

strazer

Check your braces:

  else if (button == 0) { // eat item?
    string buffer; // declare variable buffer
    GetInvName(game.inv_activated, buffer); // copy item description to variable buffer
    DisplaySpeech(EGO, "Are you sure you want to eat %s ?", buffer); // display buffer
    GUIOn(EAT);
  }

and

  if (interface == EAT) {
    SetDefaultCursor();
    if (button == 0) { // They pressed the YES button, eat current item
      // eat action here
      GUIOff (EAT);
    }     
    if (button == 1) { // They pressed the NO button, close the GUI
      GUIOff (EAT);
    }
  }

Chicky


SMF spam blocked by CleanTalk