turbocookie Posted January 17, 2011 Author Share Posted January 17, 2011 Hey i know there is a way to display a level under or above the players name but can i do this:Turbocookie [lvlhere]E.G Turbocookie [68]Im no programmer, but this is my attempt so show iv put effort in.do i find this>! If GetPlayerSprite(Index) < 1 Or GetPlayerSprite(Index) > NumCharacters Then TextX = ConvertMapX(GetPlayerX(Index) * PIC_X) + Player(Index).XOffset + (PIC_X \ 2) - getWidth(TexthDC, (Trim$(GetPlayerName(Index)))) TextY = ConvertMapY(GetPlayerY(Index) * PIC_Y) + Player(Index).YOffset - 16 Else ' Determine location for text TextX = ConvertMapX(GetPlayerX(Index) * PIC_X) + Player(Index).XOffset + (PIC_X \ 2) - getWidth(TexthDC, (Trim$(GetPlayerName(Index)))) TextY = ConvertMapY(GetPlayerY(Index) * PIC_Y) + Player(Index).YOffset - (DDSD_Character(GetPlayerSprite(Index)).lHeight) + 16 End If>! ' Draw name Call DrawText(TexthDC, TextX, TextY, GetPlayerName(Index), color)End Sub and in the line``` ' Draw name Call DrawText(TexthDC, TextX, TextY, GetPlayerName(Index), color)```do i just make it like``` ' Draw name Call DrawText(TexthDC, TextX, TextY, GetPlayerName(Index) & "["GetPlayerLevel(index)"]", color)```As i said, i dont really know what im doing, point me in the right direction? thanks. Link to comment Share on other sites More sharing options...
Robin Posted January 17, 2011 Share Posted January 17, 2011 Learn basic string concatenation. It's shown quite clearly how to do this in all examples of string handlers in the source.```firstString = dataString & "[String here]" & anotherString & "[" & yetMoreString & "]"``` Link to comment Share on other sites More sharing options...
turbocookie Posted January 17, 2011 Author Share Posted January 17, 2011 @Robin:> Learn basic string concatenation. It's shown quite clearly how to do this in all examples of string handlers in the source.> > ```> firstString = dataString & "[String here]" & anotherString & "[" & yetMoreString & "]"> > ```Um, you have lose me at "concatenation" as i said, i am very basic.Can you please leave a demonstation?Reading what you said, this is the best i can do, tell me if its right.```Call DrawText(TexthDC, TextX, TextY, GetPlayerName(Index) & "[" & GetPlayerLevel(index) & "]" , colour)```Sorry for being really bad ): even the term strings kind of confuse me, i have a rough idea what they are, just cant explain it. thanks for reply so fast btw. Link to comment Share on other sites More sharing options...
Ruins of Hell Posted January 17, 2011 Share Posted January 17, 2011 Strings are basically a bunch of characters, example:```Dim A as String ' A is now a string.Dim B as String ' B is now a string.Dim C as String ' C is now a string. A = "Bleh" ' Set A to Bleh.B = "Blah" ' Set B to BlahC = A & " " & B ' C is now "Bleh Blah"```The ampersand (&) is a signal to "add" the string together, or concatenate it.Edit: small spelling fix. Link to comment Share on other sites More sharing options...
Robin Posted January 17, 2011 Share Posted January 17, 2011 @Turbocookie:> Sorry for being really bad ): even the term strings kind of confuse me, I have a rough idea what they are, just cant explain it. thanks for reply so fast btw.When you don't understand a term you should Google it. I don't magically know what people are talking about. When I hear something I don't understand, I'm straight on the Google.Teaching yourself to do your own research is a large part of being a programmer.As for the code you posted it looks fine. Why don't you give it a try rather than just asking me if it'll work? Link to comment Share on other sites More sharing options...
turbocookie Posted January 17, 2011 Author Share Posted January 17, 2011 @Robin:> As for the code you posted it looks fine. Why don't you give it a try rather than just asking me if it'll work?I tried it and got this error.```tilesetInUse(Map.Tile(X, y).Layer(I).tileset) = True```Im not sure if its related to that tough D:EDIT: ok i worked out its not to do with that, but could you tell me what it is while we are here? i think i may have changed something accidently ): Link to comment Share on other sites More sharing options...
Robin Posted January 17, 2011 Share Posted January 17, 2011 That really has nothing to do with the name rendering.What else have you fucked around with? Link to comment Share on other sites More sharing options...
turbocookie Posted January 17, 2011 Author Share Posted January 17, 2011 to tell you the truth, im not exactly sure xD i think its time for a restart… a fresh :) ill edit with the results shortly Link to comment Share on other sites More sharing options...
Robin Posted January 17, 2011 Share Posted January 17, 2011 Yeah, that's the best course of action and one you'll be taking a _lot_.I went through dozens of copies of the source before I did anything proper with it. You just need to learn the structure. Link to comment Share on other sites More sharing options...
turbocookie Posted January 17, 2011 Author Share Posted January 17, 2011 Compile Error. Variable not defined.That is the error that that code gave me. Link to comment Share on other sites More sharing options...
Robin Posted January 17, 2011 Share Posted January 17, 2011 I don't care. Go re-download the source. Link to comment Share on other sites More sharing options...
turbocookie Posted January 17, 2011 Author Share Posted January 17, 2011 @Robin:> I don't care. Go re-download the source.No no, I got it working, that error is from that code I tried.```Call DrawText(TexthDC, TextX, TextY, GetPlayerName(Index) & "[" & GetPlayerLevel(index) & "]", colour)```EDIT: I think I know why, "[" and "]" arnt variables, I just down know how to display text because I want the level inside of [ and ]Is there a variable to be like DrawText("TEXTHERE")Thats just my random guess but yeah, i have no idea ): Link to comment Share on other sites More sharing options...
turbocookie Posted January 17, 2011 Author Share Posted January 17, 2011 Bump ^.^ i know it must be an easy fix.. Link to comment Share on other sites More sharing options...
Ruins of Hell Posted January 17, 2011 Share Posted January 17, 2011 Your naming scheme is ambiguous. I'm not sure if the original source says color or if the original source says colour. I've used color in this example as per what you originally posted:```Call DrawText(TexthDC, TextX, TextY, GetPlayerName(Index) & "[" & GetPlayerLevel(Index) & "]", color)```This would be how you do it. Remove your original one and replace it with this. Link to comment Share on other sites More sharing options...
turbocookie Posted January 17, 2011 Author Share Posted January 17, 2011 @Soul:> Your naming scheme is ambiguous. I'm not sure if the original source says color or if the original source says colour. I've used color in this example as per what you originally posted:> > ```> Call DrawText(TexthDC, TextX, TextY, GetPlayerName(Index) & "[" & GetPlayerLevel(Index) & "]", color)> > ```> This would be how you do it. Remove your original one and replace it with this.ah thankyou very much :) and yeah its just colour, it works C: i was kinda close for my first programming edit? :D thanks for fixing that up for me mate, close thread if you wish Link to comment Share on other sites More sharing options...
EclipseCommunity Posted January 22, 2011 Share Posted January 22, 2011 Robin is from England, where they speak English, not American. If he's anything like me he would have gone round the source replacing all false English spelling with correct English grammar. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now