![]() |
Message loop - Printable Version +- Mirage Source (https://mirage-engine.uk/forums) +-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61) +--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18) +---- Forum: General (https://mirage-engine.uk/forums/forumdisplay.php?fid=17) +---- Thread: Message loop (/showthread.php?tid=478) |
Message loop - Matt - 16-12-2006 I need to make a message display after it checks the inventory for a certain item. But I only want it to display once, currently, if it can't find that item, then it will display the message once for each inventory slot. Any idea how to fix this? - Obsidian - 16-12-2006 Edit... can't delete this. Kite said almost the exact thing that i did... - Robin - 16-12-2006 Put it after the loop instead of during? Code: If loop = false + no item = gay then - Matt - 16-12-2006 This is the sub I need it for: Code: Sub PlayerCreateGuild(ByVal Index As Long) - Obsidian - 16-12-2006 Code: If Item(GetPlayerInvItemnum(Index, d)).Type = ITEM_TYPE_CURRENCY and Trim$(Item(GetPlayerInvItemNum(Index, d)).Name) = "Gold" then And get with me soon... i have an entire guild system setup that's exactly like what you're attempting to do... i'll let you have a look at it. ![]() - Matt - 16-12-2006 I've tried that, it still loops through the inventory, displaying the message for each slot. I think someone once told me to use an exit for somewhere in there and that would fix it. I don't remember. - Obsidian - 16-12-2006 After it finds the item... just do a Code: exit for - Matt - 16-12-2006 That's what I thought. I added it in, if I don't have any money, it displays once, but if I have some, but not enough, it displays it twice. Going to try something real quick. I will let you know if it works. - halla - 16-12-2006 Probably a crappy way to do it but couldnt you just... if they have enough stuff then you set a variable such as.... ENOUGHGOLD = 1 Then right before the exit sub you have something like... if ENOUGHGOLD 1 Then msg "You do not have enough money!" something along those lines? - Matt - 16-12-2006 I just added another exit for and it's fine. Sub is like this now: Code: Sub PlayerCreateGuild(ByVal Index As Long) - Obsidian - 16-12-2006 You should add a for after the initial if line as well... if you don't it's going to go through the loop again that many more times... and continue looking for it... even though it's already found it... - Matt - 16-12-2006 Huh? Lol. Can you show me what you mean? - Matt - 16-12-2006 Oh okay. Good point. Didn't notice that. Thanks alot guys. ^_^ |