Pages:
Author

Topic: scripting primedice --- getting started - page 2. (Read 4857 times)

sr. member
Activity: 378
Merit: 250
March 01, 2017, 07:44:54 PM
#23
i found this topic in internet, i want to login but i have 2af active, would you know how to pass this parameter, i am working with java by the way
legendary
Activity: 1456
Merit: 1081
I may write code in exchange for bitcoins.
Nice that you helping people. I know its legit but I have never liked adding my username and password to a not program.  I'm scared it may be fake and steal it or someone manages to attain the files off my PC.

What's a 'not program'?  If you're talking about the script I posted above, simply read the code and do what you want with it.  If you're talking about seunjie's dicebot, ask him if his code is open source and then read the code and compile it yourself.
hero member
Activity: 770
Merit: 500
Nice that you helping people. I know its legit but I have never liked adding my username and password to a not program.  I'm scared it may be fake and steal it or someone manages to attain the files off my PC.
legendary
Activity: 1456
Merit: 1081
I may write code in exchange for bitcoins.
Alternatively, you can use DiceBots programmer mode and concentrate solely on your betting system/strategy.

DiceBot handles all of the interactions with the websites (as it supports other sites as well). Check out these links to get started with DiceBots programmer mode and skip all of these manual API calls and things:

DiceBot: https://bot.seuntjie.com
Programmer Mode: https://bot.seuntjie.com/programmermode.aspx
Youtube tutorials: https://www.youtube.com/playlist?list=PLZH88mwZAXLxVtHpc3PIFamkiT1o2V3LX
Programmer Mode Thread: https://bitcointalksearch.org/topic/seuntjie-dice-bot-programmers-mode-discussion-1114503

Thanks seuntjie,

I'm not really trying to compete with your dicebot here.  The point of this thread was just to offer up some scripting I was playing around with a few years ago in case anyone found it useful.  Clearly there are those that have done a complete job of this work and if your point is just to bet automatically, then that's probably the best way to go.  For me, playing around with scripts and coding is fun just for the education of it, so I'm often interested in a DIY approach even if it means that I wont end up getting as far as someone who's working full time on the job.

BTW, when I last tried to look into your dicebot stuff (again, I think this was years ago), I want to say that I ran into some roadblock.  I don't remember if it was that your stuff wasn't open source, or if it was just that your stuff is all in C#/.NET and there wasn't a reliable compiler on my system (GNU/Linux).
full member
Activity: 204
Merit: 100
thanks before man Wink :*
legendary
Activity: 1717
Merit: 1125
Alternatively, you can use DiceBots programmer mode and concentrate solely on your betting system/strategy.

DiceBot handles all of the interactions with the websites (as it supports other sites as well). Check out these links to get started with DiceBots programmer mode and skip all of these manual API calls and things:

DiceBot: https://bot.seuntjie.com
Programmer Mode: https://bot.seuntjie.com/programmermode.aspx
Youtube tutorials: https://www.youtube.com/playlist?list=PLZH88mwZAXLxVtHpc3PIFamkiT1o2V3LX
Programmer Mode Thread: https://bitcointalksearch.org/topic/seuntjie-dice-bot-programmers-mode-discussion-1114503
hero member
Activity: 1162
Merit: 500
CryptoTalk.Org - Get Paid for every Post!
Why make this bot script ? You know it won't help or is it just for fun like a challenge. It also needs your password and username isn't that a security risk ?
legendary
Activity: 1456
Merit: 1081
I may write code in exchange for bitcoins.
"Or else I would be able to make the world's only profitable dicing script."
LOL, it is fairly elusive. I think I've actually made a profitable dicing script, but the return is abysmal. I'm better off throwing my money in the betting pool and taking other people's money.

A couple of things. 

1) I haven't used primedice in years.  It's possible that the API has changed and that the scripts in the OP no longer work.
2) As far as I know, if you've actually made a "profitable" dicing script, then what's happened is that you've been lucky.  Assuming you're playing against a fair house with a house edge, it should be mathematically impossible to guarantee a profit.  If you've got one, then you're just in a situation where you haven't yet converged to your estimated long-run return.
newbie
Activity: 50
Merit: 0

Unfortunately you lost me. Or else I would be able to make the world's only profitable dicing script. It's fairly obvious what has to be done.

Basically, you bet 0 and record the results until you get the results you want. Then you bet what you want. When you are done betting rest the variables and bet 0 again.

The example was to help you with assigning variables, loops, and if/then statements.

"Or else I would be able to make the world's only profitable dicing script."
LOL, it is fairly elusive. I think I've actually made a profitable dicing script, but the return is abysmal. I'm better off throwing my money in the betting pool and taking other people's money.
full member
Activity: 252
Merit: 100
Is there a way to make a script only bet if it sees certain conditions met? That's the only thing about a script I would be interested in. If you could help me understand that would be awesome.

An example

while [ $better -le 60000 ]
do
result=$(curl -X POST --data "amount=$better&target=$target&condition=$condition" https://api.primedice.com/api/bet?access_token=$token 2>/dev/null | sed -e 's/.*"win":\(true\|false\).*/\1/')

echo
echo "$counter bet = $better"
echo "result = $result"

if [ "$result" = "true" ]; then
   let better=$amount
elif [ "$result" = "false" ]; then
   let better=$(($better * 10))
else
   break
fi


let counter=$counter+1
done
Unfortunately you lost me. Or else I would be able to make the world's only profitable dicing script. It's fairly obvious what has to be done.
newbie
Activity: 50
Merit: 0
Is there a way to make a script only bet if it sees certain conditions met? That's the only thing about a script I would be interested in. If you could help me understand that would be awesome.

An example

while [ $better -le 60000 ]
do
result=$(curl -X POST --data "amount=$better&target=$target&condition=$condition" https://api.primedice.com/api/bet?access_token=$token 2>/dev/null | sed -e 's/.*"win":\(true\|false\).*/\1/')

echo
echo "$counter bet = $better"
echo "result = $result"

if [ "$result" = "true" ]; then
   let better=$amount
elif [ "$result" = "false" ]; then
   let better=$(($better * 10))
else
   break
fi


let counter=$counter+1
done
newbie
Activity: 50
Merit: 0
I haven't used primedice in over a year so I don't know if there have been any API changes which may be getting in your way.

What did you try?  How far did you get? What errors did you see?

result=$(curl -X GET https://api.primedice.com/api/mybets?access_token=$token)

I called the api and it returned something. When I look in the variable or send the output to a file, it shows something like "mybets[]" I don't know if this is an empty array or I need to pass another variable to the api in the call or if the information is contained in the variable. I've tried to iterate through the array (but I'm new at scripting, google is a friend) but am unable to get anywhere.
newbie
Activity: 50
Merit: 0
Is there a way to make a script only bet if it sees certain conditions met? That's the only thing about a script I would be interested in. If you could help me understand that would be awesome.

No problem. You can use counters, loops (while,for), and conditional statements (if, elseif, else). It gets a little like spaghetti if things get complicated, but you can make it work.
full member
Activity: 252
Merit: 100
Is there a way to make a script only bet if it sees certain conditions met? That's the only thing about a script I would be interested in. If you could help me understand that would be awesome.
hero member
Activity: 952
Merit: 1009
June 13, 2016, 04:33:58 PM
#9
Code:
#!/bin/bash
#
# log into PD, return access_token
curl -X POST --data "username=$1&password=$2" https://api.primedice.com/api/login 2>/dev/null | sed -e 's/.*access_token":"\(.*\)"}/\1/' > token

cat token

It is best practices not to accept passwords as a cli arg as the password will appear in your .bash_history file in plaintext.

It is better to prompt the user to enter the password like this:

Code:
#!/bin/bash
#
# log into PD, return access_token

read -p "Password:" password

curl -X POST --data "username=$1&password=$password" https://api.primedice.com/api/login 2>/dev/null | sed -e 's/.*access_token":"\(.*\)"}/\1/' > token

cat token

That way it won't appear in the .bash_history file, when you run "history" or if you keep pressing "up" in the terminal window to scroll through command history.
legendary
Activity: 1456
Merit: 1081
I may write code in exchange for bitcoins.
June 13, 2016, 04:24:25 PM
#8
I've beat my head on this one and can' figure it out. How do I get the last 30 bets and send it to a file?

I haven't used primedice in over a year so I don't know if there have been any API changes which may be getting in your way.

What did you try?  How far did you get? What errors did you see?
newbie
Activity: 50
Merit: 0
June 11, 2016, 12:34:53 AM
#7
I've beat my head on this one and can' figure it out. How do I get the last 30 bets and send it to a file?
legendary
Activity: 1456
Merit: 1081
I may write code in exchange for bitcoins.
June 18, 2015, 12:28:52 AM
#6
bitllionaire:  at least for me, it's useful because I don't have to hit "click, click, click" until my wrist wears out.  And I don't have to load the chat if I'm not interested in it (sometime's I'm intersted in it and you can use the API to chat as well, if you're interested, I can show you guys how).  Basically using a script lets you take advantage of your computer to use primedice as you want to.  I think the most obvious thing is to do autobetting with a more complicated pattern than the simple autobet functionality on the website, when you're using the api and a script, you can do whatever you would do using clicks but faster and with less effort.

Anyway, you guys tell me how you've used it.  You said it was cool, what did you use it for?
legendary
Activity: 1120
Merit: 1000
June 17, 2015, 09:46:48 PM
#5
It's really cool
What uses do you think it is interesting to use the primedice api?
legendary
Activity: 1456
Merit: 1081
I may write code in exchange for bitcoins.
June 17, 2015, 09:43:42 PM
#4
Glad you guys liked it.  Feel free to PM me if you want more help or just reply in this thread.  I'm glad someone found this useful Smiley
Pages:
Jump to: