Results 1 to 8 of 8

Thread: What thou...

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 2001
    Location
    2 miles from everywhere
    Posts
    80

    What thou...

    Why does the caption keep coming up 0?

    Sub SetPos()
    PC.xpos = 0
    PC.xview = 120
    PC.ypos = 0
    PC.yview = 120
    frmGame.Caption = PC.yview
    End Sub
    Do you know if you will answer no to this question?
    If we've never seen something happen, we can't know if its impossible.
    If the soles of a shoe make faces at the floor when we don't look and isn't being watched via mirror or video tape, will we ever know?
    If someone orders you to disobey all of their orders, do you obey or disobey?

  2. #2
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    You can surely say this function should work. So search your code for "Caption =" maybe you set the caption somewhere else, too.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Sep 2001
    Location
    2 miles from everywhere
    Posts
    80
    I got it to work, but not how I like...

    In module 1 -
    Type PlayerChar
    xpos As Integer
    ypos As Integer
    xview As Integer
    yview As Integer
    xvel As Integer
    yvel As Integer
    End Type

    Global PC As PlayerChar

    In module 2, I set the properties in that sub. But it doesnt work... how do I make it so that it still works even if they are in different modules?
    Do you know if you will answer no to this question?
    If we've never seen something happen, we can't know if its impossible.
    If the soles of a shoe make faces at the floor when we don't look and isn't being watched via mirror or video tape, will we ever know?
    If someone orders you to disobey all of their orders, do you obey or disobey?

  4. #4
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    There's nothing to do.. it should work. If you declared that variable in a public module you can access them from any other module or class... so there should be no problem.

  5. #5
    Addicted Member Janus's Avatar
    Join Date
    Aug 2001
    Location
    California
    Posts
    221
    Throw a CStr in there. Indirect conversion assignments are bad.
    "1 4m 4 1337 #4xz0r!'
    Janus

  6. #6
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    That already worked, Janus.

  7. #7
    Addicted Member Janus's Avatar
    Join Date
    Aug 2001
    Location
    California
    Posts
    221
    I know it worked, but he should still do explicit conversions nonetheless. It's good coding practice :P
    "1 4m 4 1337 #4xz0r!'
    Janus

  8. #8
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    Yeah VB gives us some really bad coding habits. I'm having a hard time getting used to C++ because of that

    Drakon, can you please post the code? There doesn't seem to be any problem with the part you're showing us, I'm sure it's somewhere else.
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    Jotaf's Theories!
    "Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width