Invalid Token Error on identical code

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
Draite
Regular
Posts: 26
Joined: Tue Oct 08, 2019 9:10 pm
Contact:

Invalid Token Error on identical code

#1 Post by Draite » Fri Mar 20, 2020 3:40 pm

I'm currently setting up a bunch of default items for an inventory system and while working on it I got an Invalid Token error on some of the defaults, but not on others. The code is essentially all copy pasted with only superficial changes so I don't know what's causing the issue.

Code: Select all

default item_trash = InventoryItem(000001,"gui/items/default.jpg",0,1,"Trash","Description",64)
default item_vial = InventoryItem(000002,"gui/items/default.jpg",1,0,"Vial","Description",16)
default item_gold = InventoryItem(000003,"gui/items/default.jpg",1,1,"Gold","Gold coins from the elven empire, they have little value on Alcatraz except to unique individuals",64)
default item_squeeb_mead = InventoryItem(000004,"gui/items/default.jpg",0,0,"Special Mead","A barrel of mead for Lucia of Vergesseneburg",1,vii = True)
default item_squeeb_letter = InventoryItem(000005,"gui/items/default.jpg",0,0,"Letter of Recommendation","A letter of introduction for Lucia of Vergesseneburg",1,vii = True)
default item_squeeb_supplies = InventoryItem(000006,"gui/items/default.jpg",0,0,"Supplies for Squeeb","A package of supplies for Squeeb at the Last Drop. The package is quite heavy and has a lipstick mark on the exterior",1,vii = True)
default item_leather_scrap = InventoryItem(000007,"gui/items/default.jpg",2,2,"Leather Scrap","A piece of leather scrap harvested from some large creature.",16)
default item_werewolf_fur = InventoryItem(000008,"gui/items/default.jpg",4,6,"Werewolf Fur","A bundle of coarse fur that may be of use to a craftsman.",16)
default item_loot = InventoryItem(000009,"gui/items/default.jpg",1,1,"Loot","A collection of general materials with little use but will work well for bartering.",64)
default item_nails = InventoryItem(000010,"gui/items/nails.jpg",3,1,"Nails","A collection of rough iron nails.",16)
When I run the game I get this error

Code: Select all

I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.


File "game/script.rpy", line 97: invalid token
    InventoryItem(000008,"gui/items/default.jpg",4,6,"Werewolf Fur","A bundle of coarse fur that may be of use to a craftsman.",16)
                        ^

File "game/script.rpy", line 98: invalid token
    InventoryItem(000009,"gui/items/default.jpg",1,1,"Loot","A collection of general materials with little use but will work well for bartering.",64)
                        ^

Ren'Py Version: Ren'Py 7.3.2.320
Fri Mar 20 14:26:20 2020
I have no idea what's causing it and have tried rewriting the code from scratch a couple times and continue to get the error. If anyone knows what I'm doing wrong or if this is just a bug with RenPy please let me know. Thank you for the help!

User avatar
gas
Miko-Class Veteran
Posts: 838
Joined: Mon Jan 26, 2009 7:21 pm
Contact:

Re: Invalid Token Error on identical code

#2 Post by gas » Fri Mar 20, 2020 6:47 pm

Ahaha, is a very rare issue due the number you'll use, that python could throw when you have numbers that begin by 0, and consider them OCTAL codes.
Change them from 0000x (00001) to item000x (item0001).
Last edited by gas on Fri Mar 20, 2020 7:04 pm, edited 1 time in total.
If you want to debate on a reply I gave to your posts, please QUOTE ME or i'll not be notified about. << now red so probably you'll see it.

10 ? "RENPY"
20 GOTO 10

RUN

Draite
Regular
Posts: 26
Joined: Tue Oct 08, 2019 9:10 pm
Contact:

Re: Invalid Token Error on identical code

#3 Post by Draite » Fri Mar 20, 2020 6:55 pm

Won't I have to change it to a string instead of an int then?

User avatar
gas
Miko-Class Veteran
Posts: 838
Joined: Mon Jan 26, 2009 7:21 pm
Contact:

Re: Invalid Token Error on identical code

#4 Post by gas » Fri Mar 20, 2020 7:05 pm

I dunno the code you're using, so give a try with strings (probably they are used as identifiers, I dunno).
If you want to debate on a reply I gave to your posts, please QUOTE ME or i'll not be notified about. << now red so probably you'll see it.

10 ? "RENPY"
20 GOTO 10

RUN

Post Reply

Who is online

Users browsing this forum: Bing [Bot], span4ev