Domino_ Posted May 25, 2013 Author Share Posted May 25, 2013 Okey, so I have text box called **txt_NPC_HP** and there is text that is loaded from ini file ( text = **Npc(NPCNum).HP** ).So the problem is thet **txt_NPC_HP** is saved as **Npc(NPCNum).HP** but when it loads he got **"**Npc(NPCNum).HP**"** in place where im loading him see in pic. How to take off **"** or is there other way? xDEditWill Val(**Npc(NPCNum).HP**) fix it and he will load normally information? Link to comment Share on other sites More sharing options...
Zeno Posted May 25, 2013 Share Posted May 25, 2013 I'm a bit confused what you mean by this.If the text is literally "Npc(npcnum).hp", why not just use```GetNPCMaxVital = Npc(NPCNum).HP```To cut off the first and last character of that string, use:```GetNPCMaxVital = Mid$(frmConfig.txt_NPC_HP, 1, Len(frmConfig.txt_NPC_HP) - 2)```Edit: you may have to use 2 instead of 1 above. I forget if 0 is included as a position (probably not). Link to comment Share on other sites More sharing options...
Domino_ Posted May 26, 2013 Author Share Posted May 26, 2013 I'm trying to make the "Npc(NPCNum).HP" code load from text ini file so there is no need to open server in vb6, im trying to make like loading options.website but he adds " before and afther loaded code, is there any way to get rid of it? Link to comment Share on other sites More sharing options...
Zeno Posted May 26, 2013 Share Posted May 26, 2013 As already mentioned, to remove the first and last character in a string:```GetNPCMaxVital = Mid$(frmConfig.txt_NPC_HP, 1, Len(frmConfig.txt_NPC_HP) - 2)```orTo replace quotations with nothing:```GetNPCMaxVital = Replace(frmConfig.txt_NPC_HP, Chr$(34),"")``` Link to comment Share on other sites More sharing options...
Domino_ Posted May 27, 2013 Author Share Posted May 27, 2013 it still gives run-time error '13' type mismatch…Ill send u pm with source, so u understand better the error, than i can explain. :DEdit: I have ideo of importing old ee 2.8 script load how it worked from Main.txt but it would be very slow y ? Link to comment Share on other sites More sharing options...
abhi2011 Posted May 27, 2013 Share Posted May 27, 2013 Type mismatch means that the types aren't the same. Say a long variable was given a string this error will occur. If the HP variable is a number value then use the val function and change the string to a number. Link to comment Share on other sites More sharing options...
Zeno Posted May 27, 2013 Share Posted May 27, 2013 Oh… Now I see what you're doing. The issue is that GetMaxNPCVital is a long (a number), but NPC(npcnum).hp is a string, just a bunch of letters. The compiled program doesn't recognize it as an array address.As far as I know, what you'd need to do is introduce VBScript calling into your VB6 program. The reason why this was dropped from EO is because compiled programs run much better. Basically, code is always written in human language which has to be translated in order for a computer to use. The problem with scripts is that they need to be translated each time they are used. Compiled programs are translated on compiling.If you're still wanting to do this (read: large performance errors), search the internet for "VBScript calling in VB6" or look at the old codes of EE. Remember, while it's okay to load numbers and strings from INI files, loading scripts will cause your program to spend a lot of time consulting a translation dictionary. Link to comment Share on other sites More sharing options...
Domino_ Posted May 27, 2013 Author Share Posted May 27, 2013 I know that it will make engine bit slower(server) and i have already searched how its going in old ee 2.8 by loading from main.txt BUT in ee 2.8 he loads only when needed and every time when the function happens, i want to make that when server starts up he loads all information from ini file.I'll look into this and maybe just make something like option menu who changes to different types specific functions and subs. Link to comment Share on other sites More sharing options...
Zeno Posted May 27, 2013 Share Posted May 27, 2013 Best of luck. In some ways that will work well, like how class stats are only calculated once. You can easily store global variables like base block/crit chances, percentage modifiers to vitals/exp, etc. to use in procedures, without the need for any VBScript.As far as I know, you can't store scripts in memory, only their outputs, so many things that use indexed variables will not be able to work just on init, unless you had unlimited memory. You could, for example, store every NPC's max hp in memory (imo a sloppy idea), but not player's vitals, because they change based on variables and must be updated at each change. 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