Hey, Yes I know there are tons of topics out there for this, but I tried making my own twitch point system and I am stuck on something, and I don't know the problem.
Here is my full code:
on *:JOIN:#: {
var %user = $nick
var %val = $readini( rxcoin.ini, #michaelukz, %user, coins )
writeini -n rxcoin.ini #michaelukz $nick coins calc(%val)
}
on *:TEXT:!balbusers *:#: {
var %user = $nick
var %val = $readini( rxcoin.ini, #michaelukz, %user, coins )
if ($nick isop #michaelukz) {
if ($2 == null) {
msg $chan /me >: Please supply a name to read.
}
msg $chan /me >: $2 has %val credits.
}
}
on *:TEXT:!balance:#: {
var %user = $nick
var %val = $readini( rxcoin.ini, #michaelukz, %user, coins )
if (%val == $null) {
msg $chan /me >: You have no credits, $nick
}
msg $chan /me >: $nick has %val credits.
}
on *:TEXT:!givecreds *:#: {
var %user = $nick
var %val = $readini( rxcoin.ini, #michaelukz, %user, coins )
if ($nick isop #michaelukz) {
if ($2 == $null) {
msg $chan /me >: Please enter a name to give credits too.
}
if ($3 == $null) {
msg $chan /me >: Please enter the number of credits to give.
}
msg $chan $2 has been given $3 credits
set %money.add $calc( $readini( rxcoin.ini, #michaelukz, %user, coins ) + $3 )
writeini -n rxcoin.ini #michaelukz %user coins %money.add
unset %money.add
}
}
on *:TEXT:!dcreds *:#: {
var %user = $nick
var %val = $readini( rxcoin.ini, #michaelukz, %user, coins )
if ($2 == $null) {
msg $chan /me >: Please insert a name to send credits too.
}
if ($3 == $null) {
msg $chan /me >: Please enter the number of credits to give.
}
if (%val == $null) {
msg $chan /me >: You have no credits to give!
}
if (%val == 0) {
msg $chan /me >: You have no credits to give!
}
msg $chan /me >: $2 has been given $3 tokens by $nick
set %money.add $calc( $readini( rxcoin.ini, #michaelukz, $2, coins ) + $3 )
set %money.withdraw $calc( $readini( rxcoin.ini, #michaelukz, %user, coins) - $3 )
writeini -n rxcoin.ini #michaelukz %user coins %money.withdraw
writeini -n rxcoin.ini #michaelukz $2 coins %money.add
unset %money.add
unset %money.withdraw
}
I have a couple issues, I will try and screenshot all (If I remember as I have to go back and forth)
sidenote: I know my code is dodgy but it's my code if you are so kind as to supply helping code to fix it, don't fix anything else(I want it to be as much mine as possible if that makes sense)
> !balance issue
screen cap :
http://gyazo.com/d8a8fd437e493bb8aa67110783063f7bIssue 1: Despite it said to read the .ini file, it doesn't and skips out completely on the part "%val".
Issue 2: It says both you have no credits and what should be how many credits you have, I didn't think I would have to use an else statement for this as I just want it to test if you have none.
!Balbusers issue
Screen cap:
http://gyazo.com/fb7381f002e6ffd06cc25d356a94751bIssue 1: If you do not type anything other than !balbusers ie with no name, it will not say you haven't specified a name.
Issue 2: Same as with the !balance it skips the "%val" variable.
!givecreds issue:
Screen cap:
http://gyazo.com/83fc4d957d23f9d8c638886d442c737fIssue: Instead of adding on any points, It replaces your point amount.
!dcreds issue:
Screen cap:
http://gyazo.com/89e3480f4e9eca44acd89c817c9b0867Issue 1: It ignores if you have no credits and just makes it negative numbers though I wish it to stop at 0 and not let it go less than.
Issue 2: It gives the other person points even if you have none.
I know this is a tall order, But I am really stuck here, Any help even for just 1 segment would be appreciated.