Stats not working?


#1

Okay, so i have about two scenes together that are mostly useless choices or a bunch of writing. Then i went to mygame.js and entered my stat variables and stuff… but every time i write anything there, it always comes up as ‘script error’ when i test it. Ive looked around the forums but no one really has the answer to my problem… and yes, i put my stats in on the stat chart… so… maybe im doing something wrong? This is about the only problem that i have.


#2

You write your variables at the top of startup.txt, right below *scene_list and right above the introductory text to your game.


#3

If you’re using the new version of choicescript you just need to do things like Proff says, no need to mess around with mygame.js anymore.


#4

Okay, thanx a lot! I’ll go try that right about now…


#5

Nope. Still didnt work. Instead of ‘script error’ it says ‘non-existent variable’ and i did put the variable after it. I am using the new version of Choicescript, so i know it should work, but its not.


#6

Does the error report give you a line the error occurs on? Non-existent variable means you called a variable that you never declared.

In other words, you said *set xyz 0 before declaring “xyz” in startup.txt. That error will also manifest should you misspell a variable name.


#7

Do you have things uploaded on dropbox? It would be easier to take a look to see what you’re doing wrong.


#8

@FairyGodfeather How do you know he’s the one doing something wrong? What if there is something wrong with choicescript? (It is probably the former, but I’m just saying that he might not be wrong.)


#9

Until we see a bunch of other people getting the same error, I think it’s safe to assume the problem is local. It just sounds like a regular non-existent variable error, which happens when you try to change a variable’s value in-game, or tried to call it with the stat screen (text Variable or percent Variable) but you never did *create the variable in startup.txt.


#10

I did create it in startup text… it just wasnt working. Maybe its just me, but ive tried almost everything to fix it. Im not really that old, 14 actually, so i dont really have much scripting experience. But anyways, yeah, Ill figure it out eventually :slight_smile:


#11

Have you looked at the wiki?

Do you have a dropbox account or can you copy and paste your code in here? Or if you want I can PM you my email address and look things over for you to help out. The initial difficulty is always at the start, once you get used to things it’ll become easy.


#12

Before i send you my stuff, i think ill take a second look at the wiki. I really dont want to burden you with my problem. For all i know, i could mispelling something? Ill read the wiki first, if that doesnt help, ill probably send you my stuff. Thanx a lot ( :


#13

If you were burdening me I wouldn’t offer. However it’s admirable that you want to work it out on your own. Can I suggest that you look at how the existing games do things and see if your game has any differences. It may be as simple as missing quote marks or a tab.

Anyway

https://www.choiceofgames.com/slammed/scenes/startup.txt - is the startup file for Slammed.

https://www.choiceofgames.com/slammed/scenes/choicescript_stats.txt is the stat screen.

Does yours look roughly the same formatting-wise?

Note that you need quote marks around variables which are words. You don’t use quote marks around numbers or true/false statements.


#14

Yeah it looks right. I tested it again after deleting the colons i put after the stat name and it still says ‘non-existent variable’
Spacing is correct- i pretty much tab everything. But yeah, looks roughly the same.


#15

Honestly, it would be far easier to help with an example of your code than trying to continue to guess which of the possible mistakes you’re making.


#16

Okay that’s fine. Id rather you PM me your email address just because i dont have a dropbox account, if thats okay.


#17

I think its safe to say that this discussion can be closed… I mean, a moderator does that, right? At least thats what my friend told me. Idk if its true. anyways, yeah… thanx everyone!