Dastyruck Posted December 14, 2008 Author Share Posted December 14, 2008 So, what does this code do EXACTLY, I know that it puts a variable in a ini file, but what directory does it go to? Like Server/????/???.iniCall PutVar("mailsystem\" & GetPlayerName(index) & ".ini", "Info", "Class", GetPlayerClassName(index) & "") Link to comment Share on other sites More sharing options...
AdrianC Posted December 14, 2008 Share Posted December 14, 2008 goes in the mailsystem directory Link to comment Share on other sites More sharing options...
Dastyruck Posted December 14, 2008 Author Share Posted December 14, 2008 So, like it gos to the mailsystem folder inside my server folder? or does it go to a mailsystem.ini inside my folder? Link to comment Share on other sites More sharing options...
AdrianC Posted December 14, 2008 Share Posted December 14, 2008 you need to make it mailsystem/ to create a mailsystem folder in your server dir. Otherwise, it will create each file "mailsystem\blahblah.ini" and save it in your server folder. Link to comment Share on other sites More sharing options...
Dastyruck Posted December 14, 2008 Author Share Posted December 14, 2008 Well, it isnt really saving any files in the directory… Link to comment Share on other sites More sharing options...
Zeno Posted December 15, 2008 Share Posted December 15, 2008 Create the mailsystem folder first, then it will work.@Adrian: Having just checked I assure you that without the folder, it will not create any file. Link to comment Share on other sites More sharing options...
AdrianC Posted December 15, 2008 Share Posted December 15, 2008 Sure, whatever, always made my folder first. Never checked. Link to comment Share on other sites More sharing options...
Dastyruck Posted December 15, 2008 Author Share Posted December 15, 2008 I have a mailsystem folder… Link to comment Share on other sites More sharing options...
AdrianC Posted December 16, 2008 Share Posted December 16, 2008 I think I was wrong. Anyway.Call PutVar("mailsystem\" & GetPlayerName(index) & ".ini", "Info", "Class", GetPlayerClassName(index))Should work. Link to comment Share on other sites More sharing options...
Zeno Posted December 16, 2008 Share Posted December 16, 2008 Dastyruck, the problem does not lie in the single line of code. It works.What context is the call in? The error must lie in the code that triggers the Call.For example, this works within the commands sub:``` Case "/check" Call PutVar("mailsystem\" & GetPlayerName(index) & ".ini", "Info", "Class", GetPlayerClassName(index)) Exit Sub``` Link to comment Share on other sites More sharing options...
Dastyruck Posted December 16, 2008 Author Share Posted December 16, 2008 Hrmmm, that might be it…Here is the whole sub though..```Sub SaveCharInfo(index)On Error Resume NextDim sexCall PutVar("mailsystem\" & GetPlayerName(index) & ".ini", "Info", "Exists", "1")Call PutVar("mailsystem\" & GetPlayerName(index) & ".ini", "Info", "Class", GetPlayerClassName(index) & "")Call PutVar("mailsystem\" & GetPlayerName(index) & ".ini", "Info", "Guild", GetPlayerGuild(index) & "")If GetPlayerSex(index) = 0 Then sex = "Male"Else sex = "Female"End IfCall PutVar("mailsystem\" & GetPlayerName(index) & ".ini", "Info", "Sex", sex & "")Call PutVar("mailsystem\" & GetPlayerName(index) & ".ini", "Info", "Level", GetPlayerLevel(index) & "")Call PutVar("mailsystem\" & GetPlayerName(index) & ".ini", "Info", "Strenght", GetPlayerStr(index) & "")Call PutVar("mailsystem\" & GetPlayerName(index) & ".ini", "Info", "Defence", GetPlayerDef(index) & "")Call PutVar("mailsystem\" & GetPlayerName(index) & ".ini", "Info", "Speed", GetPlayerSpeed(index) & "")Call PutVar("mailsystem\" & GetPlayerName(index) & ".ini", "Info", "Magic", GetPlayerMagi(index) & "")End SubSub ClearMailBox(index)Dim Nn = 1Do While n < 6 Call PutVar("mailsystem\" & GetPlayerName(index) & ".ini", "mailbox", "box" & n & "", "Empty!") n = n + 1LoopCall PlayerMsg(index, "Mailbox Cleared!", 12)End Sub``` Link to comment Share on other sites More sharing options...
Zeno Posted December 16, 2008 Share Posted December 16, 2008 Tested, and that all works.What about the part of your script that triggers it, using Call SaveCharInfo(Index)? Link to comment Share on other sites More sharing options...
AdrianC Posted December 16, 2008 Share Posted December 16, 2008 Just wondering, why do you add & "" at the end of every putvar. Its useless… Link to comment Share on other sites More sharing options...
Dastyruck Posted December 16, 2008 Author Share Posted December 16, 2008 Here that sub is, quite long..```'==============================================='~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' This sub runs when something on a custom menu is clicked.Sub MenuScripts(index, Clicked_Index, Menu_Type) '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~On Error Resume NextDim field_messageDim menu_titleDim nDim boxDim recievermenu_title = getplayermenuclicktitle(index)field_message = getplayermenuclickmsg(index)' Figure out what type of button was clicked ie picture, textbox, label.Select Case Menu_TypeCase 1' PICTURE WAS CLICKED' Player has clicked a picture box whos number is clicked_index on the custom menu named menu_title'Call playermsg(index, "Clicked picture number " & clicked_index & " on the menu named " & menu_title, 14)Case 2' FIELD WAS CLICKED ' Player has clicked a text field OK button whos number is clicked_index on the custom menu named menu_title.'Call playermsg(index, "Clicked field number " & clicked_index & " on the menu named " & menu_title & ". The field text was" & field_message, 14)Select Case menu_titleCase "mailsystem"'*****************************************************************''*****************************************************************''XX This script has been created by Ilnair, aka Dinand Mentink XX''XX Please do not give it out saying you made it, or distribute XX''XX it anywhere outside the Eclipse forums! Also, please always XX''XX distribute these credits along with the script! XX''XX www.nishansu.tk ©Dinand Mentink (aka Ilnair)XX''*****************************************************************''*****************************************************************'Call CustomMenuTextBox(index, 1, 180, 65, 235, "Enter a name!")Call CustomMenuTextBox(index, 2, 180, 65, 260, "Enter a message!") Select Case clicked_index Case 1 If Int(GetVar("mailsystem\" & field_message & ".ini", "Info", "Exists") + 0) = 0 Then Call CustomMenuLabel(index, 3, "Name: " & field_message, 85, 80, 10, 0, 0, 400, 40) Call CustomMenuLabel(index, 4, "Guild: Error", 85, 90, 10, 0, 0, 400, 40) Call CustomMenuLabel(index, 5, "Class: Error", 85, 100, 10, 0, 0, 400, 40) Call CustomMenuLabel(index, 6, "Sex: Error", 85, 110, 10, 0, 0, 400, 40) Call CustomMenuLabel(index, 7, "Level: Error", 85, 130, 10, 0, 0, 400, 40) Call CustomMenuLabel(index, 8, "Strenght: Error", 85, 140, 10, 0, 0, 400, 40) Call CustomMenuLabel(index, 9, "Defence: Error", 85, 150, 10, 0, 0, 400, 40) Call CustomMenuLabel(index, 10, "Magic: Error", 85, 160, 10, 0, 0, 400, 40) Call CustomMenuLabel(index, 11, "Speed: Error", 85, 170, 10, 0, 0, 400, 40) Call PutVar("mailsystem\" & GetPlayerName(index) & ".ini", "tempvars", "sendto", "none") Exit Sub End If Call PutVar("mailsystem\" & GetPlayerName(index) & ".ini", "tempvars", "sendto", field_message & "") Name = field_message Guild = GetVar("mailsystem\" & field_message & ".ini", "Info", "Guild") & "" ClassName = GetVar("mailsystem\" & field_message & ".ini", "Info", "Class") & "" Level = GetVar("mailsystem\" & field_message & ".ini", "Info", "Level") & "" Strenght = GetVar("mailsystem\" & field_message & ".ini", "Info", "Strenght") & "" Defence = GetVar("mailsystem\" & field_message & ".ini", "Info", "Defence") & "" Speed = GetVar("mailsystem\" & field_message & ".ini", "Info", "Speed") & "" Magic = GetVar("mailsystem\" & field_message & ".ini", "Info", "Magic") & "" HP = GetVar("mailsystem\" & field_message & ".ini", "Info", "HP") & "" MP = GetVar("mailsystem\" & field_message & ".ini", "Info", "MP") & "" MAXHP = GetVar("mailsystem\" & field_message & ".ini", "Info", "MAXHP") & "" MAXMP = GetVar("mailsystem\" & field_message & ".ini", "Info", "MAXMP") & "" Sex = GetVar("mailsystem\" & field_message & ".ini", "Info", "Sex") & "" Call CustomMenuLabel(index, 3, "Name: " & Name, 85, 80, 10, 0, 0, 400, 40) Call CustomMenuLabel(index, 4, "Guild: " & Guild, 85, 90, 10, 0, 0, 400, 40) Call CustomMenuLabel(index, 5, "Class: " & ClassName, 85, 100, 10, 0, 0, 400, 40) Call CustomMenuLabel(index, 6, "Sex: " & Sex, 85, 110, 10, 0, 0, 400, 40) Call CustomMenuLabel(index, 7, "Level: " & Level, 85, 130, 10, 0, 0, 400, 40) Call CustomMenuLabel(index, 8, "Strenght: " & Strenght, 85, 140, 10, 0, 0, 400, 40) Call CustomMenuLabel(index, 9, "Defence: " & Defence, 85, 150, 10, 0, 0, 400, 40) Call CustomMenuLabel(index, 10, "Magic: " & Magic, 85, 160, 10, 0, 0, 400, 40) Call CustomMenuLabel(index, 11, "Speed: " & Speed, 85, 170, 10, 0, 0, 400, 40) Exit Sub Case 2 reciever = GetVar("mailsystem\" & GetPlayerName(index) & ".ini", "tempvars", "sendto") & "" If reciever = "none" Then Call PlayerMsg(index, "Please chose a valid person to send a message!", 12) Exit Sub End If n = 1 Do While n < 6 If GetVar("mailsystem\" & reciever & ".ini", "mailbox", "box" & n) = "Empty!" Then Call PutVar("mailsystem\" & reciever & ".ini", "mailbox", "box" & n,GetPlayerName(index) & ": " & field_message & "") n = 6 Call PlayerMsg(index, "Message sent!", 10) Exit Sub End If n = n + 1 Loop Call PlayerMsg(index, "Mailbox full!", 12) Case Else Exit Sub End Select Exit SubCase Else Exit SubEnd SelectCase 3' LABEL WAS CLICKED' Player has clicked a label button whos number is clicked_index on the custom menu named menu_title'Call playermsg(index, "Clicked label number " & clicked_index & " on the menu named " & menu_title, 14)Select Case menu_title case "mailsystem"'*****************************************************************''*****************************************************************''XX This script has been created by Ilnair, aka Dinand Mentink XX''XX Please do not give it out saying you made it, or distribute XX''XX it anywhere outside the Eclipse forums! Also, please always XX''XX distribute these credits along with the script! XX''XX www.nishansu.tk ©Dinand Mentink (aka Ilnair)XX''*****************************************************************''*****************************************************************' Select Case clicked_index Case 19 ClearMailBox(index) msg1 = GetVar("mailsystem\" & GetPlayerName(index) & ".ini", "mailbox", "box1") msg2 = GetVar("mailsystem\" & GetPlayerName(index) & ".ini", "mailbox", "box2") msg3 = GetVar("mailsystem\" & GetPlayerName(index) & ".ini", "mailbox", "box3") msg4 = GetVar("mailsystem\" & GetPlayerName(index) & ".ini", "mailbox", "box4") msg5 = GetVar("mailsystem\" & GetPlayerName(index) & ".ini", "mailbox", "box5") Call CustomMenuLabel(index, 14, "Message 1: " & msg1, 300, 70, 10, 0, 0, 400, 40) Call CustomMenuLabel(index, 15, "Message 2: " & msg2, 300, 80, 10, 0, 0, 400, 40) Call CustomMenuLabel(index, 16, "Message 3: " & msg3, 300, 90, 10, 0, 0, 400, 40) Call CustomMenuLabel(index, 17, "Message 4: " & msg4, 300, 100, 10, 0, 0, 400, 40) Call CustomMenuLabel(index, 18, "Message 5: " & msg5, 300, 110, 10, 0, 0, 400, 40) Case 12 msg1 = GetVar("mailsystem\" & GetPlayerName(index) & ".ini", "mailbox", "box1") msg2 = GetVar("mailsystem\" & GetPlayerName(index) & ".ini", "mailbox", "box2") msg3 = GetVar("mailsystem\" & GetPlayerName(index) & ".ini", "mailbox", "box3") msg4 = GetVar("mailsystem\" & GetPlayerName(index) & ".ini", "mailbox", "box4") msg5 = GetVar("mailsystem\" & GetPlayerName(index) & ".ini", "mailbox", "box5") Call CustomMenuLabel(index, 14, "Message 1: " & msg1, 300, 70, 10, 0, 0, 400, 40) Call CustomMenuLabel(index, 15, "Message 2: " & msg2, 300, 80, 10, 0, 0, 400, 40) Call CustomMenuLabel(index, 16, "Message 3: " & msg3, 300, 90, 10, 0, 0, 400, 40) Call CustomMenuLabel(index, 17, "Message 4: " & msg4, 300, 100, 10, 0, 0, 400, 40) Call CustomMenuLabel(index, 18, "Message 5: " & msg5, 300, 110, 10, 0, 0, 400, 40) Call PlayerMsg(index, "Refreshed mailbox!", 10) Case Else Exit Sub End Select Case Else Exit SubEnd SelectEnd SelectEnd Sub``` Link to comment Share on other sites More sharing options...
Zeno Posted December 16, 2008 Share Posted December 16, 2008 @Adrian:Using & "" is a common practice to avoid errors. If you have a Sub Name(Index, Variable) and use Call PutVar("filename.ini", "header", "label", Variable) it will not work. In that case, you need Call PutVar("filename.ini", "header", "label", Variable & ""). This only happens when the variable is one from the subname.@Dastyruck:Before you were using Sub SaveCharInfo(Index). To activate the sub, you need a Call SaveCharInfo(Index) at some point in your main.txt. Where are you actually using that call in your main txt? I'm looking for something like a scripted tile, spell, command, npc that initializes the actual savecharinfo function. Link to comment Share on other sites More sharing options...
Dastyruck Posted December 16, 2008 Author Share Posted December 16, 2008 Oh, its OnMapLoad Link to comment Share on other sites More sharing options...
AdrianC Posted December 16, 2008 Share Posted December 16, 2008 O, I usually just use int(variable) Link to comment Share on other sites More sharing options...
Zeno Posted December 16, 2008 Share Posted December 16, 2008 How does your sub look? The following works:```Sub OnMapLoad(Index, OldMap, NewMap)Call SaveCharInfo(Index)End Sub```When I use that in conjunction with your sub, it updates the ini each time I load a map.Is there something else in your OnMapLoad sub that might be making it not work? Link to comment Share on other sites More sharing options...
Dastyruck Posted December 16, 2008 Author Share Posted December 16, 2008 do I have to manually make each .ini? Link to comment Share on other sites More sharing options...
AdrianC Posted December 16, 2008 Share Posted December 16, 2008 Not unless you getvar it. Link to comment Share on other sites More sharing options...
Dastyruck Posted December 16, 2008 Author Share Posted December 16, 2008 Could you explain more? Link to comment Share on other sites More sharing options...
AdrianC Posted December 16, 2008 Share Posted December 16, 2008 If you use PutVar, you don't need to create it your self. If you use GetVar however, you do. Link to comment Share on other sites More sharing options...
Dastyruck Posted December 16, 2008 Author Share Posted December 16, 2008 It uses both… Link to comment Share on other sites More sharing options...
Dastyruck Posted December 16, 2008 Author Share Posted December 16, 2008 Sorry for double post… just realized that I missed a comma in OnMapLoad... it works now! 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