Knuckle Cracker

Creeper World 3 => The Coder's Corner => Topic started by: Courtesy on September 28, 2014, 06:40:20 AM

Title: Creating a core that eliminates pausing.
Post by: Courtesy on September 28, 2014, 06:40:20 AM
I can't seem to get this down. I've been working on it for like half an hour, and it felt like such an easy thing, so I'm wondering what argument I'm entering wrong or something, since it all compiles.

I currently have this

# no pause.crpl
# Created on: 9/28/2014 3:15:37 AM
# ------------------------------------------
# Unpauses the game if currently paused
:awake
OperateWhilePaused TRUE

do
IsPaused if TRUE
return UnpauseGame endif

loop


_________

OperateWhilePauses(TRUE) is another way I've had the top line written before.
Title: Re: Creating a core that eliminates pausing.
Post by: knucracker on September 28, 2014, 10:17:08 AM
You have a whole lot of errors there.  Arguments order, no args on 'do', no need for a do loop, everything is part of the "Awake" function, etc...  Below is a script that should work.  Note the use of parentheses and that the Awake function is at the bottom.  (--edit-- see the post below this one for a better explanation of the problems and an identical script that doesn't use warp operators)


if (IsPaused)
  UnpauseGame
endif

:awake
  OperateWhilePaused(TRUE)

Title: Re: Creating a core that eliminates pausing.
Post by: ParkourPenguin on September 28, 2014, 10:18:29 AM
There are a few things wrong with that code:

I believe that's about it. Here's a version of that script that should work:
# no pause.crpl
# Created on: 9/28/2014 3:15:37 AM
# ------------------------------------------
# Unpauses the game if currently paused
IsPaused if
UnpauseGame
endif

:awake
True OperateWhilePaused
Title: Re: Creating a core that eliminates pausing.
Post by: Courtesy on September 28, 2014, 11:30:53 AM
It's kinda good to know I had it right the first time, several renditions ago. I started adding other variables like the "true" to if because I started trying to interpret the code differently.
So like I knew that it was checking for if it was paused: if it was paused, a variable comes back "True", so I thought 'maybe it's not working because I didn't tell the If that it's looking for a True", so I set that. It compiled, so I thought it might be right, but then, nope.

Turns out, initially, the only thing I'd done wrong is not knowing that the :awake: commands needed to be at the bottom. I didn't know they affected every line/made all lines only occur once. Even if it did, I thought a loop would fix that. Thanks, sorry for being dumb with code, but thanks for all the patience you give me ^^