this.turncount = this.turncount + 1
if (this.turncount >= this.triggerturncount) {
this.enabled = false
invoke (this.timeoutscript)
destroy (this.name)
}
<game name="xxx">
<attr name="game_advancement" type="boolean">true</attr>
<attr name="game_turn" type="int">0</attr>
</game>
<turnscript name="global_turnscript">
<enabled />
<script>
if (game.game_advancement) { // if (game.game_advancement = true)
// all your scripts that advance the game turn count
game.game_turn = game.game_turn + 1
} else { // if (game.game_advancement = false)
// all your scripts that don't advance the game turn count
}
</script>
</turnscript>
<game name="xxx">
<attr name="game_advancement" type="boolean">true</attr>
<attr name="current_game_turn" type="int">0</attr>
<attr name="previous_game_turn" type="int">0</attr>
</game>
<command name="info_command">
<pattern>info</pattern>
<script>
game.game_advancement = false // this prevents a turn from occuring (see the turnscript code for why/how)
ClearScreen
msg ("Name: " + player.alias)
// etc etc etc
wait {
ClearScreen
}
// the turnscript will change the game.game_advancement's value back to 'true', so game turns/advancement will occur again, so we don't need to do it here, as the turnscript does it for us.
</script>
</command>
<command name="sleep_command">
<pattern>sleep</pattern>
<script>
game.previous_game_turn = game.current_game_turn
msg ("You sleep for 8 hrs.") // 1 hr = 1 turn
game.current_game_turn = game.current_game_turn + 8
</script>
</command>
<command name="rest_command">
<pattern>rest</pattern>
<script>
game.previous_game_turn = game.current_game_turn
msg ("You rest for 4 hrs.") // 1 hr = 1 turn
game.current_game_turn = game.current_game_turn + 4
</script>
</command>
<command name="nap_command">
<pattern>nap</pattern>
<script>
game.previous_game_turn = game.current_game_turn
msg ("You nap for an hour.") // 1 hr = 1 turn
// the turnscript will advance the turn by 1, so you don't need to do it here
</script>
</command>
<turnscript name="global_turnscript">
<enabled />
<script>
if (player.current_life <= 0) {
msg ("You're dead or you've died.")
msg ("GAME OVER")
finish
} else if (game.game_advancement and game.current_game_turn = game.previous_game_turn) {
game.current_game_turn = game.current_game_turn + 1
} else if (not game.game_advancement) {
game.game_advancement = true
}
</script>
</turnscript>
Neonayon wrote:But I still don't know how to skip a single global turn. I don't really need a new turn-script or attribute because I just need the universal turn-script to pause in one specific instance like entering a new room and then resuming once the player is inside. To prevent enemies from instantly attacking.
Would it be something like...
game.turnscript = game.turnscript = 0
or something?
Also, appreciate you both: Xan and HK for chiming in so far!
UPDATE:
Actually, this...
game.turnscript = game.turnscript + 1 from Pix's code is causing arithmetic errors @_@
if (not game.turn_flag) { // if (not game.turn_flag = true) // if (not true) // if (false) // aka: not a real/active turn
show menu ("You cautiously enter the room, noticing it filled with webbing... and you spot a giant spider in the upper left corner... luckily, it hasn't seen you yet, giving you enough time to decide what to do...", split ("back out of the room very carefully; use your lit torch to ignite the webbing; etc etc etc", ";"), false) {
switch (result) {
case ("back out of the room very carefully") {
msg ("As you try to move carefully back out of the room, unfortunately a part of your body touches a web strand, sending vibrations to the giant spider, which with surprising speed is right behind you as you run into the previous room... FIGHT and win... or get eaten...")
invoke (spider.fight_script_attribute)
}
case ("use your lit torch to ignite the webbing") {
msg ("Despite that the giant spider would have probably eaten you, you feel terrible as you watch the spider burn alive, screaming just as if it were human being burnt alive. You shudder at the cruelty posed by the situation you found yourself in, though you are glad that you're the one alive...")
}
// etc etc etc
}
} else { // if (not game.turn_flag = false) //if (not false) // if (true) // aka: a real/active turn
msg ("You cautiously enter the room, noticing it filled with webbing... and you spot a giant spider in the upper left corner... unfortunately, it sees you too...")
invoke (spider.fight_script_attribute)
}
if (not game.notarealturn) {
game.turncount = game.turncount + 1
}
game.notarealturn = false
if (GetBoolean(object, "hidechildren")) {
object.hidechildren = false
}
if (TypeOf(object, "look") = "script") {
do (object, "look")
}
else {
lookdesc = ""
if (HasString(object, "look")) {
lookdesc = object.look
}
if (LengthOf(lookdesc) = 0) {
lookdesc = Template("DefaultObjectDescription")
}
if (GetBoolean(object, "switchedon")) {
if (HasString(object, "switchedondesc")) {
lookdesc = lookdesc + " " + object.switchedondesc
}
}
else {
if (HasString(object, "switchedoffdesc")) {
lookdesc = lookdesc + " " + object.switchedoffdesc
}
}
isDark = CheckDarkness()
if (isDark and not GetBoolean(object, "lightsource")) {
lookdesc = DynamicTemplate("LookAtDarkness", object)
}
msg (lookdesc)
}
ListObjectContents (object)
game.notarealturn = True
ShowRoomDescription
game.notarealturn = True
foreach (o, GetDirectChildren(player.parent)) {
if (GetBoolean(o, "attacking_player")) {
if (o.health > 1) {
do (o, "attackplayer")
}
}
}
game.notarealturn = True
if (GetBoolean(object, "hidechildren")) {
object.hidechildren = false
}
if (TypeOf(object, "look") = "script") {
do (object, "look")
}
else {
lookdesc = ""
if (HasString(object, "look")) {
lookdesc = object.look
}
if (LengthOf(lookdesc) = 0) {
lookdesc = Template("DefaultObjectDescription")
}
if (GetBoolean(object, "switchedon")) {
if (HasString(object, "switchedondesc")) {
lookdesc = lookdesc + " " + object.switchedondesc
}
}
else {
if (HasString(object, "switchedoffdesc")) {
lookdesc = lookdesc + " " + object.switchedoffdesc
}
}
isDark = CheckDarkness()
if (isDark and not GetBoolean(object, "lightsource")) {
lookdesc = DynamicTemplate("LookAtDarkness", object)
}
msg (lookdesc)
}
ListObjectContents (object)
game.notarealturn = True
ShowRoomDescription
foreach (o, GetDirectChildren(player.parent)) {
if (GetBoolean(o, "attacking_player")) {
if (o.health > 1) {
if (game.notarealturn) {
do (o, "attackplayer")
}
// since this is a Turnscript, it'll keep checking/running, and thus, if/when 'game.notarealturn = true', the enemy will attack, and if/when 'game.notarealturn = false', the enemy will not attack.
}
}
}
<game name="xxx">
</game>
// the 'game' Object, is just added to show that the Turnscript below is a global Turnscript, and not a local Turnscript for a specific room
<turnscript name="xxx">
<enabled />
<script>
if (not game.notarealturn) {
game.turn = game.turn + 1 // or whatever is your Integer Attribute's name/label for your turns
}
game.notarealturn = false
</script>
</turnscript>
Neonayon wrote:Yup. I did all of that already, but when I type "look" and "x me" the enemies still attack.