Support Forums
Gambling Script Help - Printable Version

+- Support Forums (https://www.supportforums.net)
+-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87)
+--- Forum: Coding Support Forums (https://www.supportforums.net/forumdisplay.php?fid=18)
+---- Forum: Python Programming Language (https://www.supportforums.net/forumdisplay.php?fid=32)
+---- Thread: Gambling Script Help (/showthread.php?tid=1796)

Pages: 1 2


Gambling Script Help - Mr.FeellingLeSS - 10-19-2009

hey guys.

I'm making a gambling script(will be posting it soon) but am i running against a problem.

error:
Code:
Traceback (most recent call last):
  File "C:\Python26\py2exe GUI\Kopie van gambling proto.py", line 217, in <module>
    print "You won by colour! Profit: "+rnwoncash
TypeError: cannot concatenate 'str' and 'int' objects

script part:
Code:
elif rnuserchosencolour==rnchosencolour:
            (line217)print "You won by colour! Profit: "+rnwoncash
                        rmoney+=rnwoncash
    (this last lines are to stop looping)
                        xxx-=1
                        rightnumberbet-=1
                        rightbet-=1
                        wrongin-=1


so can you guys help me?( rnwoncash is a number)


RE: Script problem... - Gaijin - 10-19-2009

(10-19-2009, 09:20 AM)Mr.FeellingLeSS Wrote: (line217)print "You won by colour! Profit: "+rnwoncash

Change the line to

Code:
print "You won by colour! Profit: ", rnwoncash

In Python you get a problem when you use "+" with 2 different types of data, since your var "rnwoncash" is integer you can't use "+" to add it to your string...


RE: Script problem... - Mr.FeellingLeSS - 10-19-2009

(10-19-2009, 09:24 AM)NinjaGeek Wrote: Change the line to

Code:
print "You won by colour! Profit: ", rnwoncash

In Python you get a problem when you use "+" with 2 different types of data, since your var "rnwoncash" is integer you can't use "+" to add it to your string...

thanks for the quick respone i will change it. PirateThumbsupBig Grin


RE: Script problem... - Gaijin - 10-19-2009

(10-19-2009, 09:32 AM)Mr.FeellingLeSS Wrote: thanks for the quick respone i will change it. PirateThumbsupBig Grin

Blackhat
I'm here to help, and for the future please use the code tags when showing code snippets

Code:
[code]Your code [ /code](without the whitespace in the closing tag)



RE: Script problem... - Mr.FeellingLeSS - 10-19-2009

(10-19-2009, 09:35 AM)NinjaGeek Wrote: Blackhat
I'm here to help, and for the future please use the code tags when showing code snippets

Code:
[code]Your code [ /code](without the whitespace in the closing tag)

taken care of Thumbsup


RE: Gambling Script Help - Omniscient - 10-19-2009

Please don't change thread titles into nonsense.


RE: Gambling Script Help - Fallen - 10-19-2009

since rnwoncash is an int, to concentrate it with a string you must turn it into a string.

Code:
print "You won by colour! Profit: " + str( rnwoncash )

should do


RE: Gambling Script Help - Mr.FeellingLeSS - 10-20-2009

guys i got an other problem Gratte

Code:
import os
import platform
systemver=platform.release()
if systemver=='XP':
    clearer=os.system("cls")
elif systemver=='Vista':
    clearer==os.system("clear")
else:
    clearer==os.system("clear")
clearer
print "TEST TEXT"
clearer
print "TEST LTEXT"
raw_input("")

it won't clear, though i don't get a error...
it just skips clearer like it means nothing...


RE: Gambling Script Help - Gaijin - 10-20-2009

(10-20-2009, 10:06 AM)Mr.FeellingLeSS Wrote: it won't clear, though i don't get a error...
it just skips clearer like it means nothing...

It does clear on XP, what are you using Vista or 7?

EDIT:
aahhhh I got what you were trying to do, you are calling the variable "clearer" but that is the wrong way
try defining a function, try this:
Code:
import os
import platform

def clearer():
    systemver=platform.release()
    if systemver=='XP':
        os.system("cls")
    elif systemver=='Vista':
        os.system("clear")
    else:
        os.system("clear")

clearer()
print "TEST TEXT"
clearer()
print "TEST LTEXT"
raw_input("")



RE: Gambling Script Help - Mr.FeellingLeSS - 10-20-2009

Thanks for the quick response Thumbsup

i see what i did wrong fixing it now Big Grin[/align]