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

Switch statements

 
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP!
View previous topic :: View next topic  
Author Message
JSH357




Joined: 02 Feb 2003
Posts: 1705

PostPosted: Tue Sep 04, 2007 6:26 pm    Post subject: Switch statements Reply with quote

This is more of a question for the OHR programmers.

Will there ever be any implementation of a switch/case statement (C++ one is the only one I'm familiar with)? It would make several things a LOT easier for me, fo sho. If not--I'm just curious--why wouldn't it be implementable?
Back to top
View user's profile Send private message Send e-mail Visit poster's website
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Tue Sep 04, 2007 8:00 pm    Post subject: Reply with quote

There already is. As example, here's a script from Eldardeen:

Code:
script, dir X, dir, begin
  switch (dir) do (
    case (up, down) do (return (0))
    case (right) do (return (1))
    case (left) do (return (-1))
  )
end


You can also use continue inside a case block, causing it to fall through (well actually, jump) to the next one.
(Actually, you don't have to put constants in the case() arguments, you can put expressions there, which is undocumented, and weird. Doing this would (when I get round to it) mean losing a large speed increase though. Still faster than lots of if's)
_________________
"It is so great it is insanely great."


Last edited by TMC on Tue Sep 04, 2007 8:10 pm; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail
JSH357




Joined: 02 Feb 2003
Posts: 1705

PostPosted: Tue Sep 04, 2007 8:04 pm    Post subject: Reply with quote

What the heck? When did this come in?
Back to top
View user's profile Send private message Send e-mail Visit poster's website
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Tue Sep 04, 2007 8:23 pm    Post subject: Reply with quote

11th June 2006.

I actually implemented it before hasta-la-qb was released, in the wip branch. Hasta-la-qb forked from tirgoviste, missing out on any new features since then. (Incidently, this is also the reason hasta was so buggy: pretty much none of the devs ever used it, and also the reason Ubersetzung has so many new features). And that's why you've been missing out for so many years.
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
Moogle1
Scourge of the Seas
Halloween 2006 Creativity Winner
Halloween 2006 Creativity Winner



Joined: 15 Jul 2004
Posts: 3377
Location: Seattle, WA

PostPosted: Tue Sep 04, 2007 8:52 pm    Post subject: Reply with quote

This is JSH, who didn't know you could right-click or press ENTER to eyedrop a color.

Yes, I'm still going to be laughing about that for awhile yet.
_________________
Back to top
View user's profile Send private message Visit poster's website AIM Address
JSH357




Joined: 02 Feb 2003
Posts: 1705

PostPosted: Tue Sep 04, 2007 9:07 pm    Post subject: Reply with quote

Hey, where is eyedropping documented? I'd say I had an excuse! It isn't obvious in CUSTOM, anyway. The switch statements weren't documented either.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Bob the Hamster
OHRRPGCE Developer




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

PostPosted: Tue Sep 04, 2007 9:30 pm    Post subject: Reply with quote

http://hamsterrepublic.com/ohrrpgce/index.php/Making_Walkabout_Graphics.html
http://hamsterrepublic.com/ohrrpgce/docs/plotdict.xml#about-switch

Where can we move and/or duplicate this stuff to make it easier to find?
Back to top
View user's profile Send private message Send e-mail Visit poster's website
JSH357




Joined: 02 Feb 2003
Posts: 1705

PostPosted: Tue Sep 04, 2007 9:42 pm    Post subject: Reply with quote

Well the eyedrop was a feature most people probably knew about but I, for some reason, never noticed. (You wouldn't believe all the time I wasted trying to guess which colors I had been using) I guess I never noticed it since it's a selectable tool in MS Paint but a keyboard tool in CUSTOM. (I rarely, if ever, discover keyboard functions on my own with no visual representation)

A lot of the nightly stuff is just totally hard to find. I can't find switches in the plotdictionary in my OHR folder, but as long as they're there in the new one, it shouldn't be a problem.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
msw188




Joined: 02 Jul 2003
Posts: 1041

PostPosted: Wed Sep 05, 2007 7:43 am    Post subject: Reply with quote

Heh heh, I didn't know about the CTRL+SPACE to bring up a text character picker for a while. I wasted so much time as well holding down alt and pressing all of the keys until I found the special character I wanted.
_________________
My first completed OHR game, Tales of the New World:
http://castleparadox.com/gamelist-display.php?game=161

This website link is for my funk/rock band, Euphonic Brew:
www.euphonicbrew.com
Back to top
View user's profile Send private message Visit poster's website
TwinHamster
♫ Furious souls, burn eternally! ♫




Joined: 07 Mar 2004
Posts: 1352

PostPosted: Wed Sep 05, 2007 8:51 am    Post subject: Reply with quote

Quote:
Heh heh, I didn't know about the CTRL+SPACE to bring up a text character picker for a while.

Copies into notes.
There really should be a hotkey list on the wiki.
Back to top
View user's profile Send private message Send e-mail AIM Address
Camdog




Joined: 08 Aug 2003
Posts: 606

PostPosted: Wed Sep 05, 2007 12:09 pm    Post subject: Reply with quote

I looked for the switch statement on the wiki (http://hamsterrepublic.com/ohrrpgce/index.php/Plotscripting_Dictionary.html#Flow_Control).

Seems like the switch statement should be under the flow control heading.

In fact... hey! That's a wiki! I'll just go ahead and do that myself.
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: Wed Sep 05, 2007 8:54 pm    Post subject: Reply with quote

The OHR is (or was, anyway) documented primarily in whatsnew. If you look in there, you'll find all of these things. But that's unrealistic. The HOWTO is the real documentation, but it doesn't cover everything. You'll find all the controls to the sprite and map editors there.

Yeah, the truth is, not everything is well documented. But things have greatly improved since the wiki. We still really need to finish this: 'Menu:Main Menu'. It'll document all of Custom, replacing the need to wade through the HOWTO. But there's just so much to write.

Camdog wrote:
I looked for the switch statement on the wiki (http://hamsterrepublic.com/ohrrpgce/index.php/Plotscripting_Dictionary.html#Flow_Control).

Seems like the switch statement should be under the flow control heading.

In fact... hey! That's a wiki! I'll just go ahead and do that myself.


A bot is meant to update all the plotdict pages. I don't know the details. I think it's Mike's, and maybe he needs to manually cause it to update everything (based on the xml file, which is stored in SVN). I'm also not sure whether changes by anyone else would get wiped.
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
Camdog




Joined: 08 Aug 2003
Posts: 606

PostPosted: Thu Sep 06, 2007 5:46 am    Post subject: Reply with quote

Well, that's cool. I just cut and pasted from the plotscript dictionary.
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