wizardmirth Posted November 28, 2016 Share Posted November 28, 2016 How can you call a variable in a message box? The error message I keep getting for the "float" line.... mismatched input 'float' expecting RPAREN required (...)+ loop did not match anything at input ')' Relevant part of the script... Int IButton = MyModMSG.Show(float afArg1) ;;<<----error? If iButton == 0 Return StoreItems() EndIf Previously (on an oldrim mod) I was able to get it to compile without any errors although I still did not see anything but 0's listed in the messagebox where there should have been other numbers. Now I just get the compile error and I am declaring everything. My quick fix is to remove the "float afArg1" and it will compile but I will not get any correct variables called in the message box. Also I am using "%.0f" in my message box for each variable, up to 10 at a time (as per something I read somewhere). Link to comment Share on other sites More sharing options...
Deleted3897072User Posted November 28, 2016 Share Posted November 28, 2016 (edited) I presume you are trying to call the show() and return a result? If so, you need to give it an actual numeric argument, not a declaration of a parameter. Int IButton = MyModMSG.Show(afArg1)Assuming that you have declared a float afArg1 and given it a value previously. Edited November 28, 2016 by OldMansBeard Link to comment Share on other sites More sharing options...
wizardmirth Posted November 29, 2016 Author Share Posted November 29, 2016 It compiles but I still only get a "0" in the message box. There should be a "1" there based on my current character's inventory count at the time of testing. I have tried various ways of doing this, including calling the float at the top of the script as well as within the following Function box. Is this somehow because I need to show in the message box in the Activation block for the object? I'm doing this because I don't want to show the message box unless there is at least one of the items in the player's inventory. Link to comment Share on other sites More sharing options...
Lisselli Posted November 29, 2016 Share Posted November 29, 2016 (edited) Example: Message Form Body text:Current number of Itmes: %.0f buttons0 - OK1 - Cancel(both close the menu for this example..) The code: Message property MyMessage auto Float fNumItems Event SomeEvent fNumItems = some code that returns the number of items and stores it to this variable EndEvent Function MyMenu(Int aiButton = 0) aiButton = MyMessage.Show(fNumItems) EndFunction This is an example only, code is thrown together and not compile ready. This is just to show proper syntax on passing variables in a message. Edited November 29, 2016 by Lisselli Link to comment Share on other sites More sharing options...
wizardmirth Posted November 29, 2016 Author Share Posted November 29, 2016 (edited) Okay thank you, but I'm still not getting the correct value returned. I'm wondering now if my FormList call in the same script is any problem. This formlist part works fine, when checking to see if player has one of the form list items and then opens the message box in question. The only problem is after that, where I can't get a correct value in the message box. I am also declaring each of the items to be counted as ObjectReferences, as well as of course declaring the FormList itself and the Message. Here's my workflow for the script, attached to a container (the failed part is in red):check a form list to see if 1 or more items is present in player inventory if so open the message box if not then just cancel (container opens normally) message box appears lists the player inventory counts for (in this case) 9 items and asks player to sort all the items found from the lists into the container (Yes, No) if YES, sorts of NO, nothing (container opens normally)Everything compiles fine, I just can't get a correct result in the message box. No matter what I try it always defaults to "0" for all 9 items. Edited November 29, 2016 by wizardmirth Link to comment Share on other sites More sharing options...
Lisselli Posted November 29, 2016 Share Posted November 29, 2016 (edited) By any chance are you using GetItemCount to obtain this number? Because I've heard it is quite buggy: If the argument akItem is a keyword and the object reference is an actor this function will fail to operate properly. A solution is to transfer the contents of the actor's inventory to a container and call the function on that container ( Source (EN) - Source (FR)).In all cases, if the object reference contains CK-Defined Leveled lists of items then this function will fail to operate properly (Source)If the argument akItem is a keyword and the object reference contains CK-defined items (Object References) then this function will fail to operate properly (Source) : it fails to include the CK-defined inventory when GetItemCount tries to calculate its count.Calling this function on an objectreference from the outside of its cell will return 1 in the case of the passed in form being in a leveled list. Needs more testing.. but works fine if the player is in the same cell.That last one isn't really a bug because you can't normally do stuff to an object in an unloaded cell. Edited November 29, 2016 by Lisselli Link to comment Share on other sites More sharing options...
wizardmirth Posted November 29, 2016 Author Share Posted November 29, 2016 Yeah this sounds like I'm screwed if I want to do it this way. I'll have to try and find some work around then. Thanks for the great info and links, Lisselli! Link to comment Share on other sites More sharing options...
wizardmirth Posted November 30, 2016 Author Share Posted November 30, 2016 Solved. Each individual object in the main formlist needs its own formlist. Extra steps but it works! :sweat: Link to comment Share on other sites More sharing options...
Recommended Posts