Post new topic    
King Slime
Send private message
Passwords! 
 PostFri Jun 08, 2012 2:46 am
Send private message Reply with quote
I need help making a passworded box.

Code:
plotscript, newgame password, begin
   time loop := false
   suspend player
   
   $3 = "BONUS"
   input string(2,5)
   
   if (string compare(2,3) == true) then (
   show text box(278)
   wait for text box
   
   )
   
   show text box(277)
   wait for text box
   resume player
   time loop := true
   end


It compiles, but the string is permanently stuck on screen and the string compare won't come up true.
Metal King Slime
Send private message
 
 PostFri Jun 08, 2012 3:05 am
Send private message Reply with quote
That the string isn't hidden after "input string" is actually a bug that's fixed in currently nightlies. You can just add "hide string (2)" after it as a workaround.

I don't know why the string doesn't compare as equal. You can try adding
Code:

$4="'"
4 $+ 3
$4+"'"
show string(4)

after "input string" to cause it to show entered password in the bottom corner of the screen. Then you can check that the string you entered actually registered displays as 'BONUS' (with the apostrophes, but without any extra whitespace or anything).
King Slime
Send private message
 
 PostFri Jun 08, 2012 3:17 am
Send private message Reply with quote
I checked, and it does display as 'BONUS'.
Super Slime
Send private message
 
 PostFri Jun 08, 2012 3:53 am
Send private message Reply with quote
Try changing the line from 4 $+ 3 to 4 $+ 2.
Mega Tact v1.1
Super Penguin Chef
Wizard Blocks
Metal King Slime
Send private message
 
 PostFri Jun 08, 2012 6:32 am
Send private message Reply with quote
Oh! I just remembered another bug that's been fixed in Alectormancy: stringcompare used to return -1 instead of 1 on equality. As a workaround, get rid of the "== true". It's bad practice to write that anyway (partially because there may be more commands with that bug -- we never checked all of them -- and partially because a command might be documented to return some other value without you realising).
Display posts from previous: