variable shall be set to be = another variable

Make games! Discuss those games here.

Moderators: Bob the Hamster, marionline, SDHawk

Post Reply
User avatar
marionline
Metal Slime
Posts: 673
Joined: Sat Feb 26, 2011 9:23 pm

variable shall be set to be = another variable

Post by marionline »

Hello,
in the following script, I want to set the variable current day equal to system day.
But wether I write "currentday == system day " or "currentday = system day" the compiler does not accept it.
Is there another command to set two variables equal?

Thanks for your help in advance. :)

Code: Select all

script, determine day, begin
#global variables: set at the beginning of the script collection
#weekday: 
## 1 = monday
## 2 = tuesday
## 3 = wednesday
## 4 = thursday
## 5 = friday
## 6 = saturday	
## 7 = sunday
## , tuesday, ect.
#current day # the day from 1 to 31, checks if this number changes, because if it does weekday has to be changes

if &#40;system day <> currentday&#41; 
then 
	&#40;
	switch &#40;weekday&#41;, do 
		&#40;
		case  &#40;1&#41; , do # Monday  
			&#40;
			weekday == 2 #Tuesday
			currentday = system day 
			&#41;
		case  &#40;2&#41;, do  	
			&#40;
			weekday == 3 #Wednesday
			currentday = system day 
			&#41;
		case  &#40;3&#41;, do
  			&#40;
			weekday == 4 #Thursday
			currentday == system day 
			&#41;
		case  &#40;4&#41;, do    		
			&#40;
			weekday == 5 #Friday
			currentday == system day 
			&#41;			
		case  &#40;5&#41;, do
	   		&#40;
			weekday == 6 #Saturday
			currentday == system day 
			&#41; 
		case  &#40;6&#41;, do 		
			&#40;
			weekday == 7 #Sunday
			currentday == system day 
			&#41;   
		case  &#40;7&#41;, do  #Saturday to Sunday
	 		&#40;
			weekday == 1 #Monday
			currentday == system day 
			&#41;# Sunday to Monday
	&#41;	
&#41;
end
User avatar
Gizmog
Metal King Slime
Posts: 2614
Joined: Tue Feb 19, 2008 5:41 am

Post by Gizmog »

Current day == system day is a question, not a declaration. I think what you're trying to do is tell it something, so you'd want to use

Code: Select all

current day &#58;= systemday
Which would set a variable you had previously defined as "currentday" to the value returned by the "systemday" function.

I'm not sure what you're trying to do with Weekday == 2, 3, etc. in the same script, since the switch statement is already asking that. You can probably just get rid of that line. [/code]
Post Reply