Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Player allocated skill points

I am trying to create a system that will allow players to allocate twelve skill points over at least three skills. The problem is I can't for some reason figure out the if's and else if's in harlow.

I've been able to get one to where it will let me click the link repeatedly while the counter goes up but once I try to add some control over it all it basically blows up in my face.

This is the little bit I have been able to get working:

[$Face]<Face|\
(link-repeat: "Face")[(set:$Face to it + 1)\
(replace: ?Face)[$Face]]\

Comments

  • edited March 2016
    Ok so I've been giving it a few tries through out the day and finally came up with it:
    [$PCSkillPoints]<Athletics|\
    (link-repeat:"Athletics")
    [(if:$PCSkillPoints is > 0)
    [(set:$PCSkillPoints to it - 1)
    [(set:$PCAthletics to it + 1)[(replace: ?Athletics)
    [$PCSkillPoints](else-if:$PCSkillPoints = 0)
    [(replace: ?Athletics)
    [No more Skill Points!]]]]]]\
    

    Didn't work at all, didn't even get any errors it just doesn't do a single thing and I have no idea why or what else I could try.
  • Your example has a number of errors in it:
    a. line-breaks between the (if:) macro and it's associated hook

    b. hooks associated with (set:) macros.

    c. your (else-if:) macro is using a single equals sign (which means assignment) when it should be using a double equals sign == for comparison, or even better an is operator.

    Try the following which adds a plus and minus sign after each skill, these can be used to increase / descrease each skill.
    (set: $points to 12)
    (set: $skillA to 0)
    (set: $skillB to 0)
    (set: $skillC to 0)
    
    Available Points: [$points]<points|
    
    Skill A: [$skillA]<skillA| (link-repeat: "+")[(if: $points > 0)[(set: $points -= 1)(set: $skillA += 1)(replace: ?skillA)[$skillA](replace: ?points)[$points]]] / (link-repeat: "-")[(if: $skillA > 0)[(set: $skillA -= 1)(set: $points += 1)(replace: ?skillA)[$skillA](replace: ?points)[$points]]]
    Skill B: [$skillB]<skillB| (link-repeat: "+")[(if: $points > 0)[(set: $points -= 1)(set: $skillB += 1)(replace: ?skillB)[$skillB](replace: ?points)[$points]]] / (link-repeat: "-")[(if: $skillB > 0)[(set: $skillB -= 1)(set: $points += 1)(replace: ?skillB)[$skillB](replace: ?points)[$points]]]
    Skill C: [$skillC]<skillC| (link-repeat: "+")[(if: $points > 0)[(set: $points -= 1)(set: $skillC += 1)(replace: ?skillC)[$skillC](replace: ?points)[$points]]] / (link-repeat: "-")[(if: $skillC > 0)[(set: $skillC -= 1)(set: $points += 1)(replace: ?skillC)[$skillC](replace: ?points)[$points]]]
    
    ... the following a copy of the above with indents and line-breaks added to make it more readable.
    (set: $points to 12)
    (set: $skillA to 0)
    (set: $skillB to 0)
    (set: $skillC to 0)
    
    Available Points: [$points]<points|
    
    Skill A: [$skillA]<skillA|
    (link-repeat: "+")[
    	(if: $points > 0)[
    		(set: $points -= 1)
    		(set: $skillA += 1)
    		(replace: ?skillA)[$skillA]
    		(replace: ?points)[$points]
    	]
    ] / (link-repeat: "-")[
    	(if: $skillA > 0)[
    		(set: $skillA -= 1)
    		(set: $points += 1)
    		(replace: ?skillA)[$skillA]
    		(replace: ?points)[$points]
    	]
    ]
    Skill B: [$skillB]<skillB| 
    (link-repeat: "+")[
    	(if: $points > 0)[
    		(set: $points -= 1)
    		(set: $skillB += 1)
    		(replace: ?skillB)[$skillB]
    		(replace: ?points)[$points]
    	]
    ] / (link-repeat: "-")[
    	(if: $skillB > 0)[
    		(set: $skillB -= 1)
    		(set: $points += 1)
    		(replace: ?skillB)[$skillB]
    		(replace: ?points)[$points]
    	]
    ]
    Skill C: [$skillC]<skillC|
    (link-repeat: "+")[
    	(if: $points > 0)[
    		(set: $points -= 1)
    		(set: $skillC += 1)
    		(replace: ?skillC)[$skillC]
    		(replace: ?points)[$points]
    	]
    ] / (link-repeat: "-")[
    	(if: $skillC > 0)[
    		(set: $skillC -= 1)
    		(set: $points += 1)
    		(replace: ?skillC)[$skillC]
    		(replace: ?points)[$points]
    	]
    ]
    
  • This is great thank you!
Sign In or Register to comment.