Little help with code again

@CJW pointed me in the right dierction, but still not seeing what the problem is. I removed the following code:


*label flaws
*gosub count_check
You currently have ${flaws} Flaws and ${slots} slots open
*choice
 #I am done
  ${t_call} You have filled up all your flaws, very brave of you. Lets move on to skills.
  *goto_scene pc_skills  
 *if (t_type_1) #Absentminded
  Decrease your chance of spotting things around you.
  *line_break
  Decreases clues -2
  *line_break
  Increase Skills +1
  *choice
   #Add flaw
    *gosub clues_1
    *set pc_flawed true
    *set t_type_1 false
    *set skills +1
    *set clues -2
    *set flaws +1
    *set slots -1
    *set absentminded true
    [i](You have added Absentmindedness to your stats)[/i]
    *line_break
    *goto flaws
   #Ignore flaw
    *goto flaws   

Now the code is a lot longer then shown here. But once removed it passes the quicktest.

So I broke up the code to see if I can find where the error lays.

This was what I first put in:


*label flaws
*gosub count_check
You currently have ${flaws} Flaws and ${slots} slots open
*choice
 *if (t_type_1) ##Absentminded
  Decrease your chance of spotting things around you.
  *line_break
  Decreases clues -2
  *line_break
  Increase Skills +1
  *goto t_c_1
 #I am done
  This if it has nothing to pick
  *goto_scene pc_skills
 

Passes quick test

Next I tried this:


*label flaws
*gosub count_check
You currently have ${flaws} Flaws and ${slots} slots open
*choice
 *if (t_type_1) ##Absentminded
  Decrease your chance of spotting things around you.
  *line_break
  Decreases clues -2
  *line_break
  Increase Skills +1
  *goto t_c_1
 #I am done
  This if it has nothing to pick
  *goto t_c_1
  
*comment xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
*label t_c_1
Just some text
*choice
 #Add flaw
  *gosub clues_1
  *set pc_flawed true
  *set t_type_1 false
  *set skills +1
  *set clues -2
  *set flaws +1
  *set slots -1
  *set absentminded true
  [i](You have added Absentmindedness to your stats)[/i]
  *line_break
  *goto flaws
 #Ignore flaw
  *goto flaws

Quicktest does not like this.
QUICKTEST FAILED
TypeError: Object # has no method ‘toLowerCase’

I then commented gosub clues_1 out and behold it passes.

So now trying to figure out why clue_1 is causing this error
clues is set at 5 and -2 from this choice so stat is at 3


*label clues_1
*if (clues>=2)
 *return
*if (clues<=1)
 [i](Sorry you do not have enough points to use this flaw)[/i]
 *line_break
 *goto flaws

Any thoughts on what I am doing wrong thanks.

*edit I should add it does pass random test without clues being commented out.


*label clues_1
*if (clues>=2)
 *return
*if (clues<=1)
 [i](Sorry you do not have enough points to use this flaw)[/i]
 *line_break
 *goto flaws

Try this?

My eyes must be getting bad. I can see no difference between them. Yet I did put it in and it passed so THANK YOU very much @gkkiller

Excuse me briefly while I call my ophthalmologist.

@gkkiller, What on earth is the difference?

I have looked at this two dozen times to see what it is, yet fail to see why it works differently. lol
Whatever it is quicktest is now happy and passes it every time. :-?? :-? =D>

Is there some sort of hidden tab that is aggravating quicktest or something? (Wouldn’t know haven’t used quicktest yet.)

I have no clue, but wont knock a good thing. I am working towards getting this thing published and know CoG won’t do so if it does not pass quicktest. Its a good thing to test at stages then at the end and try to go back through all that code.

I can’t see what changed with that text! Although in the part before you have ##Absentminded. Shouldn’t that be just one #?

Yes I have been testing what (little) I do have through replays as I don’t think it’s long enough to warrant learning how to use quick test and random test, when I still need get used to ChoiceScript itself.

@andymwhy
You’re correct. Thanks.

I wrote this:


*label clues_1
*if (clues>=2)
 *return
*if (clues<=1)***[i](Sorry you do not have enough points to use this flaw)[/i]
 *line_break
 *goto flaws

Replace the “***” with an enter key-press. On the forums, it gets autocorrected to “<br / >”
I suspect something irritated ChoiceScript over there.

Seems I am having a bit of trouble with this section of code. The code is setup up to drop right into IDE.


*temp lock_lvl 0
*temp skill_lvl 1
*temp skill_lvl 0
*temp code 0
*temp answer ""
*temp guess ""
*temp lock_pick 0
*temp lock 0
*temp l1 ""
*temp l2 ""
*temp l3 ""
*temp l4 ""
*temp l5 ""
*temp l6 ""
*temp l7 ""
*temp l8 ""
*temp l9 ""
*temp l10 ""
*temp click_lock 0

