Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Bug Fix (Inventory Gold Display)


JohnPony
 Share

Recommended Posts

Noticed this while helping someone in the Q&A board.

Find```
If GetPlayerInvItemNum(MyIndex, i) = 1 Then '1 = gold ![:P](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/tongue.png)
```

And try replacing it with```
if Item(GetPlayerInvItemNum(MyIndex, i)).Type = ITEM_TYPE_CURRENCY Then
```

That is client sided of course.

Also find

```

' If item is a stack - draw the amount you have

If GetPlayerInvItemValue(MyIndex, i) > 1 Then

y = rec_pos.Top + 22

X = rec_pos.Left - 4

Amount = CStr(GetPlayerInvItemValue(MyIndex, i))

' Draw currency but with k, m, b etc. using a convertion function

RenderText Font_Default, ConvertCurrency(Amount), X, y, Yellow, 0

' Check if it's gold, and update the label

If Item(GetPlayerInvItemNum(MyIndex, i)).Type = ITEM_TYPE_CURRENCY Then '1 = gold ![:P](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/tongue.png)

frmMain.lblGold.Caption = Format$(Amount, "#,###,###,###") & "g"

End If

End If
```

And change it too

```

' If item is a stack - draw the amount you have

If Item(GetPlayerInvItemNum(MyIndex, i)).Type <> ITEM_TYPE_ARMOR Or ITEM_TYPE_WEAPON Or ITEM_TYPE_CONSUME Then

If GetPlayerInvItemValue(MyIndex, i) >= 1 Then

y = rec_pos.Top + 22

X = rec_pos.Left - 4

Amount = CStr(GetPlayerInvItemValue(MyIndex, i))

' Draw currency but with k, m, b etc. using a convertion function

RenderText Font_Default, ConvertCurrency(Amount), X, y, Yellow, 0

' Check if it's gold, and update the label

If Item(GetPlayerInvItemNum(MyIndex, i)).Type = ITEM_TYPE_CURRENCY Then '1 = gold ![:P](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/tongue.png)

frmMain.lblGold.Caption = Format$(Amount, "#,###,###,###") & "g"

End If

end if

End If
```

And

```

If GetPlayerInvItemValue(MyIndex, i) > 1 Then

y = rec_pos.Top + 22

X = rec_pos.Left - 4

Amount = GetPlayerInvItemValue(MyIndex, i) - amountModifier

' Draw currency but with k, m, b etc. using a convertion function

If Amount < 1000000 Then

colour = White

ElseIf Amount > 1000000 And Amount < 10000000 Then

colour = Yellow

ElseIf Amount > 10000000 Then

colour = BrightGreen

End If

RenderText Font_Default, Format$(ConvertCurrency(str(Amount)), "#,###,###,###"), X, y, colour, 0

' Check if it's gold, and update the label

If Item(GetPlayerInvItemNum(MyIndex, i)).Type = ITEM_TYPE_CURRENCY Then '1 = gold ![:P](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/tongue.png)

frmMain.lblGold.Caption = Format$(Amount, "#,###,###,###") & "g"

End If
```

To

```

If Item(GetPlayerInvItemNum(MyIndex, i)).Type <> ITEM_TYPE_ARMOR Or ITEM_TYPE_WEAPON OR ITEM_TYPE_CONSUMEThen

If GetPlayerInvItemValue(MyIndex, i) >= 1 Then

y = rec_pos.Top + 22

X = rec_pos.Left - 4

Amount = GetPlayerInvItemValue(MyIndex, i) - amountModifier

' Draw currency but with k, m, b etc. using a convertion function

If Amount < 1000000 Then

colour = White

ElseIf Amount > 1000000 And Amount < 10000000 Then

colour = Yellow

ElseIf Amount > 10000000 Then

colour = BrightGreen

End If

RenderText Font_Default, Format$(ConvertCurrency(str(Amount)), "#,###,###,###"), X, y, colour, 0

' Check if it's gold, and update the label

If Item(GetPlayerInvItemNum(MyIndex, i)).Type = ITEM_TYPE_CURRENCY Then '1 = gold ![:P](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/tongue.png)

frmMain.lblGold.Caption = Format$(Amount, "#,###,###,###") & "g"

End If

end if
```

Yeah i know i suck at making tutorials.

Regards,

General Pony
Link to comment
Share on other sites

> Can i skip the first step if i want only item #1 to be counted in the gold label?

Yeah, just remember to remove the same code from step 2 and 3\. Like i said i messed up the tutorial but meh. ![:P](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/tongue.png)
Link to comment
Share on other sites

> Tell us what the bug is like. Without this information we can not decide if this fix makes sense.

Seems as though the gold label did not display the amount of gold if it was one, it also only considered items with the index of 1 to be counted as gold. I honestly don't care to investigate any further, someone had trouble in the Q&A board and this fixed it. I don't need your approval, nor do i want it.
Link to comment
Share on other sites

  • 1 month later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...