-
February 1st, 2021, 16:46 #21Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!
-
March 19th, 2022, 04:58 #22
Thanks Trenloe (and Damned for pointing me to this tutorial)
I was trying to figure out how to pass back the total from a die roll and banging my head against the computer desk because it kept passing nil values left right and centre (and the rRolls always wanted to be empty too).
I'm able to see a total if I print it from onRoll, but if I try to get a total of the roll anywhere else, it fires an : attempt to index local 'rRoll' (a nil value) in the manager actions lua of the coreRPG.
This is what I'm trying to get around and it almost seemed like I had it and then the computer ripped it away from me .Anybody want a peanut!
-
March 19th, 2022, 05:30 #23
Once the dice script has finished executing the result doesnt live anywhere that is accessible to your code anymore (except perhaps in the chatwindow ondrag events).
You have to do all your actions inside THIS SET OF SCRIPTS - you will be doing it in that Step 5 - Resolve Action. You cant do it after - you have to do it as part of the roll.
-
March 19th, 2022, 05:32 #24
have a look at a working example here:
https://github.com/DMFirmy/Drop-Lowest
-
March 19th, 2022, 17:57 #25
Thanks Damned; I can't get that one to work on any ruleset.
Would it be better (wiser) to call the table to be rolled on from onRoll? That's the only function that seems to allow Actionsmanager.total(rRoll) to actually NOT throw an error at me. From there I can use the total to pop out the message from the table (at least that's what make logical sense in my mind, whether that is the case or not remains to be seen ).
(thank you for your patience and good advice!)
edit: do I need to look into OOB's? *panic*Last edited by Fezzik Buttercup; March 19th, 2022 at 18:26.
Anybody want a peanut!
-
March 20th, 2022, 00:22 #26
here is a working build.
its just called Drop Lowest in your extension list
to test it type in chat
/rolld 5d6 2
working thru this example and then modifying it to roll what you want is going to be helpful
-
March 21st, 2022, 03:55 #27
I can't seem to wrap my head around getting the total out of these, so I'm going with the basic math line and maybe let someone else worry about seeing a roll if they want later on . I'll just work on tables for now and parcing the chat messages to locate critical hits etc.
Thanks damned!Anybody want a peanut!
-
March 21st, 2022, 04:22 #28
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 21,053
What script errors are you getting when you use ActionsManager.total(rRoll)?
What is the contents of the rRoll variable that you are passing in? (You can use Debug.chat or Debug.console to output the variable before the call.)
Regards,
JPG
-
March 21st, 2022, 19:18 #29
In all of the functions, it fails except onRoll (I'm taking a wild guess here its because the only thing the ActionsManager.register... is 'linked' to onRoll?). When I cycle through the other functions with debug (and try to get a .total too) the rRoll is empty :O . The error is on 661 (scripts/manager_actions.lua; attempt to perform arithmetic on field 'result' (a nil value). (line 656)
I can't call .onRoll() from my other scripts as that gives a 'attempt to indext local 'rRoll' (a nil value). Calling .processRoll works, but the total is spit out only on onRoll, which isn't called directly (just through the ActionsManager (at least that's what it seems to me; my brain hurts )
Thank you for your patience guys.Anybody want a peanut!
-
March 21st, 2022, 19:29 #30
Referring to the steps detailed in post #2 of this thread: performRoll (is this what you're calling processRoll?) is the only function you call externally - and this is to initiate the roll action. Everything else within the action manager LUA file gets called as part of the action process outlined in post #2 - calling those functions externally will give you the errors you're seeing.
I'd recommend going back and going through the process detailed in the first few posts of this thread - and ensuring you have the ActionsManager.registerResultHandler for your onRoll function - otherwise that function won't be called. And also ensure the roll type you're using doesn't have the same name as an existing roll type in the ruleset you're using. If you still can't get it working, then please post the whole action manager LUA file here.Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks