Mirage Source http://www.miragesource.net/forums/ |
|
[Feature] Visual Inventory http://www.miragesource.net/forums/viewtopic.php?f=183&t=4370 |
Page 2 of 66 |
Author: | Dane [ Tue Oct 21, 2008 6:44 pm ] |
Post subject: | Re: [Feature] Visual Inventory |
How do i make it so the background thats pink doesnt show inside of the inventory and so it doesnt show ingame too..because If the background is white in my inventory then its white in the game . |
Author: | Johny050 [ Mon Nov 03, 2008 5:33 pm ] |
Post subject: | Re: [Feature] Visual Inventory |
When I try to add this I'm getting this error: DD_ItemSurf (Variable not defined) |
Author: | Joost [ Wed Nov 05, 2008 8:41 pm ] |
Post subject: | Re: [Feature] Visual Inventory |
One way to improve this is remove the useless dims Dim x As Long Dim y As Long in first sub Dim i As Long in the second sub. and third, and fourth I suppose the Temp Rec is a bit of a waste as well, you only use the vars you input there once, might as well just copy over that data. Dimming both offsets public and using them only once sounds like a waste as well. So seems the code is good, but can be cleared up a bit. |
Author: | deathknight [ Sat Dec 13, 2008 3:09 am ] |
Post subject: | Re: [Feature] Visual Inventory |
Johny050 wrote: When I try to add this I'm getting this error: DD_ItemSurf (Variable not defined) I'm pretty sure Johny050 figured this one out by now, but for anyone else trying to add this, just replace Code: Call DD_ItemSurf.BltToDC(frmMirage.picVisInv.hdc, rec, rec_pos) With Code: Call DDS_Item.BltToDC(frmMirage.picVisInv.hdc, rec, rec_pos) Real simple fix. Also there is alot of work to do for anyone who wants to add this in, its not just a C & P (thought C & P gets the actual picture box to work like it should.) |
Author: | deathknight [ Mon Jan 05, 2009 12:13 pm ] |
Post subject: | Re: [Feature] Visual Inventory |
Sorry for the double post, however, I have a question about how to get this to work. Here is the problem, the sub works ALMOST correctly. It see's the items as the first pixels in the upper lefthand part of the picVisInv, not the actual blting of the item. I tried messing with the InvPosX, InvPosY, X, Y, and I still can't seem to get it to move off of those pixels. Can anyone help me out with this? I have the standard 32 * 32 pixel items, and a 5 pixel offset between the top and sides of the picVisInv, and 5 pixel offset between the item pics. I know that I need to add in the offset, and the 32 * 32 pixels for the pics so the picItemDesc shows up when actually on the pictue. I wouldn't be too worried about this, I might take it out, however the other subs to drop and use the items are based on this, so scrolling over the actual item and double-clicking etc. does nothing. SPOILER: (click to show)
Edit: I've been thinking a little more into this, and I still do not know what to do to fix this, however I believe that what I need to change is not in the above sub, it's in the IsItem Function. I'm using the default IsItem Function (with only a change of the 4 - 8, just changing the amount of columns of items in the visual inventory. I posted the code below, for anyone to lazy to go look at it above, or who wants a look at my specific code. SPOILER: (click to show)
|
Author: | Jacob [ Mon Jan 05, 2009 3:37 pm ] |
Post subject: | Re: [Feature] Visual Inventory |
Ok so finally figured out the problem some people were having with the interaction code. First change: Code: Public Const InvX As Byte = 11 Public Const InvY As Byte =30 To: Code: Public Const InvX As Byte = 30 Public Const InvY As Byte = 11 Then in BltInventory: Code: With rec_pos .top = InvX + ((InvOffsetY + 32) * ((i - 1) \ 4)) .Bottom = .top + PIC_Y .Left = InvY + ((InvOffsetX + 32) * (((i - 1) Mod 4))) .Right = .Left + PIC_X End With To: Code: With rec_pos .top = InvY + ((InvOffsetY + 32) * ((i - 1) \ 4)) .Bottom = .top + PIC_Y .Left = InvX + ((InvOffsetX + 32) * (((i - 1) Mod 4))) .Right = .Left + PIC_X End With If there are any more problems let me know. |
Author: | skillzalot [ Mon Jan 19, 2009 11:47 am ] |
Post subject: | Re: [Feature] Visual Inventory |
I added all the code plus all the changes but when i click inventory it not showing the visual inventory |
Author: | deathknight [ Mon Jan 19, 2009 1:50 pm ] |
Post subject: | Re: [Feature] Visual Inventory |
Is it not showing the visual inventory or not showing the picture box? If it isn't showing the picture box, then you just need to add in picVisInv.visible = true into the click inventory button, or if you added it to the frmMirage, you may need to change the height of the frm when you click inventory. If you are talking about the actual items not showing up, make sure that the box is at least 64*64 (that won't be big enough, but it should show at least the first item) and make sure you add "Call BltInventory" into the click of the inventory button. |
Author: | skillzalot [ Mon Jan 19, 2009 2:33 pm ] |
Post subject: | Re: [Feature] Visual Inventory |
Im just wondering would it be easier if i made a new form or if i did it in form mirage. I will prolly go with a new form. |
Author: | Matt [ Mon Jan 19, 2009 5:23 pm ] |
Post subject: | Re: [Feature] Visual Inventory |
skillzalot wrote: Im just wondering would it be easier if i made a new form or if i did it in form mirage. I will prolly go with a new form. A new form is pointless and will just bloat the fuck out of your exe. |
Author: | deathknight [ Mon Jan 19, 2009 9:25 pm ] |
Post subject: | Re: [Feature] Visual Inventory |
What I did was add it to the bottom of my frmMirage, and when the inventory button was pressed, increased the height as needed, and when the close button was pressed, it set it back to normal. |
Author: | Lochie [ Fri Feb 27, 2009 7:27 am ] |
Post subject: | Re: [Feature] Visual Inventory |
deathknight wrote: Code: Call DD_ItemSurf.BltToDC(frmMirage.picVisInv.hdc, rec, rec_pos) With Code: Call DDS_Item.BltToDC(frmMirage.picVisInv.hdc, rec, rec_pos) I'm trying to work this out, everything is perfect and correct but the compiler is being an ass hole and showing me "Invalid Qualifier" for the "DDS_Item". Any ideas? |
Author: | Robin [ Fri Feb 27, 2009 4:51 pm ] |
Post subject: | Re: [Feature] Visual Inventory |
Lochie wrote: deathknight wrote: Code: Call DD_ItemSurf.BltToDC(frmMirage.picVisInv.hdc, rec, rec_pos) With Code: Call DDS_Item.BltToDC(frmMirage.picVisInv.hdc, rec, rec_pos) I'm trying to work this out, everything is perfect and correct but the compiler is being an ass hole and showing me "Invalid Qualifier" for the "DDS_Item". Any ideas? DDS_Item is now stored in an array. You'll need to re-write the code so that'll it load the surface with the item's number, something like: Code: Call DDS_Item(ItemNum).BltToDC(frmMirage.picVisInv.hdc, rec, rec_pos) And you'll need to edit 'rec' to something like: Code: rec.top = 0 rec.bottom = 32 rec.left = 0 rec.right = 32 You'll also need to copy and paste the code from one of the other surface checks to make sure the item surface is already loaded, as DFA edited it so unused graphics are unloaded from memory. Tbh, you should make a quick function to handle a check like I did, as it allows use of the graphics loaded into surfaces much easier. |
Author: | Lochie [ Fri Feb 27, 2009 4:59 pm ] |
Post subject: | Re: [Feature] Visual Inventory |
Yeah worked it out. Thanks though. The function check is a good idea, I'll do that tomorrow or something. Can't be bothered to code much, going out tonight so already got alcohol in me. I'll end up either killing the source or scripting something stupid. |
Author: | Jacob [ Fri Feb 27, 2009 5:23 pm ] |
Post subject: | Re: [Feature] Visual Inventory |
When I get time I'll update the tut to be up to date. |
Author: | Pbcrazy [ Mon Mar 09, 2009 5:20 pm ] |
Post subject: | Re: [Feature] Visual Inventory |
alright, i can't figure this one out. i've rewritten the code so that is "should" work, yet of course, it doesn't. When i bring the inventory up, it doesn't blt anything, and then when i click the button again, it gives me a "subscript out of range" error, and then i can see it start to blt. Code: Public Sub BltInventory() Dim i As Long Dim PicNum As Integer Dim sRECT As DXVBLib.RECT Dim dRECT As DXVBLib.RECT If frmMirage.picVisInv.Visible Then frmMirage.picVisInv.Cls For i = 1 To MAX_INV If GetPlayerInvItemNum(MyIndex, i) > 0 And GetPlayerInvItemNum(MyIndex, i) <= MAX_ITEMS Then PicNum = Item(i).Pic With sRECT .Top = 0 .Bottom = 32 .Left = 0 .Right = 32 End With With dRECT .Top = InvY + ((InvOffsetY + 32) * ((i - 1) \ 4)) .Bottom = .Top + PIC_Y .Left = InvX + ((InvOffsetX + 32) * (((i - 1) Mod 4))) .Right = .Left + PIC_X End With Call DD_ReadySurface("Items\" & PicNum, DDS_Item(PicNum)) Call DDS_Item(PicNum).Surface.BltToDC(frmMirage.picVisInv.hdc, sRECT, dRECT) End If Next i frmMirage.picVisInv.Refresh End If End Sub and highlights this line Code: Call DD_ReadySurface("Items\" & PicNum, DDS_Item(PicNum)) i can't ever get anything to work that deals with blting it seems :S |
Author: | Jacob [ Mon Mar 09, 2009 5:37 pm ] |
Post subject: | Re: [Feature] Visual Inventory |
I still haven't had the time to see what's new in MS4. One of these days... |
Author: | Matt [ Mon Mar 09, 2009 5:54 pm ] |
Post subject: | Re: [Feature] Visual Inventory |
The only thing new is the item icon array. Since it uses separate files and such, it has to be done differently. |
Author: | Pbcrazy [ Mon Mar 09, 2009 8:28 pm ] |
Post subject: | Re: [Feature] Visual Inventory |
hence the ready surface, however it says that is what is causing the problem |
Author: | Lochie [ Mon Mar 09, 2009 11:15 pm ] |
Post subject: | Re: [Feature] Visual Inventory |
Debug it. I think I had a similar problem. It wasn't picking up the ItemNum value and was returning zero in one of the checks. That is what caused it to go out of range. Have a browser through and Step Into the function to check what the values are. |
Author: | Matt [ Mon Mar 16, 2009 4:06 pm ] |
Post subject: | Re: [Feature] Visual Inventory |
Follow this tutorial the same way as you normally would, but use this sub for BltInventory instead: Code: Public Sub BltInventory() Dim i As Long, PicNum As Long Dim rec As DxVBLib.RECT Dim rec_pos As DxVBLib.RECT If frmMirage.picInvList.Visible Then frmMirage.picInvList.Cls For i = 1 To MAX_INV If GetPlayerInvItemNum(MyIndex, i) > 0 And GetPlayerInvItemNum(MyIndex, i) <= MAX_ITEMS Then With rec .Top = 0 'Item(GetPlayerInvItemNum(MyIndex, i)).Pic * PIC_Y .Bottom = 32 '.Top + PIC_Y .Left = 0 .Right = 32 '.Left + PIC_X End With With rec_pos .Top = InvY + ((InvOffsetY + 32) * ((i - 1) \ 4)) .Bottom = .Top + PIC_Y .Left = InvX + ((InvOffsetX + 32) * (((i - 1) Mod 4))) .Right = .Left + PIC_X End With PicNum = Item(PlayerInv(i).Num).Pic If DDS_Item(PicNum) Is Nothing Then Call InitDDSurf("Items\" & PicNum, DDSD_Item(PicNum), DDS_Item(PicNum)) End If Call DDS_Item(PicNum).BltToDC(frmMirage.picInvList.hDC, rec, rec_pos) End If Next i frmMirage.picInvList.Refresh End If End Sub EDIT: Updated it a bit so that it blits the correct item icon. |
Author: | timster0 [ Wed Mar 18, 2009 3:32 am ] |
Post subject: | Re: [Feature] Visual Inventory |
I seem to have a problem, It won't show the item name. |
Author: | Avarit [ Tue Apr 07, 2009 4:26 am ] |
Post subject: | Re: [Feature] Visual Inventory |
Im having a problem with the DDS_Item, Im getting a type mismatch before it loads the game windows. Code: Public Sub BltInventory() Dim i As Long, PicNum As Long Dim rec As DxVBLib.RECT Dim rec_pos As DxVBLib.RECT If frmMirage.picInvList.Visible Then frmMirage.picInvList.Cls For i = 1 To MAX_INV If GetPlayerInvItemNum(MyIndex, i) > 0 And GetPlayerInvItemNum(MyIndex, i) <= MAX_ITEMS Then With rec .Top = 0 'Item(GetPlayerInvItemNum(MyIndex, i)).Pic * PIC_Y .Bottom = 32 '.Top + PIC_Y .Left = 0 .Right = 32 '.Left + PIC_X End With With rec_pos .Top = InvY + ((InvOffsetY + 32) * ((i - 1) \ 4)) .Bottom = .Top + PIC_Y .Left = InvX + ((InvOffsetX + 32) * (((i - 1) Mod 4))) .Right = .Left + PIC_X End With PicNum = Item(PlayerInv(i).Num).Pic If DDS_Item(PicNum) Is Nothing Then Call InitDDSurf("Items\" & PicNum, DDSD_Item(PicNum), DDS_Item(PicNum)) End If Call DDS_Item(PicNum).BltToDC(frmMirage.picInvList.hdc, rec, rec_pos) End If Next i frmMirage.picInvList.Refresh End If End Sub If anyone has an idea on whats happening it would be great if you could show me how to fix it =] |
Author: | Pix€l [ Sun Aug 30, 2009 11:33 pm ] |
Post subject: | Re: [Feature] Visual Inventory |
i have the same prblm :/ |
Page 2 of 66 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |