Jump to content


Photo

Ankhbot R2 math in a txt file?

Ankhbot ankh

  • Please log in to reply
15 replies to this topic

#1 Naddox

Naddox

    Newbie

  • Member
  • Pip
  • 3 posts

Posted 22 October 2015 - 06:06 PM

Hey all,

 

I am attempting to make a stream chat game with ankhbot using commands and not the minigame bit.

 

right now I am attempting to make a command where you flip a coin and bet an amount of points and you have a 50/50 chance to double your bet.

 

My problem is that using $addpoints, a user can bet more points then they have available, so my solution to that was to $removepoints in the same line first and then $addpoints, but to do this I need to add the points in twice. I tried just running 3 commands on 1 line, but the second $addpoints wont work unless it has the exact same inputs as the first one, including succeed and fail messages, which I don't want it to display anything at all.

 

Is it possible to do math within the $addpoints?

 

Here is my command and code.

!coinflip - Permission: Everyone

/w $user You flipped a coin and $readrandline(C:\coinflip.txt)
$removepoints("$user","$num","$num","","Not enough $currencyname!","false")$addpoints("$user","$num","$num","won $value!","F")$addpoints("$user","$num","$num","won $value!","F")
$removepoints("$user","$num","$num","Lost $value!","Not enough $currencyname!","false")

The above code works, however the issue here is that it prints out the succeed messages from both $addpoints.

 

If I edit the second to be blank or just spaces like so...

$removepoints("$user","$num","$num","","Not enough $currencyname!","false")$addpoints("$user","$num","$num","won $value!","F")$addpoints("$user","$num","$num"," "," ")
$removepoints("$user","$num","$num","Lost $value!","Not enough $currencyname!","false")

Then it prints the response from the first $addpoints, and prints the actual code for the second.

BtL1d8Z.png

 

I have tried making the second $addpoints not blank and putting additional words or anything but it does the exact same thing as if it were blank..

 

 

Thanks.


  • 0

#2 SuperBadJuJu

SuperBadJuJu

    Lift Veteran

  • Lift Staff
  • PipPipPipPip
  • 2,186 posts
  • LocationNew England, USA

Posted 22 October 2015 - 08:53 PM

Helixa would probably know the answer to this.  If she doesn't see this thread I'll see if I can track her down and send her this way :D


  • 0

SuperBadJuJu.png

         :rolleyes:  Twitter | Steam | YouTube  :rolleyes: 


#3 Not Ludo

Not Ludo

    Lift Regular

  • Moderator
  • 458 posts
  • LocationSwamp-Germany

Posted 22 October 2015 - 09:10 PM

Helixia and Ed @ PokeYourEyesOutGames are our resident Ankhbot geniuses I think.

 

I'm off a somewhat lower rank than them and I think this won't work, since those functions will straight edit the points-database without any calculations.


  • 0

#4 PacoPlaysGames

PacoPlaysGames

    Lift Regular

  • Member
  • PipPip
  • 409 posts

Posted 22 October 2015 - 09:50 PM

I've got Ed on the case. He'll see if he can fix it
  • 0

Life without tacos? Impossible!


#5 Naddox

Naddox

    Newbie

  • Member
  • Pip
  • 3 posts

Posted 22 October 2015 - 10:01 PM

Thanks all, I sure hope someone can figure it out :D


  • 0

#6 pokeyoureyesoutgames

pokeyoureyesoutgames

    Lift Regular

  • Member
  • PipPip
  • 398 posts
  • LocationChi-Town!

Posted 22 October 2015 - 11:51 PM

Okay, so Ed looked at the coding and came up with this to try. It MIGHT not work, but it's something to think about

 

If you create a notepad file in an easy to get to file directory, you can save 2 commands on separate lines in notepad.  Then you can use the $readrandline to "flip" your coin on which command you want to use.

Since your doubling only needs to add and remove the same amount of points, you should be able to replace a second add/remove points min and max with $value.  And replace the failed/succeed message with spaces, or emojis.

However, I haven't been able to test this just yet - need to finish some other things around the house and then I'll get back to it.

 

Figured We'd give you something right now to ponder on


  • 0

#7 Helixia

Helixia

    Lift Veteran

  • Member
  • PipPipPip
  • 583 posts
  • LocationThe Netherlands

Posted 23 October 2015 - 03:13 AM

Okay, so Ed looked at the coding and came up with this to try. It MIGHT not work, but it's something to think about

 

If you create a notepad file in an easy to get to file directory, you can save 2 commands on separate lines in notepad.  Then you can use the $readrandline to "flip" your coin on which command you want to use.

Since your doubling only needs to add and remove the same amount of points, you should be able to replace a second add/remove points min and max with $value.  And replace the failed/succeed message with spaces, or emojis.

However, I haven't been able to test this just yet - need to finish some other things around the house and then I'll get back to it.

 

Figured We'd give you something right now to ponder on

2 times $addpoints could work.
If not then there is some math work need in .PHP and $readapi.

I will look into it when i'm home. 

 

Also look out for my next AknhBot video there i will also explain this kind of things.


  • 0

#8 Naddox

Naddox

    Newbie

  • Member
  • Pip
  • 3 posts

Posted 23 October 2015 - 06:31 AM

Okay, so Ed looked at the coding and came up with this to try. It MIGHT not work, but it's something to think about

 

If you create a notepad file in an easy to get to file directory, you can save 2 commands on separate lines in notepad.  Then you can use the $readrandline to "flip" your coin on which command you want to use.

Since your doubling only needs to add and remove the same amount of points, you should be able to replace a second add/remove points min and max with $value.  And replace the failed/succeed message with spaces, or emojis.

However, I haven't been able to test this just yet - need to finish some other things around the house and then I'll get back to it.

 

Figured We'd give you something right now to ponder on

I'm not sure if I am misunderstanding you or not, but I already have it $addpoints 2 times in the same line. The problem is that if I change the failed/succeed messages of the second $addpoints, then it doesn't work, in the chat window it just pastes the code. I'll update my original post with the command and how its working. Thanks though.

 

2 times $addpoints could work.
If not then there is some math work need in .PHP and $readapi.

I will look into it when i'm home. 

 

Also look out for my next AknhBot video there i will also explain this kind of things.

I think that is exactly what I am going to end up needing, as I am wanting to do more complicated commands and I don't think $readrandline is going to work for me, so I will be watching for that video. Thanks.


  • 0

#9 LawlyPopzz

LawlyPopzz

    Newbie

  • Member
  • Pip
  • 1 posts
  • LocationEngalnd

Posted 15 November 2015 - 05:21 PM

$addpoints("$user","$num","$num","$user won $value!","Fails to add $currencyname")
$removepoints("$user","$num","$num","$user Lost $value!","$user Not enough $currencyname!","false")

the above code would work why would u need to remove the point just to add more when u can just add that number


  • 0

#10 Kreegah

Kreegah

    Newbie

  • Member
  • Pip
  • 3 posts
  • LocationNorway

Posted 16 November 2015 - 02:38 PM

First of all, sorry for "hi-jacking" this thread. Let me know and I'll replace if I must!

 

Hey, and thanks for putting this up here. I now have a perfectly fine !coinflip command. BUT...

 

Is there any easy way to convert this way of thinking into a !gambling command aswell?

 

I've been using a bunch of different bots for different purposes until I found Ankhbot R2. Ex. Revlo uses a gamble system like this: 

If they roll...

99-100 They will receive...  3x their bet

61-98 2x their bet

1-60 loose their bet

 

Any idea how to multiply or triple the value on addpoints?

And since I am such a noob, what is the coding language used?


Edited by Kreegah, 16 November 2015 - 02:39 PM.

  • 0

#11 Helixia

Helixia

    Lift Veteran

  • Member
  • PipPipPip
  • 583 posts
  • LocationThe Netherlands

Posted 16 November 2015 - 05:20 PM

First of all, sorry for "hi-jacking" this thread. Let me know and I'll replace if I must!

 

Hey, and thanks for putting this up here. I now have a perfectly fine !coinflip command. BUT...

 

