Turn-Script and Count Question [Null]

So I've been talking with some of my game's followers and asked them about a particular count length I have in the game. But opinions are a little scattered on it.

My question is if I have variables that define different count lengths, for example...
Count1
Count2
Count3
Count4

((Count1= 500 Overall Turns
Count2=1000 Overall Turns
Count3=1500 Overall Turns
Count4=2000 Overall Turns))

And then adapted it to the If-Script, like this...

player.strengthcount = player.strengthcount + 1
if (player.count1) {
    if (player.strengthcount = 100) {
   }
  if (player.strengthcount = 500) {
}
 }
if (player.count2) {
    if (player.strengthcount = 100) {
   }
  if (player.strengthcount = 1000) {
}
 }
if (player.count3) {
    if (player.strengthcount = 100) {
   }
  if (player.strengthcount = 1500) {
}
 }
if (player.count4) {
    if (player.strengthcount = 100) {
   }
  if (player.strengthcount = 2000) {
}
 }

Would it be possible to do? Am I making sense? These would all be in one, very large if-script.

Anonynn.


you may want to employ the modulus/modulo operator (%) / operations (division, but it returns the remainder, not the quotient), as they're made for cyclic handling or factoring needs. Usually, you'd use this within a 'changed' Script Attribute or a 'Turnscript/Timer' Element, for their constant checking which often goes with the use of the modulus operation (cyclic handling or factoring needs)

for some examples (using a Turnscript):

// game.turn = 0

<turnscript name="global_turnscript">
  <enabled />
  <script>
    game.turn = game.turn + 1

    if (game.turn % 5 = 0) {
      msg ("Every 5 turns (game turn: 5, 10, 15, 20, etc) this message is displayed")
    }
    if (game.turn % 3 = 0) {
      msg ("Every 3 turns (game turn: 3, 6, 9, 12, 15, etc) this message is displayed")
    }

   game.clock_second = game.turn % 60
   game.clock_minute = (game.turn / 60) % 60
   game.clock_military_hour = (game.turn / 3600) % 24
   game.clock_civilian_hour = (game.turn / 3600) % 12
   msg ("Civilian Clock: " + game.clock_civilian_hour + ":" + game.clock_minute + ":" + game.clock_second) // actually this requires a bit more coding to do the left zero display when its needed, but this is just an example of what the modulus can do.
   msg ("Military Clock: " + game.clock_military_hour + ":" + game.clock_minute + ":" + game.clock_second) // actually this requires a bit more coding to do the left zero display when its needed, but this is just an example of what the modulus can do.

    if (game.turn % 2 = 0) {
      msg ("The game turn's Value of " + game.turn + " is an even Value")
    } else {
      msg ("The game turn's Value of " + game.turn + " is an odd Value")
    }

    if (game.turn % 2 = 0) {
      msg ("The game turn's Value of " + game.turn + " is divisible by 2")
    } else if (game.turn % 3 = 0) {
      msg ("The game turn's Value of " + game.turn + " is divisible by 3")
    } else if (game.turn % 4 = 0) {
      msg ("The game turn's Value of " + game.turn + " is divisible by 4")
    } else if (game.turn % 5 = 0) {
      msg ("The game turn's Value of " + game.turn + " is divisible by 5")
    } else if (game.turn % 6 = 0) {
      msg ("The game turn's Value of " + game.turn + " is divisible by 6")
    } else if (game.turn % 7 = 0) {
      msg ("The game turn's Value of " + game.turn + " is divisible by 7")
    }
  </script>
</turnscript>

ask if you need any help or anything explained further or whatever


"... msg ("Military Clock: " + game.clock_military_hour + ":" + game.clock_minute + ":" + game.clock_second) // actually this requires a bit more coding to do the left zero display when its needed, but this is just an example of what the modulus can do."
Does Quest have a Format type of command???
In Basic, I would say:
... Sec=format(game.clock_second,"00")
to make Sec show: 00 01 02... 10 11...
In Quest would it look something more like this...
Sec=right("00"+ game.clock_second,2)
or
Sec=right$("00"+ game.clock_second,2)


I think....these are off topic xD I just needed a yes it's possible, or a no, it isn't! LOL


@ anonynn:

yes (my first quick answer, laughs)


@ DarkLizard:

no, you'd have to code in it to handle the left (tens column/digit) placeholder zero, here's a convoluted (hehe) timer coding and/or create your own Function to do all of the handling (including the coding, aka concatenating, for the display of clock time: XX:XX:XX and/or if working with date: XX/XX/XXXX):

http://textadventures.co.uk/forum/samples/topic/4162/countdown-timer-code

this was back when i was first learning code and trying out figuring out on my own, a count down timer... not much has changed... I still over-think stuff, laughs


well, there's some string Functions built-in, that help with concatenation-formatting:

http://docs.textadventures.co.uk/quest/functions/ (scroll down to the very bottom, to the 'string functions' section/category)


you can always create your own formatting functions too, such as whitespace/tabs/newlines/alignment/etc via iteration.


@ hegemonkhan , I've looked at those files...
They, in general, are helpful, but they need an example of their use...
(a short example code would be most helpful)

@ Anonynn , I don't think we understand what you want to do...
How are you using Count1, Count2...
and why the player.strengthcount ?


Don't worry about it! I'm going to try it and see what happens!


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums