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

[SOLVED] Access to recently set global in after battle

 
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP!
View previous topic :: View next topic  
Author Message
chronoboy
Into the past with a splash




Joined: 04 Jun 2010
Posts: 162
Location: Canada

PostPosted: Wed Oct 13, 2010 2:25 pm    Post subject: [SOLVED] Access to recently set global in after battle Reply with quote

Not sure if this is a bug or not, or how it's just suppose to work:
Code:

global variable (1,battle ref)

plotscript, formation fight,arg,npcref begin
  battle ref := npcref
  fight formation (1)
end

plotscript, after battle, begin
  if (battle ref >> 0) then (do something with npcref)
  Code to fade music back in...
end


Okay, so for some reason, battle ref seems to always be 0 in my after battle script, even though I set it before I fight the formation.

I previously had my code to do something with my npcref right after my fight formation, but due to my new fade music in code, it seems to be delaying that code now. Since the after battle runs before it continues my other script, I thought I'd just add this code directly in the after battle script, as I'd be using it alot anyways when calling formations.

My workaround is going to be using a timer set to 0, but if the global variable is not working, then this may not work either as planned. Sad...

UPDATE: My proposed workaround is not working, the global variable is still not set. Unless an NPC reference is indeed under 0.

UPDATE 2: After using show value in the after battle script, it does appear that NPC references are indeed under 0. Odd, who would have thought!
_________________
Current project: Chronoboy Adventures

Website: http://www.chronoboy.com/
Back to top
View user's profile Send private message Visit poster's website
Bob the Hamster
OHRRPGCE Developer




Joined: 22 Feb 2003
Posts: 2526
Location: Hamster Republic (Southern California Enclave)

PostPosted: Wed Oct 13, 2010 2:56 pm    Post subject: Reply with quote

Yep. NPC references are always negative numbers.

That was my old hack to work around the fact that plotscripting doesn't support any kind of data typing. If I had made references positive, it would have been impossible to accurately tell the difference between an NPC ID and an NPC ref.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
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