Problem With Code


#1
[b]Quest Log[/b]
*choice
 #Find Butch Casey
  A rogue Mexican gang leader by who goes by the name of [b]Butch Casey[/b] has escaped from the Old Durango prison. As a bounty hunter, you've been tasked with identifying Butch's location and bringing him 
back to the law.

[b]BOUNTY: $5,000[/b]
*page_break
*goto qlog

*if (sherrif = true)#Meet The Sherrif
  It's been heard that there's something that's been keeping the town Sherrif paranoid; it could be important and might give you the answers to a few questions you've been carrying.
*page_break
*goto qlog

 
[b]The Western Encyclopedia[/b]
*choice
 #Armachillo
  A town established in 1843 near the Southern border of Mexico by the late, great Sir John Williams. Although the town is mostly used as a pitting stop by travellers, many annual circuses
and such are also held here. [i](U0nder work)[/i]
*finish

So, I’ve been trying to implement a quest system in my game but it doesn’t exactly work. The ‘if’ condition doesn’t work when triggered and no further stats or choices can be seen in the stats screen, including the ‘Western Encyclopedia’. Could anyone please help me with this?


#2

Is that how you spell the sheriff variable?


#3

Yes, although the acronym was in lowercase.


#4

I’m not entirely sure what you’re trying to do here… But, looking a it, there’s no way for the code to flow to “The Western Encyclopedia”, as the flow is automatically directed to qlog (the start?) at the end of both of the first two options.


#5

There needs to be a *label qlog so your code flows from a *goto qlog to a *label qlog.


#6

Your indentation is looking off. That might be the cause of your issues.


#7

Thank you for the replies everyone!

Could anyone of you please provide me with an example?


#8

Using tabs instead of spaces because I find them easier.

Quest Log

*choice
	#Find Butch Casey
		A rogue Mexican gang leader by who goes by the name of [b]Butch Casey[/b] has escaped from the Old Durango prison. As a bounty hunter, you've been tasked with identifying Butch's location and bringing him back to the law.

		BOUNTY: $5,000
		*page_break
		*goto qlog

	*if (sherrif = true) #Meet The Sherrif
		It's been heard that there's something that's been keeping the town Sherrif paranoid; it could be important and might give you the answers to a few questions you've been carrying.
		*page_break
		*goto qlog

		

#9
[b]Quest Log[/b]
*choice
    #Find Butch Casey
        A rogue Mexican gang leader by who goes by the name of [b]Butch Casey[/b] has escaped from the Old Durango prison. As a bounty hunter, you've been tasked with identifying Butch's location and bringing him back to the law.

        [b]BOUNTY: $5,000[/b]
        *page_break
        *goto qlog

    *if (sherrif = true)#Meet The Sherrif
        It's been heard that there's something that's been keeping the town Sherrif paranoid; it could be important and might give you the answers to a few questions you've been carrying.
        *page_break
        *goto qlog

 
[b]The Western Encyclopedia[/b]
*choice
    #Armachillo
        A town established in 1843 near the Southern border of Mexico by the late, great Sir John Williams. Although the town is mostly used as a pitting stop by travellers, many annual circuses and such are also held here. [i](U0nder work)[/i]
        *finish

I used [4 spaces] as the indentation marks, but [Tabs] works.

Above result will present the player a list of Quest Log with 2 choices (if sheriff is true)

But are you sure it’s:
sherrif = true

and not these this?
sherrif = "true"
sherrif true


#10

It is *if (sherrif = true), although *if sherrif is exactly the same. To set the value of sherrif to true, you would use *set sherrif true, though.


Also, to get to the “Western Encyclopaedia” you would need a *label encyc (or similar) the line before the title, and a choice that gives a *goto encyc at another point in the code (probably not in the quest log, though).


#11

I never thought that would works :fearful:


#12

@Szaal

Variables can be three types. Numeric, String, and Boolean.

*if (sheriff = true) is a boolean. It can only be true/false.

*if (sheriff = “true”) is a string.

http://choicescriptdev.wikia.com/wiki/Variable_types


#13

Note that for a boolean, you can cut it down to just *if sherrif or *if not(sherrif), which you can’t do for a string.


#14

I’m seriously indebted to you guys. You helped my code work with maximum efficiency.