Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Reassinging Constant Statements...
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
sensfan




PostPosted: Fri Dec 09, 2005 11:54 am   Post subject: Reassinging Constant Statements...

I really dont know how to word this so bear with me:

Basically I want to reassign the following statement:

locatexy (271,220)
const message:="...Loading..."
for i:1..length (message)
colour (yellow)
put message (i) ..
end for

To say "Game Loaded" at the same location.

if timee > (3000) then
locatexy (271,220)
const mes:="Game Loaded"
for i:1..length (mes)
colour (yellow)
put mes (i) ..
end for
end if

Can you delete the text from the first constant and replace it with the new text at the same location? Does anyone know what I'm trying to do?
Sponsor
Sponsor
Sponsor
sponsor
MysticVegeta




PostPosted: Fri Dec 09, 2005 12:04 pm   Post subject: (No subject)

hmm. why not use vars?
do_pete




PostPosted: Fri Dec 09, 2005 12:50 pm   Post subject: (No subject)

The whole point of constants is that they remain constant so you can't change the value
Tony




PostPosted: Fri Dec 09, 2005 12:50 pm   Post subject: (No subject)

well a much better question would be:
code:

 if timee > (3000) then
locatexy (271,220)
const mes:="Game Loaded"

How do you know that your game has loaded in precisely 3 seconds?

Otherwise you could locate your constant in your memory, and overwrite the binary data at that location. Though variables are indeed much simpler (and safer) to use.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
codemage




PostPosted: Fri Dec 09, 2005 1:19 pm   Post subject: (No subject)

I've never quite understood the compulsion that drives early CompSci students to make the user wait for loading screens that don't actually load anything.
sensfan




PostPosted: Fri Dec 09, 2005 1:38 pm   Post subject: (No subject)

I didn't even intend to make a loading screen. And indeed it doesn't actually load anything. I was just playing around - but I figured I might as well see if I can't get it to do something.
md




PostPosted: Fri Dec 09, 2005 1:41 pm   Post subject: (No subject)

Tony wrote:
well a much better question would be:
code:

 if timee > (3000) then
locatexy (271,220)
const mes:="Game Loaded"

How do you know that your game has loaded in precisely 3 seconds?

Otherwise you could locate your constant in your memory, and overwrite the binary data at that location. Though variables are indeed much simpler (and safer) to use.

That assumes that the constant is actually stored. When it's a constant it's easiest to just optimize it out of memory entirely Wink
Tony




PostPosted: Fri Dec 09, 2005 3:26 pm   Post subject: (No subject)

Turing stores constants in memory. Memory location can be writen over.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 8 Posts ]
Jump to:   


Style:  
Search: