Author | Message | Time |
---|---|---|
Dyndrilliac | [code]Public Sub MakeTemplate() 'Write Template to Gas File Function 'Embed Quotations Const Quote As String = """" Open "Template.gas" For Output As #1 Print #1, "[t:template,n:Auto_Template]" Print #1, "(" Print #1, "doc = " & Quote & WepName & Quote & ";" Print #1, "specializes = " & Weapon & ";" Print #1, "[aspect]" Print #1, "{" Print #1, "model = " & Model & ";" Print #1, "}" Print #1, "[attack]" Print #1, "{" Print #1, "f damage_max = " & MaxDam & ";" Print #1, "f damage_min = " & MinDam & ";" Print #1, "}" Print #1, "[common]" Print #1, "{" Print #1, "screen_name = " & Quote & WepName & Quote & ";" Print #1, "}" If Effect = True Then Print #1, "[effect_manager]" Print #1, "{" Print #1, "effect_name = " & GFX & ";" If Repeat = True Then Print #1, "repeat = true;" End If Print #1, "}" End If Print #1, "[gui]" Print #1, "{" Print #1, "active_icon = b_gui_ig_i_ic_swd_001;" Print #1, "equip_requirements = strength:1;" Print #1, "inventory_height = " & wHeight & ";" Print #1, "inventory_width = " & wWidth & ";" Print #1, "inventory_icon = " & wIcon & ";" Print #1, "tooltip_color = unique;" Print #1, "}" Print #1, "}" Close #1 End Sub[/code] This is the function im using to write to my file - but it has one problem, no text appears - Anyone have a solution? | November 14, 2003, 2:19 PM |
Sliver_king | no cause i have no idea what id going on. :P lol but really | November 14, 2003, 3:11 PM |
Spht | [quote author=Dyndrilliac link=board=31;threadid=3599;start=0#msg29118 date=1068819580] This is the function im using to write to my file - but it has one problem, no text appears - Anyone have a solution? [/quote] Are you saying the file is created but nothing is written to it? You may have to specify the exact location where you want the file to be saved (by default, if no path is specified, it'll be saved to the folder from which your project was launched from, so you may want to do a search on your harddrive for the file to see if it was saved somewhere else). I don't see anything obviously wrong as to why that doesn't work. Are you sure you actually called the function? | November 14, 2003, 4:25 PM |
Grok | It appears to work fine for me. I pasted your procedure directly into a new VB program, called it from a command button, and removed Option Explicit. It created the file template.gas, containing the following text: [quote] [t:template,n:Auto_Template] ( doc = ""; specializes = ; [aspect] { model = ; } [attack] { f damage_max = ; f damage_min = ; } [common] { screen_name = ""; } [gui] { active_icon = b_gui_ig_i_ic_swd_001; equip_requirements = strength:1; inventory_height = ; inventory_width = ; inventory_icon = ; tooltip_color = unique; } } [/quote] You'll have to be more specific about your problem. | November 14, 2003, 4:59 PM |
iago | [quote author=Sliver_king link=board=31;threadid=3599;start=0#msg29121 date=1068822692] no cause i have no idea what id going on. :P lol but really [/quote] If you aren't going to post something useful, don't post anything at all. | November 14, 2003, 6:33 PM |
Dyndrilliac | Ok, mky specific problem is that the file is created, but when I call the function no text is written to the file. I have it being called in a command button, as shown below:[code]Private Sub cmdCompile_Click() If txtHeight.Text = vbNullString Then Exit Sub End If If txtWidth.Text = vbNullString Then Exit Sub End If If txtMaxDam.Text = vbNullString Then Exit Sub End If If txtMinDam.Text = vbNullString Then Exit Sub End If 'Constants WepName = txtName.Text wHeight = CInt(Val(txtHeight.Text)) wWidth = CInt(Val(txtWidth.Text)) MaxDam = CInt(Val(txtMaxDam.Text)) MinDam = CInt(Val(txtMinDam.Text)) wIcon = txtIcon.Text GFX = txtEffect.Text Model = txtModel.Text Weapon = "base_sword" 'Calls the MakeTemplate procedure MakeTemplate End Sub [/code] From what Grok summized - unlesssomething is wrong with my caller it should work, but it doesn't. | November 14, 2003, 7:56 PM |
K | Are you sure the file is being created? When you don't specify the full path for the file it creates in in the current working directory, which can sometimes be different from your application path (often when you run your program via a shortcut, or another application starts it). Other than that, I don't see anything wrong. | November 14, 2003, 8:01 PM |
Dyndrilliac | Nevermind, I fixed the problem, I was running the prohram in the Visual Basic Environment (instead of compiling an exe) and the paths were wrong :P Thanks for all your help though | November 14, 2003, 8:08 PM |