Problem with a game in progress called Tokyo Blow


#1

I know it’s not a great name, I’m going to change it later :stuck_out_tongue:
The game is working fine so far, but the stat screen isn’t working properly.
I tried creating stats for weapons, but they only work sometimes.
The technique I use is basically:

  1. The variable pweapon, sweapon or mweapon is defined in game when you find a new weapon
    (e.g. When you find a M4A1 the script would be
    *set pweapon "M4A1)

  2. The stats are separately input into the choicescript_stat file.
    *if Pweapon = “M4A1 (silenced)”
    *set Ppower 70
    *set Paccuracy 80
    *set Prate 80
    *set Ptype “Carbine, Assault Rifle”
    *set Pweight 3.4
    *set Pdesc “Mobile and effective.”

*comment line_break
*comment if Pweapon != " "
*stat_chart
text Pweapon Primary Weapon
percent Ppower Power
percent Paccuracy Accuracy
percent Prate Rate of Fire
text Ptype Gun type
text Pweight Weight(kg)
text Pdesc Description

It works sometimes, but most of the time it would show up as if the variable is not defined. (Blank)
It always work if I check the stats straight after obtaining a weapon, but otherwise it has a chance of not working.
Anyone know how this could be fixed?
Thanks!


#3

It is hard to guess at the problem without seeing the code.


#4

Thank you very much for replying.
This is my choicescript_stats code:

This is a stats screen!

*stat_chart
text Name
text Origin
text Gender
text Job
text Currency
percent Strength
percent Technical
percent Luck
percent guts
percent Combat
percent Shooting
percent Stealth
percent Charisma
percent Reaction
opposed_pair Light
Darkness
opposed_pair Paranoia
Cautiousness
Care-Free
text pweapon
text sweapon
text mweapon

*comment PRIMARY WEAPONS

*if Pweapon = “Winchester Model 95”
*set Ppower 80
*set Paccuracy 95
*set Prate 60
*set Ptype “Lever-Action Repeating Rifle”
*set Pweight 4.1
*set Pdesc “Great for hunting both deers and people.”

*if Pweapon = “M4A1 (silenced)”
*set Ppower 70
*set Paccuracy 80
*set Prate 80
*set Ptype “Carbine, Assault Rifle”
*set Pweight 3.4
*set Pdesc “Mobile and effective.”

*comment line_break
*comment if Pweapon != " "
*stat_chart
text Pweapon Primary Weapon
percent Ppower Power
percent Paccuracy Accuracy
percent Prate Rate of Fire
text Ptype Gun type
text Pweight Weight(kg)
text Pdesc Description

*if Pweapon != " "
*set weapon true

*comment SECONDARY WEAPONS

*if Sweapon = “Universelle Selbstladepistole (Silenced)”
*set Spower 50
*set Saccuracy 65
*set Srate 50
*set Stypo " "
*set Stype “Semi-Automatic Pistol”
*set Sweight 1.06
*set Sdesc “A.k.a the USP.”

*if Sweapon = “Maverick Rev-6”
*set Spower 5
*set Saccuracy 25
*set Srate 1
*set Stypo “stun”
*set Stype “Nerf Gun”
*set Sweight 0.2
*set Sdesc “10% fun, 90% picking up bullets.”

*if Sweapon = “Desert Eagle (Airsoft)”
*set Spower 10
*set Saccuracy 50
*set Srate 10
*set Stypo “stun”
*set Stype “Air-Cocking Airsoft gun (6mm)”
*set Sweight 0.5
*set Sdesc “Warning: Contains only a brief element of surprise.”

*line_break
*if Sweapon != " "
*stat_chart
text Sweapon Secondary Weapon
percent Spower Power
percent Saccuracy Accuracy
percent Srate Rate of Fire
text Stype Gun type
text Sweight Weight(kg)
text Sdesc Description

*if Sweapon != " "
*set weapon true

*comment MELEE WEAPONS

*if Mweapon = “Molotov Cocktail”
*set Mpower 70
*set Mtypo “explosion”
*set Mtype “Drink”
*set Mweight 0.40
*set Mdesc “If you’re not going to throw it, don’t light it.”

*if Mweapon = “Chair”
*set Mpower 30
*set Mtypo “Throw”
*set Mtype “Furniture”
*set Mweight 0.90
*set Mdesc “When you just can’t chair less, throw furnitures at people.”

*if Mweapon = “Salt and Pepper”
*set Mpower 1
*set Mtypo “stun”
*set Mtype “Seasoning”
*set Mweight 0.27
*set Mdesc “Spice the fight up!”

*if Mweapon = “Fire Extinguisher”
*set Mpower 5
*set Mtypo “stun”
*set Mtype “Active Fire Protection Device”
*set Mweight 2.3
*set Mdesc “When sometimes people just need to chill.”

*if Mweapon = “Baseball Bat (plastic)”
*set Mpower 20
*set Mtype “Bat”
*set Mweight 0.3
*set Mdesc “Battin’ a thousand.”

*if Mweapon = “Butcher’s Knife”
*set Mpower 70
*set Mtypo “stab”
*set Mtype “Knife”
*set Mweight 0.85
*set Mdesc “Stab stab stab.”

*line_break
*if Mweapon != " "
*stat_chart
text Mweapon Melee Weapon
percent Mpower Power
text Mdur Durability
text Mtype Weapon type
text Mweight Weight (kg)
text Mdesc Description

*if Mweapon != " "
*set weapon true

*if Mweapon = " "
*if Mweapon = " "
*if Mweapon = " "
*set weapon false

*line_break
*if kppl > 0
*stat_chart
text kppl People Killed

*if dppl > 0
*stat_chart
text dppl People Disabled

The scene where you obtain the weapons is about 450 lines so I reckoned that I shouldn’t put it here.


#5

Select your code. Then click the button in the bar next to the quote that says preformatted text. (It looks like </>). This will keep your spacing intact and make it easier for people to help.


#6

Will take a deep look after work but quick glance I would say don’t use capital letters in your variables.


#7

Thank you very much for your replies, I really appreciate it. Please take your time:D


#8

Are you setting variables on the stats screen?

I know that that didn’t used to be possible. I’m not sure if it’s changed.


#9

I did, it was in the choicesciprt_stats file… Also, why does it matter
if I have variablea in capital letters? Thanks.


#10

Instead of setting variables on the stats screen, try using gosub_scene and return and see if that works. (I don’t think you can do that from the stats screen either though).

We tend to suggest against capital letters in variables since they can be case sensitive and it’s just easier to keep track of without any. As long as you’re consistent though it shouldn’t matter.


#11

Much obliged, I shall try it ASAP.