Page 2 of 2

Re: MMud version 1.11o

Posted: Tue Dec 16, 2003 5:11 pm
by axb9041
I know it isn't a Vb101 course. I write code all day for work, I am just not sure what you are asking for. If it is



Type Custom

String as String

End Type



change to ;



Type Custom

String to Integer

End Type



based on if it is version 1.11o or not ?



Is this what you are asking to do?

Re: MMud version 1.11o

Posted: Tue Dec 16, 2003 5:37 pm
by syntax53
I know it isn't a Vb101 course. I write code all day for work, I am just not sure what you are asking for. If it is



Type Custom

String as String

End Type



change to ;



Type Custom

String to Integer

End Type



based on if it is version 1.11o or not ?



Is this what you are asking to do?



example:



----two user defined types defined in a module:

Public TypeA (say for v1.11i through v1.11n)

VarA as Integer

VarB as Integer

VarC(0 to 15) as Integer

End Type



Public TypeB (for v1.11o)

VarA as Integer

VarB as Integer

VarC(0 to 15) as Long

End Type





----and then a global variable that is defined as TypeA:

Global Struct as TypeA





----then all over the program i reference "Struct" like this:

Struct.VarA = 2

Struct.VarC(4) = 23





----it is also passed into subroutines's like:

call sub(varX, Struct, varY)





... the problem is i can't define Struct as TypeA or TypeB at runtime since they are defined within the declarations. the only thing i think i may be able to do (and i just thought of it) is define Struct at the procedure level in each and every function/subroutine that uses it. that would require a lot more code and and a lot of reworkings though as i have module level functions that reference "Struct" as well without having Struct passed to them.

Re: MMud version 1.11o

Posted: Tue Dec 16, 2003 6:29 pm
by axb9041
What about;



Type Custom

Version as char

A as Integer

B as Long

End Type



Then something like;



If Custom.Version = o then



'Use Custom.B

Else



'Use Custom.A



just a thought?



Adam

Re: MMud version 1.11o

Posted: Tue Dec 16, 2003 7:05 pm
by syntax53
the only thing i think i may be able to do (and i just thought of it) is define Struct at the procedure level in each and every function/subroutine that uses it. that would require a lot more code and and a lot of reworkings though as i have module level functions that reference "Struct" as well without having Struct passed to them.



this actually wont work either because i still have to say, even at the procedure level ...



"Dim X as "



and i can't say



If condition = True then

Dim X as TypeA

Else

Dim X as TypeB

End If

Re: MMud version 1.11o

Posted: Tue Dec 16, 2003 7:08 pm
by syntax53
What about;



Type Custom

Version as char

A as Integer

B as Long

End Type



Then something like;



If Custom.Version = o then



'Use Custom.B

Else



'Use Custom.A



just a thought?



Adam



but then before every single line of code that references a "Custom.Element" i have to have an if/then statement which = slow and ugly.

Re: MMud version 1.11o

Posted: Tue Dec 16, 2003 8:06 pm
by elpresidente
wouldnt that just be creating two entirly different sub routines that encumpass the entire code?



why not have the two programs and release a frontend with something like

i-n as one button and o+ as another or something like that anyway

Re: MMud version 1.11o

Posted: Wed Dec 17, 2003 8:53 am
by axb9041
After thinking why not just declare it as a long then when saving use CInt to convert it to an integer based on the version? Just treat it as a long throughout the program; but the variable type should only matter when saving. correct?

Re: MMud version 1.11o

Posted: Wed Dec 17, 2003 9:30 am
by syntax53
After thinking why not just declare it as a long then when saving use CInt to convert it to an integer based on the version? Just treat it as a long throughout the program; but the variable type should only matter when saving. correct?

because there is also 1 added field and the length of each the types matters as well for alignment (a long takes up 4 bytes and a short (int in vb) takes up 2).

Re: MMud version 1.11o

Posted: Fri Dec 19, 2003 11:15 am
by syntax53
(v1.44 has been released (http://forumshq.com/showthread.php?t=1450) for support with v1.11o only)