Serious Roleplaying Hell
  • Search
  • Leaderboard
  • Member List
  • Help
  • Donate
  • Portal

Register


Serious Roleplaying Hell General General Discussion v
« Previous 1 ... 26 27 28 29 30 ... 58 Next »
Error in script?

Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Threaded Mode | Linear Mode
Error in script?
12-13-2012, 06:02 AM
Post: #1
KingSpycrab Away
VIP
**
Joined: Jun 2012
SteamID: STEAM_0:1:35694671
Error in script?
So I am designing an easy way to randomly generate numbers without needing to open up a web browser, and something is screwing up...
Code:
import easygui
import random

easygui.msgbox(msg="Welcome to KingSpycrab's Randomizer!", title="Welcome!", ok_button="Begin")

easygui.msgbox(msg=('Give the players numbers(I suggest using the TAB menu to decide)'), title='Start')

select = easygui.integerbox(msg=('How many people are on the server?'), lowerbound=1, upperbound=55, title='Randomizer')

number = random.randint(1, select)

easygui.msgbox(msg=('Done. Number is ', number), title='Results', ok_button='Finished')

Now at the bottom where it displays the results, I get brackets showing up and it makes the gui look like shit. Ex. "{Done. Number is} 69"
Also I need software that will compile python(I only know that and a bit of c++ so I can't do it in another language).

[Image: images?q=tbn:ANd9GcQyR9W5PE7by5I8Ztklo7v...O9Nj8AP4mG]
Spoiler:
[Image: hans_totalleh.jpg]

Spoiler:
[Image: jaeson-why-are-you-late.jpg]
http://img259.imageshack.us/img259/8619/2204355.swf
Visit this user's website Find all posts by this user
Quote this message in a reply
12-13-2012, 08:24 AM (This post was last modified: 12-13-2012 11:37 AM by Drakehawke.)
Post: #2
Kerp Offline
Game Master
*****
Joined: Feb 2012
SteamID: STEAM_0:1:20464591
RE: Error in script?
Use this instead and it should work

Code:
easygui.msgbox(msg=('Done. Number is %d' %number), title='Results', ok_button='Finished')

Here's a way to create executable files on windows http://www.py2exe.org/
Find all posts by this user
Quote this message in a reply
12-13-2012, 11:37 AM
Post: #3
Drakehawke Offline
Imboseal
*******
Joined: May 2010
SteamID: STEAM_0:0:22342869
Pancake WarriorOld CodgerCoder#STG2012AthleteTop Poster
RE: Error in script?
I don't actually know the language, but shouldn't there by a comma before %number?

Drakehawke
SRH Leader
Lua Scripter

"Scientia Potentia Est"
For also knowledge itself is power
Francis Bacon - 1597
Find all posts by this user
Quote this message in a reply
12-13-2012, 12:30 PM
Post: #4
Kerp Offline
Game Master
*****
Joined: Feb 2012
SteamID: STEAM_0:1:20464591
RE: Error in script?
Nope that was my first thought as well but putting a comma there gave me an error.
Find all posts by this user
Quote this message in a reply
12-13-2012, 03:39 PM
Post: #5
KingSpycrab Away
VIP
**
Joined: Jun 2012
SteamID: STEAM_0:1:35694671
RE: Error in script?
(12-13-2012 08:24 AM)Kerp Wrote:  Use this instead and it should work

Code:
easygui.msgbox(msg=('Done. Number is %d' %number), title='Results', ok_button='Finished')

Here's a way to create executable files on windows http://www.py2exe.org/

thanks, py2exe doesn't work for python 3.3 though.

[Image: images?q=tbn:ANd9GcQyR9W5PE7by5I8Ztklo7v...O9Nj8AP4mG]
Spoiler:
[Image: hans_totalleh.jpg]

Spoiler:
[Image: jaeson-why-are-you-late.jpg]
http://img259.imageshack.us/img259/8619/2204355.swf
Visit this user's website Find all posts by this user
Quote this message in a reply
12-14-2012, 03:34 AM (This post was last modified: 12-14-2012 03:35 AM by Inferno IV.)
Post: #6
Inferno IV Offline
Shadow Hurricane
****
Joined: Jul 2012
SteamID: STEAM_0:0:30855410
RE: Error in script?
shouldn't %number be %d?
http://docs.python.org/2/library/stdtype...formatting

Tester of the Beta-Server.
[Image: 2o7CZ]
[Image: owneru.png]
[Image: 2onbG]
[Image: dmcf.jpg]
Find all posts by this user
Quote this message in a reply
12-14-2012, 07:05 AM (This post was last modified: 12-14-2012 09:05 AM by Kerp.)
Post: #7
Kerp Offline
Game Master
*****
Joined: Feb 2012
SteamID: STEAM_0:1:20464591
RE: Error in script?
Look I just googled something like "int to string conversion python" and got an example that looked like this. I tested it to make sure that it worked and when it did I didn't think more about it.

Edit

I just tested some stuff and it seems like

A = "test %d", 20 will create a table with key test and value 20 and
A = "test %d" %20 will create the string "test 20"
Both
A = "test %d", %20 and
A = "test %d" 20 generates a syntax error.
Find all posts by this user
Quote this message in a reply
« Next Oldest | Next Newest »
Post Reply 


  • View a Printable Version
  • Send this Thread to a Friend
  • Subscribe to this thread
Forum Jump:


User(s) browsing this thread: 1 Guest(s)

Contact UsSerious Roleplaying HellReturn to TopReturn to ContentLite (Archive) ModeRSS SyndicationPowered by Steam

Powered By MyBB, © 2002-2013 MyBB Group.
Theme by Ryan McGrane of Audentio Design.