Jump to content
  • Advertisement
Sign in to follow this  
Axxom

Simple question on VB

This topic is 3437 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am trying to make a simple loot system but i'm having a bit of trouble working out the correct way to do it using multiple IF THEN commands. i'm using VB 2008 express edition What i'd like it to do is to place the item in the following slot of the slot before if it is taken ::Edited for weird wording:: here is the code "If roll > 749 Then batMSG.Text = "You've found a weak potion!" item = item + 1 ipot = ipot + 1 If item1.Visible = False Then item1.Show() item1.Image = (WindowsApplication1.My.Resources.Resources.iPOT1) itema = "redpot" Else If item2.Visible = False Then item2.Show() item2.Image = (WindowsApplication1.My.Resources.Resources.iPOT1) itemb = "redpot" Else If item3.Visible = False Then item3.Show() item3.Image = (WindowsApplication1.My.Resources.Resources.iPOT1) itemc = "redpot" Else If item4.Visible = False Then item4.Show() item4.Image = (WindowsApplication1.My.Resources.Resources.iPOT1) itemd = "redpot" Else If item5.Visible = False Then item5.Show() item5.Image = (WindowsApplication1.My.Resources.Resources.iPOT1) iteme = "redpot" Else If item6.Visible = False Then item6.Show() item6.Image = (WindowsApplication1.My.Resources.Resources.iPOT1) itemf = "redpot" End If End If End If End If End If End If End If" i'm trying to work it out by myself, but i can't seem to put my finger on the right way to set it up.

Share this post


Link to post
Share on other sites
Advertisement
Not sure how you are implementing your items, but maybe along these lines to prevent all the if statements:

if (!item.visible)

Like I said, that would depend on how you implemented it I believe.

*Edit* Wait, I do not think VB works with the NOT condition in this respect or does it? Not sure, maybe someone else can answer that.

*Second Edit* VB does not work with the ! preceding the condition, at least not my trial example. Depending on how you implemented your item, you could try:

if (item.Visible = false)

Utilize a property in your item class to check the visibility.

Hope that helps!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!