Castle Paradox Forum Index Castle Paradox

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Gamelist   Review List   Song List   All Journals   Site Stats   Search Gamelist   IRC Chat Room

NO LONGER is this almost certainly a bug

 
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP!
View previous topic :: View next topic  
Author Message
Bagne
ALL YOUR NUDIBRANCH ARE BELONG TO GASTROPODA




Joined: 19 Feb 2003
Posts: 518
Location: Halifax

PostPosted: Thu Dec 03, 2009 8:34 pm    Post subject: NO LONGER is this almost certainly a bug Reply with quote

Ok, I've got a "write global" command that isn't working. This is really weird, so brace yourselves.

I was debugging a script with the "show value" command. I narrowed the problem down to a single line - the middle one shown here:
Code:
show value (read global (WaddiSwitch+which))
wait for key (any key)
write global (WaddiSwitch + which, 1)
show value (read global (WaddiSwitch+which))
wait for key( any key)
show no value


The write command is not working.
The global that's being read/written was initialized at a value of zero, but when I look at the value being displayed in the corner of the screen, I find that it remains unchanged from "0" after I set it to "1".

Even wierder:
If I run this script a second time (I talk to an NPC again), everything functions normally, and I'm unable to reproduce the bug.

Even wierderer:
Reassigning the value of "which" (it's an NPC argument) allows everything to function normally.

Wiererdest:
I found that when WaddiSwitch = 1 and which = 0 that the bug occurs, but not when WaddiSwitch = 0 and which = 1.
It's not the value of the sum of the terms that matters, it's the value of "which" that seems to trigger this bug.

Yeah, "which" is an NPC argument and "WaddiSwitch" is a global.

So ... What-The-Thunderchunk could possibly be going on?

I'm making a copy of this RPG file and the scripts. Maybe I can enshrine it, and the spirits possessing it might grant me a wish.
_________________
Working on rain and cloud formation


Last edited by Bagne on Fri Dec 04, 2009 10:56 am; edited 1 time in total
Back to top
View user's profile Send private message
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Thu Dec 03, 2009 8:49 pm    Post subject: Reply with quote

I hope you are using at least Xocolatl+2, because of this bugfix in X+2:
Code:
    * Bug 698: Global variables 1025-4095 couldn't be set [Ralph]


What is the ID number of WaddiSwitch? You were slightly unclear, but I'd guess it's ID 1.

Realise that if you're trying to create an array of globals where WaddiSwitch is the first item in the array, you'd want to write "@WaddiSwitch" instead of "WaddiSwitch".

It's possible that there's a bug involved, but aside from the bug mentioned, I think it's terribly unlikely.
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
Bagne
ALL YOUR NUDIBRANCH ARE BELONG TO GASTROPODA




Joined: 19 Feb 2003
Posts: 518
Location: Halifax

PostPosted: Thu Dec 03, 2009 9:13 pm    Post subject: Reply with quote

I'm using the nightly.
I'm also using high ID globals (3000 - 4000ish) for other stuff, and they're working fine.


This is what I did:

Code:
global variable (0,WaddiSwitch)
global variable (1,WaddiSwitch_arr) # Reserve 30 of these


and in my "beginning" script I initialized
Code:

WaddiSwitch := 1
write global (WaddiSwitch + 0, 0)
write global (WaddiSwitch + 1, 0)
...
write global (WaddiSwitch + 29, 0)


So, WaddiSwitch is global ID 0, and is set to 1.

I didn't know about this @ syntax ... and maybe my method's clumsy, but it works. I got it to work for a bunch of other scripts.
_________________
Working on rain and cloud formation
Back to top
View user's profile Send private message
ShakeyAir




Joined: 27 Apr 2004
Posts: 93

PostPosted: Thu Dec 03, 2009 9:35 pm    Post subject: Reply with quote

i have had random issues with global variable 0. i got a couple of errors while working on tetris when i had my array start at global variable ID 0. i just assumed it was causing some odd computation somewhere. i switched to starting the array at global ID 1, and honestly, in every subsequent script, i just havent made a global variable 0.
Back to top
View user's profile Send private message
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Thu Dec 03, 2009 9:46 pm    Post subject: Reply with quote

Yes, I'm guessing that you are accidentally overwriting the value of global variable 0 somewhere. It could be because 0 is usually returned from script commands when an error occurs, so there might be unintended 0's flying about.

You can check the values of all global variables in the script debugger if you want to (without having to comprehend the rest of debugger). Press F10 twice, then V twice. Scroll up and down with + and -.

'@global variable name' is the id number of a global variable - it's a constant automatically created for you.
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
Bagne
ALL YOUR NUDIBRANCH ARE BELONG TO GASTROPODA




Joined: 19 Feb 2003
Posts: 518
Location: Halifax

PostPosted: Fri Dec 04, 2009 4:58 am    Post subject: Reply with quote

Ok, well I have quarantined a copy of my .rpg file in case anyone wants to see it (now or in the future).

I don't know if the "zeros flying about" was meant for me or ShakeyAir or both -
If meant for me, I don't see how this could apply in my case. The code I initially posted was verbatim. Nothing happens between the "write global" and the "show value". There are no functions being called or anything.

Also, following your instructions, I can see the global's state in the debugger, and it's clear that when I start my game, the "write global" doesn't work the first time my script is called. After that, it's fine.

Should I report this, or is it too vague?
_________________
Working on rain and cloud formation
Back to top
View user's profile Send private message
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Fri Dec 04, 2009 8:04 am    Post subject: Reply with quote

Was directed at both of you. I meant that perhaps WaddiSwitch is accidentally getting set to 0 sometime between the 'beginning' script and that one.

You can email me a copy of your game and scripts if you want, and I'm sure I'll be able to tell you what's going on within a couple minutes.
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
Bagne
ALL YOUR NUDIBRANCH ARE BELONG TO GASTROPODA




Joined: 19 Feb 2003
Posts: 518
Location: Halifax

PostPosted: Fri Dec 04, 2009 10:52 am    Post subject: Reply with quote

Ooooh. I see.
You're right, that's exactly what happened.
When you start the game, WaddiSwitch is set to 1, and then some obsolete code set it back to 0 :-(

Man - that's so confusing! I was accidentally looking at two globals (ID 0 and ID 1) and not one ... and it's entirely by coincidence that WaddiSwitch should get reset to the proper value when it's first used.

Thanks.

Shoot - I wanted to show you my game :-P
I was getting excited at the idea of someone else playing it.
Maybe I should just post it, despite the fact that it only so far contains vague puzzles with unidentified objectives.
_________________
Working on rain and cloud formation
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP! All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group