Is there any easy way to convert this way of thinking into a !gambling command aswell?

 

I've been using a bunch of different bots for different purposes until I found Ankhbot R2. Ex. Revlo uses a gamble system like this: 

If they roll...

99-100 They will receive...  3x their bet

61-98 2x their bet

1-60 loose their bet

 

Any idea how to multiply or triple the value on addpoints?

And since I am such a noob, what is the coding language used?

Something like this?

Text file contents:
 

$addpoints("$user","0","50","$value $currencyname has been added","Nothing happend")
$removepoints("$user","0","50","$value $currencyname has been removed","fail","false")

Command:

!gamble  |  $readrandline(D:\Users\USER\Desktop\Stream Tools\AnkhBotR2\Roulette.txt)


  • 0

#12 Kreegah

Kreegah

    Newbie

  • Member
  • Pip
  • 3 posts
  • LocationNorway

Posted 17 November 2015 - 10:27 AM

Thanks Helixia!

 

So 0-50 makes it generate a random number?

 

Is there any command to triple, or double the "payout"/$value ?

 

EDIT: This didn't quite end up as I'd hoped. :(

 

I want a chatter to do:


 !gamble 50

If $readrand = line 1. the betting value is tripled,

$readrand = line 2  value gets doubled,

$readrand = line 3. loose the bet.

1. $addpoints("$user","$num","$num","rolled $randnum(99,100). $user won $value!","Failed to add $currencyname")
2. $addpoints("$user","$num","$num","rolled $randnum(61,98). $user won $value!","Failed to add $currencyname")
3. $removepoints("$user","$num","$num","rolled $randnum(1,60). He lost $value!","$user not enough $currencyname!","false") 

Edited by Kreegah, 17 November 2015 - 03:15 PM.

  • 0

#13 Helixia

Helixia

    Lift Veteran

  • Member
  • PipPipPip
  • 583 posts
  • LocationThe Netherlands

Posted 17 November 2015 - 06:31 PM

 

Is there any command to triple, or double the "payout"/$value ?

 

EDIT: This didn't quite end up as I'd hoped. :(

 

I want a chatter to do:


 !gamble 50

If $readrand = line 1. the betting value is tripled,

$readrand = line 2  value gets doubled,

$readrand = line 3. loose the bet.

1. $addpoints("$user","$num","$num","rolled $randnum(99,100). $user won $value!","Failed to add $currencyname")
2. $addpoints("$user","$num","$num","rolled $randnum(61,98). $user won $value!","Failed to add $currencyname")
3. $removepoints("$user","$num","$num","rolled $randnum(1,60). He lost $value!","$user not enough $currencyname!","false") 

 

As far as i know there is no option to triple the bet value.

Then you should write the whole command in PHP which can get complex.


  • 0

#14 Kreegah

Kreegah

    Newbie

  • Member
  • Pip
  • 3 posts
  • LocationNorway

Posted 19 November 2015 - 09:22 AM

Yeah, I'm just intrigued by the variable in the !betting option.

"PayoutPercent", do you think this could be implemented in this command?


  • 0

#15 Helixia

Helixia

    Lift Veteran

  • Member
  • PipPipPip
  • 583 posts
  • LocationThe Netherlands

Posted 19 November 2015 - 10:30 AM

Yeah, I'm just intrigued by the variable in the !betting option.

"PayoutPercent", do you think this could be implemented in this command?

You should contact @ankhheart about this.


  • 0

#16 Serious67

Serious67

    Newbie

  • Member
  • Pip
  • 1 posts

Posted 04 March 2017 - 07:29 AM

I know this is a bit late but for those how come here to get a solution for the !flip command :

 

Naddox, you forgot the spacebars xD

 

$removepoints("$user","$num","$num","","Not enough $currencyname!","false") $addpoints("$user","$num","$num","won $value!","F") $addpoints("$user","$num","$num","won $value!","F")
$removepoints("$user","$num","$num","Lost $value!","Not enough $currencyname!","false")

 

this will work just fine :D

 

sry for the bad english ^^


  • 0





Also tagged with one or more of these keywords: Ankhbot, ankh