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] get debug keys disable

 
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 6:39 am    Post subject: [SOLVED] get debug keys disable Reply with quote

I noticed that there is a "set debug keys disable" plotscript command, I also checked in the HSD file to see if a "get" was defined but not in the dictionary. There is not.

However, "set debug keys disable" does does nifty "set general", would someone be-able to post how I would make a "get debug keys disable" command using "get general".

I will be using such a feature to for example, "bypass" the intro cut scene and other cut scenes if the debug keys are enabled, to make debugging a game easier. It will also enable other features in the game meant for debugging, of which do not need to be there during distribution.

Thanks.
P.S. In the next version of OHR could you kindly have this plotscript command added to the PLOTSCR.HSD file as "set debug keys disable" is already there.
_________________
Current project: Chronoboy Adventures

Website: http://www.chronoboy.com/


Last edited by chronoboy on Wed Oct 13, 2010 10:22 am; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
chronoboy
Into the past with a splash




Joined: 04 Jun 2010
Posts: 162
Location: Canada

PostPosted: Wed Oct 13, 2010 9:14 am    Post subject: Reply with quote

This is all I could come up with:
Code:
script, get debug keys disable, begin
  if (read general(101)==6402) (return (1)) else (return (0))
end


I know there is a neater way of doing it using or and and perhaps. This will conflict with other gen() configurations... I'll see if I can make a better version and edit this reply.

UPDATE: For some reason, return (read general(101),and,32511) is always returning 6146 regardless if the bit is set or not. An issue with my code, or does return not parse and code?

UPDATE 2:
Code:
script, get debug keys disable, begin
  if (read general(101),and,32511) then (return (1)) else (return (0))
end

Always returns 1, I maybe getting closing... Hopefully.

UPDATE 3: Well, I tried swapping the 32511 with 32767, and 32766 in the code above and it still returned 1. Then I swapped it with 32768 and it returned 0. At this point, I thought I got it, but alas, when I updated the bitset in CUSTOM.EXE and reran the game, it still returned 0. Is it even possible to obtain the bitsets from plotscript, or does plotscript lack binary math? Currently my only workaround is to use my first iteration of the code and modify it for each specific game depending on their bitsets. Since it will only check the bitset once(when new game and load game scripts run), this work fine.

UPDATE 4:
Code:
script, get debug keys disable, begin
  if (read general(101),and,2^256) then (return (1)) else (return (0))
end

Even this fails to work meaningfully. I have been looking at the menu item bitset code in the HSD file to see if I can shed some light on this voodoo bitset magic. imao. At least I'm trying right?[/b]
_________________
Current project: Chronoboy Adventures

Website: http://www.chronoboy.com/
Back to top
View user's profile Send private message Visit poster's website
chronoboy
Into the past with a splash




Joined: 04 Jun 2010
Posts: 162
Location: Canada

PostPosted: Wed Oct 13, 2010 10:21 am    Post subject: SOLVED! Reply with quote

Final working code:
Code:
script, get debug keys disable, begin
  if ((read general(101),or,32511)==32767) then (return (1)) else (return (0))
end

Example usage:
Code:
variable (oldbit)
oldbit := get debug keys disable
set debug keys disable (0)
... Do something that needs debug keys enabled ...
set debug keys disable (oldbit)


Preferably, I am using this script to enable an in-game debug menu and such to assist in debugging many aspects of an RPG Game. In the new-game and load-game routines, one can set or unset a tag to show a new menu item in the main menu. Happy
_________________
Current project: Chronoboy Adventures

Website: http://www.chronoboy.com/
Back to top
View user's profile Send private message Visit poster's website
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Thu Oct 14, 2010 2:48 am    Post subject: Reply with quote

Well, that works, but it's not the most straight-forward way to check the bit:

Code:
script,get debug keys disable,begin
  return ((read general(101),and,256) <> 0)
end


Now that I look at those scripts in plotscr.hsd I notice that they are all technically wrong! All those 'set' scripts clear the 16th bit in gen(101)! Luckily the 16th bit is "Default passability disabled by default," which has absolutely no effect in-game. A lucky save.

and, or, xor are bitwise operators (inherited from QuickBASIC), &&, || are the logical 'and' and 'or' operators.

Quote:
I will be using such a feature to for example, "bypass" the intro cut scene and other cut scenes if the debug keys are enabled, to make debugging a game easier.


That sounds like a good enough reason to add it.
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
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