Scripting a function (SOLVED)

Started by Vel, Thu 04/11/2004 17:27:33

Previous topic - Next topic

Vel

Hey there.
So, I've got this script in the global one:

function DisplaySubtitle(CHARID, string buffer){
   DisplaySpeechAt(160, 235, 320, CHARID, "%s", buffer);
   }

And it gives me an error on the string... I tried some other possibilities but failed to make it work :/ So, any help would be greatly appreciated.

Rui 'Trovatore' Pires

Why not just DisplaySpeechAt(160, 235, 320, CHARID, buffer); ? I don't think that function supports %s, BTW.
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

Vel

Tried that also - buffer not defined.

Dave Gilbert

Hm, don't know much about this, but are you sure that the string is being transferred to the function correctly?  You might want to try this as a test:

Display("%s", buffer);

The problem could be the string itself.

-Dave

Dorcan

CHARID is a reserved variable I think.

this one works :

function DisplaySubtitle(int charID, string buffer){
   DisplaySpeechAt(160, 235, 320, charID, buffer);
}

stuh505

You never specified the data type for one of the input paramaters of the function

Vel

Oh I got it Dorcan, thanks a lot!

Pumaman

Yes, CHARID is a bit of a confusing one. It is actually a present used internally which defines to "int charid" -- therefore you can use it in the function parmaeter list, but not as a variable in the actual code.

Basically, avoid using it at all.

SMF spam blocked by CleanTalk