petar113507
Full Member
Damn Straight. I Am the king of waffelagia.
Posts: 166
|
Post by petar113507 on Nov 8, 2005 14:35:59 GMT -5
When you set up the output in TargetInfo.lua and In PlayerStats.lua How did you know what to put in it, before the headings, the % marks.
(I know the \n or something means new line for the code, right? dont know what the \r means though)
Code:Output=string.format("TargetName: [glow=red,2,300]%s[/glow] HP Percent: [glow=red,2,300]%i\r\n[/glow]Position: [glow=red,2,300]%f,%f,%f [/glow]Heading: [glow=red,2,300]%f[/glow]\r\nBearing: %f\r\nBearingToPlayer: [glow=red,2,300]%f[/glow] Distance: [glow=red,2,300]%f[/glow]",Name,HPP,X,Y,Z,Heading,Bearing,BearingP,Distance)
|
|
|
Post by TinyTerror on Nov 8, 2005 15:01:31 GMT -5
Ok, I'll explain how string.format works. It's a really powerfull function that mimics the printf commands from c++. There are two parts to a string.format command. The format string, and the arguments list. The format string looks like this: "TargetName: %s HP Percent: %i\r\n Position: %f,%f,%f Heading: %f \r\nBearing: %f\r\nBearingToPlayer: %f Distance: %f " Here we see the text of the string that is going to get returned by string.format. We also have any number of %x markers and \r\n markers. The %x markers are telling lua where to insert variables. %i, %f, %d and %u are used to tell lua to represent the variables as numbers. %s, %q, and %c are used to tell lua to show the vairables as strings or a character. The \r\n markers are C style escape characters telling the string to make a new line. The second part of the string.format command is the variables list. The variables should be in the same order as thier % markers show up in the format string. Here is an example: MyString="test" MyNumber=1203 MyOutput=string.format("This is a string: %s. \r\n This is a number: %i. \r\n",MyString,MyNumber)
When written to the console or a text object, MyOutput will look like this: This is a string: test. This is a number: 1203.
You can use string.format to make a string out of any number of variables and text. Just keep in mind that every % marker in the text string has to have a variable to match up with it. The lua string library tutorial page is: lua-users.org/wiki/StringLibraryTutorialIt has a bit more info on string.format.
|
|
petar113507
Full Member
Damn Straight. I Am the king of waffelagia.
Posts: 166
|
Post by petar113507 on Nov 8, 2005 20:48:09 GMT -5
Whoo! thanks a thousand tiny!!
|
|
petar113507
Full Member
Damn Straight. I Am the king of waffelagia.
Posts: 166
|
Post by petar113507 on Nov 10, 2005 15:03:25 GMT -5
Ok some of this stuff made little to no sense to me. I looked at the tutorial, and I didnt get it which things matched up with which.
I understand [glow=red,2,300]\n[/glow] means NewLine.
I think \r Has a similar function, right?
Ok well, do the [glow=red,2,300]%f [/glow], [glow=red,2,300]%s[/glow] , or [glow=red,2,300]%i [/glow]have anything to deal with, which Line they are on?
Or wait, maybe do they match up like:
%i means you add \r\n %f means you add \n %s means you add \r
anything like that?
Before I think to make another post, Is there any way you can compare the auto-translate to anything? Or have a partial comparison?
Cause I think that would be pretty kickass if I could compare auto translate tells/shouts for PT invites. Any way to make it be a partial match up? Like the Wildcards, but in the sentence,
In the line: IF (TellLine) = {party} * AND {Do You Need it?} *
So then if both of those things are there, then a buzzer will go off. Cause you could just use the Lunar script RUN sort of function, to trigger a sound file on your computer somewhere....
|
|
petar113507
Full Member
Damn Straight. I Am the king of waffelagia.
Posts: 166
|
Post by petar113507 on Nov 12, 2005 0:25:32 GMT -5
One last question in regards to this topic:
Is there way to make a wildcard in your script? Like, one case is met, but the other part of that case is disregarded?
Case1=CasePT1&Case1PT2 CasePT1 = Met CasePT1 = * (Or something, this is the only way I have seen a wildcard before. Is there a way to do this in the lunar platform?)
|
|
|
Post by TinyTerror on Nov 12, 2005 1:00:50 GMT -5
One last question in regards to this topic: Is there way to make a wildcard in your script? Like, one case is met, but the other part of that case is disregarded? Case1=CasePT1&Case1PT2 CasePT1 = Met CasePT1 = * (Or something, this is the only way I have seen a wildcard before. Is there a way to do this in the lunar platform?) else statements.
|
|