Counters
MacMonkey
Member Posts: 6
Good evening/morning,
Coding Question - Is there a way to code in a counter?
For example, if I have a global variable "NumTimeTalk" with an initial value of 0, is there a way code so that each time the NPC is talked to the counter will advance? (Basically, I want n=n+1.)
(I apologize if this is mentioned elsewhere.)
MM
Coding Question - Is there a way to code in a counter?
For example, if I have a global variable "NumTimeTalk" with an initial value of 0, is there a way code so that each time the NPC is talked to the counter will advance? (Basically, I want n=n+1.)
(I apologize if this is mentioned elsewhere.)
MM
0
Comments
Here is an example given in iesdp:
IF
See([EVILCUTOFF]
!Specifics(LastSeenBy(),4000)
!Inparty(LastSeenBy())
!Allegiance(LastSeenBy([GOODCUTOFF])
THEN
RESPONSE #100
ChangeSpecifics(LastSeenBy(),4000)
IncrementGlobal("KR_MONSTER_COUNTER_ALIVE","GLOBAL",1)
END
http://gibberlings3.net/iesdp/scripting/actions/bgeeactions.htm
109 IncrementGlobal(S:Name*,S:Area*,I:Value*)
This action alters the specified variable, in the specified scope, by the amount indicated. The amount can be positive or negative. Variables in the local scope cannot be changed with this action
Another question: Would the following code work?
(I am sorry if it is just a mess...Although, I hope it isn't.)
IF ~ Global ("M2NPCMeet", "GLOBAL", 0) ~ THEN BEGIN FirstIntro
SAY ~Hi~
IncrementGlobal ("M2NPCMeet", "GLOBAL", 1)
++ ~Hello~ Do ~ JoinParty () ~
++ ~Goodbye ~ EXIT
END
IF ~ Global ("M2NPCMeet", "GLOBAL", 1,5) ~ THEN BEGIN SecIntro //not sure how to write a range...
SAY ~Hello Again~
IncrementGlobal ("M2NPCMeet", "GLOBAL", 1)
++ ~Hello. Now come with me.~ Do ~ JoinParty () ~
++ ~Goodbye Still ~ EXIT
END
IF ~ Global ("M2NPCMeet", "GLOBAL", 6) ~ THEN BEGIN LastIntro
SAY ~Nope, you had your chance!~ EXIT
END
Thank you again for your help.
MM
For the second block, you can start with this:
...GlobalLT("M2NPCMeet", "GLOBAL", 6) ...
Yes, a value of 0 is less than 6.
But. It will only fire if the first one doesn't fire. So, you effectively get your 1-5 range
Huh, iesdp is slightly wrong then. Specific can only be a byte (0-255).
MM