Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Dealer API help

January 26 (2 months ago)

Edited January 26 (2 months ago)

I've been trying to use the Dealer API. It works completely fine and as intended if I use "test Macro" but it wont deal out a single Card if its used outside of that testing environment. The Sandbox has given me following message:


!deal --give 1 --(Deck name) --ids|?{Select Player|
(Player name),(ID given from the API itself including the "-")|
...
}


I have tried variations of the Deck itself, like having infinite cards, having no infinite cards, only 1 card in the deck or multiple cards in the deck. 


From an old Forum Post I saw that if a player is logged in too long it does "disconnect" from the Id sometimes. so we tried reloading the page, we tried relogging into roll20 itself as well.

I have also tried shuffling the cards manually.


Sadly none of the things seem to resolve the issue. 

Does anyone know how this could be fixed?

January 27 (2 months ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

Hi Elexieria!

They shouldn't, but do any of the player IDs include the pipe character: | ?

Also, make sure that in the player ID, there is neither a space before nor after it in the macro. If you want to PM me the actual macro text, so as not to broadcast player IDs, I'd be happy to take a look.

January 27 (2 months ago)

Edited January 27 (2 months ago)

Hello Keith!

Thanks for your input! They do not have the Pipe character in their IDs luckily.


I have just checked the macro overall and it seems that after the Query input (so after the Brackets close and the macro technically should be done overall) is a space that I missed to see. It might be that Roll20 removes those in the testing environment, which would be a drag since it gets harder to find/realize that way. Me, and my Player who works in a related field have missed that completely due to this.
I have tested it outside of that environment again and it seems to work as intended now. But none of the players are online so I do hope it will stay this way when they log into the campaign. 


I will keep you updated!

January 27 (2 months ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

Dealer was my first script. I could probably fix that space issue programmatically. Yes, please let me know if that was definitely the problem.

January 27 (2 months ago)

Edited January 27 (2 months ago)

It seems to be working now! 

I assume the issue overall is that

!deal --give 1 --(Deckname) --ids|

is the command used from the API, but I then slotted the Query into it with

?{Select Player|

(Player Name),(ID)|

...

}


And that therefore only closes the Code from Query by Brackets but not per se the command lines from Dealer itself, due to the format of them being something around:

!deal (space)--(command) (space)--(command)       --> that meaning that the command works in (space)--(command) intervals.

So having the space after the Query line being done could maybe trigger a "waiting loop" for another command and I ended up not following up on it.



I do think its on Roll20 for having the testing environment remove that space and causing the code to work when in reality it should not and doesnt work. 


If you still end up changing the code to maybe contain brackets for opening and closing the code or removing the space requirement from the API, please feel free to PM me! That way I can adjust it on my end and also fuel my curiosity.

January 27 (2 months ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

Yeah, I did not write it with queries in mind, and it's not likely I'll have the time to make such a change (too many other demands on my time). If a query is problematical, I would suggest using a Chat Menu instead.