*label top
All locks are based on crystal teck. If you have the proper chip installed in your lapstone you can try to pick the lock.
*line_break
*line_break
You may attempt to unlock up to three times before frying the locks crystal.
*line_break
*line_break
This is to test a lock picking system
*line_break
*line_break
A random chip will be installed into your lapstone for the challenge. Even if the lock is higher then the chip installed you still have a chance of 
cracking the lock.
*line_break
*line_break
The high the number on the crystal for the lock, the more encrypted the lock.
*line_break
*line_break
The higher the number the chip decreases the difficulty of the breaking the locks code.
*line_break
*line_break
*rand skill_lvl 1 5
*rand lock_lvl 3 6
*comment gosub locklvl
*line_break
Current level of lock set ${lock}
*line_break
Current Chip lvl installed: ${skill_lvl}
*line_break
Current level of lock: ${lock_lvl}
*page_break Pick the lock
.....


*label locklvl
*if (lock_lvl=6) and (skill_lvl=5)
 *set lock 7
 *return
*if (lock_lvl=6) and (skill_lvl=4)
 *set lock 8
 *return
*if (lock_lvl=6) and (skill_lvl=3)
 *set lock 9
 *return
*if (lock_lvl=6) and (skill_lvl=2)
 *set lock 10
 *return
*if (lock_lvl=6) and (skill_lvl=1)
 *set lock 10
 *return
*if (lock_lvl=5) and (skill_lvl=5)
 *set lock 5
 *return
*if (lock_lvl=5) and (skill_lvl=4)
 *set lock 6
 *return
*if (lock_lvl=5) and (skill_lvl=3)
 *set lock 7
 *return
*if (lock_lvl=5) and (skill_lvl=2)
 *set lock 8
 *return
*if (lock_lvl=5) and (skill_lvl=1)
 *set lock 9
 *return
*if (lock_lvl=4) and (skill_lvl=5)
 *set lock 4
 *return
*if (lock_lvl=4) and (skill_lvl=4)
 *set lock 5
 *return
*if (lock_lvl=4) and (skill_lvl=3)
 *set lock 6
 *return
*if (lock_lvl=4) and (skill_lvl=2)
 *set lock 7
 *return
*if (lock_lvl=4) and (skill_lvl=1)
 *set lock 8
 *return 
*if (lock_lvl=3) and (Skill_lvl=5)
 *set lock 3
 *return
*if (lock_lvl=3) and (skill_lvl=4)
 *set lock 4
 *return
*if (lock_lvl=3) and (skill_lvl=3)
 *set lock 5
 *return
*if (lock_lvl=3) and (skill_lvl=2)
 *set lock 6
 *return
*if (lock_lvl=3) and (skill_lvl=1)
 *set lock 7
 *return
 

Current level of lock set 0
*comment This is remain 0 and I am not sure what I am doing wrong in the code…
Current Chip lvl installed: 3
Current level of lock: 5

Thanks for any help.

As it is it won’t work:
For the line *comment gosub lock_level, remove *comment and add an * before gosub

Lol you it was right in front of me. :stuck_out_tongue: *slaps hand to forehead* Thanks @andymwhy

Can’t find the thread that talks about using a false in a choice so hoping you can help me out.

So using
*selectable_if (stu=false) and (t__5_off) #Fast-talk

stu is set to false
and
t_5_off is set true

Receive the error
Invalid expression at char 10, expected no more tokens, found CLOSE_PARENTHESIS [)]

Any ideas how to correct this. Thanks all. :slight_smile:

Try

*selectable_if ((stu=false) and (t_5_off)) #

Also in your example you put t__5_off but say t_5_off is set to true (extra _)

@Nocturnal_Stillness thanks for the help and spotting the error. :slight_smile:

*Edit works great now. :smiley:

This has me a little bit baffled.
So the stats function like they should after the abilities are rolled. I need to combine the health modifier into the stats.


*comment this is added after the abilities are rolled on pc_setup page
*set health +health_mod
*set hp health

Once I added these two lines the stat screen is blank!? I removed the two lines and the stats function as they should. This is the section the two lines of code should affect in the stat screen.


*stat_chart
 text user Logged in as
 percent hp HP level ${health}
 percent xp_d Next level ${xp_goal}
 opposed_pair Good
  Evil
*line_break

I added and removed the two lines of code several times to make sure this was the cause of the problem. I even broke it down to make sure the stats were working properly.


(This is the stat hp ${hp} and this is the health ${health} then this is the mod ${health_mod}
*line_break
*set health +health_mod
(This is the stat next step hp ${hp} and this is the health ${health} then this is the mod ${health_mod}
*line_break
*set hp health
(This is the stat final step hp ${hp} and this is the health ${health} then this is the mod ${health_mod}
*line_break

So on the page I am seeing they are working properly. Anybody have a clue why it may be causing the stat screen to stop work?

*Edit I should mention it does pass quick test even with the two lines of code added.

Post the statchart code with the two lines added it might be easier to spot.

@Nocturnal_Stillness
stat screen is 966 lines of code and pc_setup is 1520 lol might be a little hard to spot.
This code was an after thought, something I forgot when building the code. I think I am just going to have to break it down into sections and see where the problem is. Will let you all know if I find the problem over the next few days. Thanks all.