zade_o Posted November 26, 2008 Author Share Posted November 26, 2008 Ok sooo This is what I'm trying to do. Instead of using the level up from killing stuff and using points on your stats, you get xp based on your damage and depending on how you're fighting (like RS) so I need a way for the player to see how much xp he has and how much the next level in that stat is. I have an ini file with all the levels and their xp values. What I want is for the player to click the icon for that skill and then the EXP bar that's under the HP bar will change to show that skills experience data. But I don't know how to change the label in the VB project to display information from an ini file Link to comment Share on other sites More sharing options...
Warconn Posted November 27, 2008 Share Posted November 27, 2008 hmm i am at temping the same thing, do you have msn, we could get together, and work on it if noone finds an anwser here? Link to comment Share on other sites More sharing options...
zade_o Posted November 27, 2008 Author Share Posted November 27, 2008 alright. i'll go download it real fast. add [email protected] Link to comment Share on other sites More sharing options...
anasky Posted November 27, 2008 Share Posted November 27, 2008 Why do you want it at a bar?Well:```XPBar.Visible = FalselblGhost.Visible = TrueCall SendData("loadlblghost" & END_CHAR)```Server Side:```Case "loadlblghost"Dim attacklvl As Integerattacklvl = ReadINI("attack", "lvl", App.Path & "\Accounts\" & PlayerName (look this up) & "\stats.ini", vbNullString)Call SendDataTo(Index, "getlblghost" & SEP_CHAR & attacklvl & END_CHAR)```These AIN'T the actual names.Also, I didn't test it, but I think it will work. Link to comment Share on other sites More sharing options...
Tyr Posted November 27, 2008 Share Posted November 27, 2008 yes, you should take an example to the original XP system…to read an ini use this little tut:**ReadINI("TITLE", "LINE", PATH)****ok now the explaining:**Title part:The TITLE is the word written between bracketsso for example in your ini stats xp table there is[STRENGHT]Exp1=50Exp2=120etc…so you need to fill in STRENGHTwhat we got so far: **ReadINI("STRENGHT", "LINE", PATH)**Line part:The line part is the name of the line in the ini file UNDER the title of course you want to read.so again same example,[STRENGHT]Exp1=50Exp2=120etc…You want to read Exp2 so you fill in Exp2\. (fill in the name of the line not the number as that should be 2)what we got so far: **ReadINI("STRENGHT", "Exp2", PATH)**Path part:here we are going to tell vb6.0 where the ini file we want to read is located on the PCfor exaple C:\Admin etc… but that aint good as when other peoples play they won't be putting the game folder in the same location as you did (FE: they use the E drive)now what you do is you add App.Path (then it sarts reading from the folder where the EXE is located :) then add & and then the location. FE when you have put it in the map FOLDER and the file is called strenghtxp.ini then add this lineApp.Path & "\FOLDER\strenghtxp.ini"when you put the file in the same folder as the exe, put thisApp.Path & "\strenghtxp.ini"what we got so far: **ReadINI("STRENGHT", "Exp2", App.Path & "\strenghtxp.ini")**End Result:**ReadINI("STRENGHT", "Exp2", App.Path & "\strenghtxp.ini")**TADAAAA you read your ini :) good job!enjoy :)anyhow to blit the label its pretty easy… i guess yo u could find it yourself, if not feel free to PM me :)- TyrPS: wow this was like a real tut oO, when i add images i could probably post it ^^ Link to comment Share on other sites More sharing options...
zade_o Posted November 27, 2008 Author Share Posted November 27, 2008 only problem is this, (i think i didn't read through your thing fully) but warconn and i realized that using the app.path thing in the client code will put the ini in the client folder instead of the server so we realized we have to use packets…I'm not messing with that just yet =)Actually I can probably do some work around so that the new ini just gets the info from the other ini in the server but whenever you read the ini for real data you would use the one from the server, but for display purposes, read the onee from the client. Link to comment Share on other sites More sharing options...
Tyr Posted November 27, 2008 Share Posted November 27, 2008 well i explained above how to READ a ini (with the ode explained above), so as you say you read the ini in the server folder then you want to send the info to the client add:senddatato(Index, "strenghtxp" & SEP_CHAR & the info you want to send & END_CHAR)take for teh example under here that the info is the amount of strenghtxp the player hasi'm not gonna explain this like above i guess its easy enough to understand oOthen you add a packet in the client, modHandleData at the bottom a new packet (but before End Sub of course!)FE: ' ::::::::::::::::::::::::::::::::::::: ' :: Recieving Strenght exp :: ' :::::::::::::::::::::::::::::::::::::If casestring = "strenghtxp" Then SetSrenght(Index) = val(Parse(1)) NOTE: THIS FUNCTION DOES NOT EXISTS, YOU HAVE TO CREATE IT …. ... .. .end ifat the points you just type the code that happens when the data is recieved.the val(Parse(1)) is the value of the information you sended.if its a word f.e the don't type val but just parse(1)well well, this is what u needed right? Link to comment Share on other sites More sharing options...
zade_o Posted November 27, 2008 Author Share Posted November 27, 2008 yeah seems like it. not a 100% breakdown of what to do but that's the way i want it so I can work with it and figure out how to use it with other things too. Thanks for your time man. I'll definitely get back to working on that. Link to comment Share on other sites More sharing options...
Tyr Posted November 27, 2008 Share Posted November 27, 2008 heh, then i succeded as its not meant to just copy paste…i found all these thing myself, just trial and errori'm glad i could help you, if there are any questions, u know where to be ^^ Link to comment Share on other sites More sharing options...
Warconn Posted November 28, 2008 Share Posted November 28, 2008 hey i am trying to learn this packet stuff as well, and i am having a hard time lol.Server side, in ModHandleData i have```Sub SendSkill(ByVal Index As Long)Dim FileDataFileData = ReadINI("Woodcutting", "level", App.Path & "\Scripts\charextras\" & GetPlayerName(Index) & ".ini")Call SendDataTo(Index, "skills" & SEP_CHAR & FileData & END_CHAR)End Sub```when i compile it, i get an error on the READINI, it says "Argument Not Optional"Client Side i have in the modhandle data``` If (casestring = "skills") Then FileData = parse(1) frmMirage.lblskilllvl.Caption = FileData Exit Sub End If```i dont get any error with this.Sorry, i am really stuck with this one though lolThanks Link to comment Share on other sites More sharing options...
anasky Posted November 28, 2008 Share Posted November 28, 2008 First of all, don't use SendSkill but loadskill (no caps).Also, you'll need a Case in the Server.Client presses a button:```Call SendData("loadskill" & END_CHAR)```Server-Side (modHandleData, first sub):```Case "loadskill"test = ReadINI(see explanation above)Call SendDataTo(Index, "getskill" & SEP_CHAR & test & END_CHAR)Exit Sub```Client-sided, modHandleData:```If parse(0) = "getskill" ThenfrmTest.ShowfrmTest.lbl1.Caption = Parse$(1) or Val#(parse(1))End If```Hope it helped, if not, PM me :P Link to comment Share on other sites More sharing options...
Tyr Posted November 28, 2008 Share Posted November 28, 2008 @Warconn:> hey i am trying to learn this packet stuff as well, and i am having a hard time lol.> > Server side, in ModHandleData i have> ```> Sub SendSkill(ByVal Index As Long)> Dim FileData> > FileData = ReadINI("Woodcutting", "level", App.Path & "\Scripts\charextras\" & GetPlayerName(Index) & ".ini")> > Call SendDataTo(Index, "skills" & SEP_CHAR & FileData & END_CHAR)> End Sub> > ```> when i compile it, i get an error on the READINI, it says "Argument Not Optional"> > Client Side i have in the modhandle data> > ```> If (casestring = "skills") Then> FileData = parse(1)> > frmMirage.lblskilllvl.Caption = FileData> Exit Sub> End If> > ```> i dont get any error with this.> > Sorry, i am really stuck with this one though lol> Thanksas yo usay the problem lies in reading the ini, the path doesn't really look wrong to me but ya you should prty to put it in a variableSub SendSkill(ByVal Index As Long)Dim FileDataDim PathPath = "App.Path & "\Scripts\charextras\" & GetPlayerName(Index) & ".ini""FileData = ReadINI("Woodcutting", "level", Path)don't know if it should work… but its worth a try Link to comment Share on other sites More sharing options...
Warconn Posted November 29, 2008 Share Posted November 29, 2008 @anasky:> First of all, don't use SendSkill but loadskill (no caps).> Also, you'll need a Case in the Server.> Client presses a button:> ```> Call SendData("loadskill" & END_CHAR)> > ```> Server-Side (modHandleData, first sub):> ```> Case "loadskill"> test = ReadINI(see explanation above)> Call SendDataTo(Index, "getskill" & SEP_CHAR & test & END_CHAR)> Exit Sub> > ```> Client-sided, modHandleData:> ```> If parse(0) = "getskill" Then> frmTest.Show> frmTest.lbl1.Caption = Parse$(1) or Val#(parse(1))> End If> > ```> Hope it helped, if not, PM me :Pthanks, i PMed you@Tyr:> as yo usay the problem lies in reading the ini, the path doesn't really look wrong to me but ya you should prty to put it in a variable> > Sub SendSkill(ByVal Index As Long)> Dim FileData> Dim Path> > Path = "App.Path & "\Scripts\charextras\" & GetPlayerName(Index) & ".ini""> FileData = ReadINI("Woodcutting", "level", Path)> > don't know if it should work… but its worth a tryyea i tryed that, and i am still getting the same thing… i changed it to``` path = App.Path & "\Scripts\charextras\" & GetPlayerName(index) & ".ini" FileData = ReadINI("Woodcutting", "level", path, "0")```and atleast my compiler let me through, so i dont know Link to comment Share on other sites More sharing options...
Warconn Posted November 29, 2008 Share Posted November 29, 2008 ahh it worked, i finally got it to work, thanks guys[EDIT]oo sorry for the double post, i was just real excited, ive been working on packets for a month now, with no success till now, thanks again Link to comment Share on other sites More sharing options...
anasky Posted November 29, 2008 Share Posted November 29, 2008 Could you tell us what was wrong? For other players. Link to comment Share on other sites More sharing options...
Tyr Posted November 29, 2008 Share Posted November 29, 2008 heh packets is quite easy :D normally ppl figuere it out in about 30min :s Link to comment Share on other sites More sharing options...
anasky Posted November 29, 2008 Share Posted November 29, 2008 or 10 like me xD Link to comment Share on other sites More sharing options...
DrNova Posted November 29, 2008 Share Posted November 29, 2008 oo, just found this, niiice.I needed this, thanks Link to comment Share on other sites More sharing options...
Warconn Posted November 29, 2008 Share Posted November 29, 2008 @anasky:> Could you tell us what was wrong? For other players.yea, i found that you need to val the readini for it to work serverside, here is mineCase "loadskill"Dim FiledataFiledata = Val(ReadINI("Woodcutting", "level", App.Path & "\Scripts\charextras\" & GetPlayerName(index) & ".ini", "0"))Call SendDataTo(index, "getskill" & SEP_CHAR & Filedata & END_CHAR)Exit Subdunno what this does, but it works lolthat does into the server modhandledata underneath all of the other cases at the beginning.client side is in the modhandledata If (casestring = "getskill") Then Dim skill skill = parse(1) frmMirage.lblskilllvl.Caption = Val(skill) End Ifi figured out that because you val'ed the REadini you have to val the parse, thats the easiest way i found to do it.and the button you use to get all of this to work is Call SendData("loadskill" & END_CHAR)pretty simple once you get the hang of it.@Tyr:> heh packets is quite easy :D normally ppl figuere it out in about 30min :slol took me about a month to get it all to work lol, now i got to concentrate on how to send data from the client to the server, should be easy now that i got the basic ideaThanks Again guys Link to comment Share on other sites More sharing options...
anasky Posted November 30, 2008 Share Posted November 30, 2008 First of all, it should work aswell with:skill = Val#(Parse(1))frmMirage.lblskilllvl.Caption = skillSecond:Client to server is the Call SendData xD Link to comment Share on other sites More sharing options...
Warconn Posted November 30, 2008 Share Posted November 30, 2008 hmm alright, thanks Link to comment Share on other sites More sharing options...
zade_o Posted December 1, 2008 Author Share Posted December 1, 2008 Alright well the help was good and all but this is confusing the Duck out of me.Ok. This is what I'm trying to get working at the moment. I have 2 labels, lblA and lblB.I have a ini file for my character saved in the SERVER that looks like this"[Style]s = 0"Now. If I click lblB i want it to change to s = 1 and back to s = 0 if I click lblA.Soooo…. in the server, sub handleData I have this``` Case "loadstyle" Dim FileData FileData = Val(ReadINI("Style", "s", App.Path & "\Scripts\db\" & GetPlayerName(Index) & ".ini", "0")) Exit Sub```and in the client, I have this``` If casestring = "getstyle" Then Dim style style = parse(1) If (style = 0) Then frmMirage.Image4.Picture = LoadPicture(App.Path & "\GUI\CUSTOM\strstyle.gif") Else frmMirage.Image4.Picture = LoadPicture(App.Path & "\GUI\CUSTOM\defstyle.gif") End If End If```So a) is that right so far? and b) What do I need to do in the sub for clicking the 2 labels? Link to comment Share on other sites More sharing options...
anasky Posted December 1, 2008 Share Posted December 1, 2008 Case "loadstyle"Dim FileDataFileData = ReadINI("Style", "s", (App.Path & "\Scripts\db\" & GetPlayerName(Index) & "\.ini"), vbNullString)Exit SubWhat was wrong: I won't use Val(ReadINI), I'm not sure how it works, and if it even works properly."0" doesn't works as good as vbNullString (well, it doesn't in my code). If casestring = "getstyle" Then Dim style style = Val#(parse(1)) If style = 0 Then frmMirage.Image4.Picture = LoadPicture(App.Path & "\GUI\CUSTOM\strstyle.**bmp**") Else frmMirage.Image4.Picture = LoadPicture(App.Path & "\GUI\CUSTOM\defstyle.**bmp**") End If End IfSub for 2 lbl's:Sub lblA_Click()Call SendDataTo("loadstrdeflbl" & SEP_CHAR & 1 & END_CHAR)End SubSub lblB_Click()Call SendDataTo("loadstrdeflbl" & SEP_CHAR & 0 & END_CHAR)End SubModHandleData.mod:Case "loadstrdeflbl"Call WriteINI("Style", "s", Val#(Parse(1)), (App.Path & "\Scripts\db\" & GetPlayerName(Index) & "\.ini))Exit Sub Link to comment Share on other sites More sharing options...
zade_o Posted December 1, 2008 Author Share Posted December 1, 2008 Amazing. works perfect. I feel like I know all the secrets to the world now. Now my source will be the best! (jk…(but not really)) Link to comment Share on other sites More sharing options...
Warconn Posted December 2, 2008 Share Posted December 2, 2008 @anasky:> Case "loadstyle"> Dim FileData> FileData = ReadINI("Style", "s", (App.Path & "\Scripts\db\" & GetPlayerName(Index) & "\.ini"), vbNullString)> Exit Sub> > What was wrong: I won't use Val(ReadINI), I'm not sure how it works, and if it even works properly.> "0" doesn't works as good as vbNullString (well, it doesn't in my code).> > If casestring = "getstyle" Then> Dim style> style = Val#(parse(1))> If style = 0 Then> frmMirage.Image4.Picture = LoadPicture(App.Path & "\GUI\CUSTOM\strstyle.**bmp**")> Else> frmMirage.Image4.Picture = LoadPicture(App.Path & "\GUI\CUSTOM\defstyle.**bmp**")> End If> End If> > Sub for 2 lbl's:> Sub lblA_Click()> Call SendDataTo("loadstrdeflbl" & SEP_CHAR & 1 & END_CHAR)> End Sub> > Sub lblB_Click()> Call SendDataTo("loadstrdeflbl" & SEP_CHAR & 0 & END_CHAR)> End Sub> > ModHandleData.mod:> Case "loadstrdeflbl"> Call WriteINI("Style", "s", Val#(Parse(1)), (App.Path & "\Scripts\db\" & GetPlayerName(Index) & "\.ini))> Exit Subvbnulstring definatly works alot better i found out, thanks 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