Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
Sixty Squares
17
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 7th Jul 2006 14:43 Edited at: 8th Jul 2006 15:33
POST MOVED TO:My Functions

My Functions: Mine
Post yours: Post
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 7th Jul 2006 15:49 Edited at: 7th Jul 2006 15:49
I think you'll find these are already built in commands

Good job anyway

[edit]

Wait, some are! I didn't see them all

Nicholas Thompson
19
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 7th Jul 2006 16:27
Nice idea - you could improve the efficiency of the FPS camera by using the "else" command. If the flag IS zero, then why bother checking for 1 and 2?

[center]
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 7th Jul 2006 18:51
As Nick says.

Another neat way would be the select/case structure:

select FLAG
case 0
...
endcase
case 1
...
endcase
case 2
endcase
case default (if you need it)
...
endcase
endselect
Sixty Squares
17
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 8th Jul 2006 00:12 Edited at: 8th Jul 2006 00:33
@Zotoaster: Thanks. Oh, and the Control object using arrowkeys(I think that's the one you meant) actually is NOT a command! It's so annoying! There's a Control camera using arrowkeys, but no control object using arrowkeys. Weird...

@Everybody else: Yeah... I'm not really the most organized programmer out there...

@Nicholas: Thanks. Could you provide an example?

@Green: Thanks as well But Whenever I use the select and case statements, something goes wrong! I can never get them right... But why is my way not neat? I see no differance in how one is better than the other.

Blah Blah Blah Blah Blah Blah... Okay I'm done.
GALACTUS
20
Years of Service
User Offline
Joined: 24th Apr 2004
Location:
Posted: 8th Jul 2006 02:22
I'll give these a shot:

Control Object Using Arrowkeys

Third Person Camera


Yeah, there are no commands for these and I'll add that this helps us newbies a lot, so thanks much for your generosity.

?..?..?..?
Sixty Squares
17
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 8th Jul 2006 03:09 Edited at: 8th Jul 2006 03:14
Glad to help Just making shortcuts. If you ever wonder how any of the functions made by me works, just ask It may be helpful later on to understand how these functions work.

Blah Blah Blah Blah Blah Blah... Okay I'm done.
Sixty Squares
17
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 8th Jul 2006 04:33 Edited at: 8th Jul 2006 04:49
umm... Does anybody want to post a function?

Blah Blah blah Blah Blah Blah... Okay I'm done.
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 8th Jul 2006 09:03
Here's a 'Debug' function that I have been using for our Open Source RPG. It comes in really handy for large programs when you have programmed in a lot of catch-all type code to prevent annoying crashes. For example, instead of simply loading an Object into your game, you would probably want to make sure the game doesn't crash just because an object is missing. So you write some code like this:



Eventaully, all your code is smooth working like this little snippet, but something is going wrong in your code (maybe even on someone else's pc). How do you find it? Debug mode won't work and stepping through the 20k lines of code and 1000's of loops will send anyone to the loony bin. Well, this is where this little snippet comes in handy. It reports all the little errors that you don't want crashing your code, but might need to know about.

The Debug function opens up a text file called Debug.txt and write any error messages you want to it. I can tell you, that as I add this function into the RPG code, it is making life easier. It can either be added in as a permanent debug, or a temporary one. Here's the code:



And here's the little snippet from above with the Debug functionality added in.




Open MMORPG: It's your game!
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 8th Jul 2006 09:14 Edited at: 8th Jul 2006 09:15
This little usefull function allows you to capture a keystroke without the key repeating. It work for any key, as long as you have the scancode (included).



And here is a lot of the most common key scancodes stored as Constants for easy access. The constants reference the keys as follows:

Constant = Key
sc1 = [1]
sc2 = [2]
sca = [a]
scb = [[u][/u]b]

So, for the letter "u", use "scu". Pretty straight forward.




Open MMORPG: It's your game!
Sixty Squares
17
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 8th Jul 2006 12:46 Edited at: 8th Jul 2006 14:09
Yay! I like your keystroke function RiiDii! (Haha I'm not advanced enough to understand the others ) But I do like the keystroke one.

(Okay in my sig I've added a place to post functions, I'd actually rather that this be a place to comment on mine. (sorry if this seems rude.)

My Functions: Mine
Post yours: Post
Scraggle
Moderator
20
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 8th Jul 2006 14:16
Some of these functions are interesting, but can we all say 'Code Snippets Board'?


Sixty Squares
17
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 8th Jul 2006 14:22
lol fine, i'll move this there if you like...

My Functions: Mine
Post yours: Post

Login to post a reply

Server time is: 2024-05-09 17:08:28
Your offset time is: 2024-05-09 17:08:28