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.

Newcomers DBPro Corner / is it possible to make a type within a function

Author
Message
fllwthewolves
13
Years of Service
User Offline
Joined: 4th Sep 2011
Location:
Posted: 3rd Nov 2011 06:42 Edited at: 3rd Nov 2011 07:21
is it possible to make a type within a function?
i was trying to make a function i could put in a header file that would make it easier to make clickable buttons.

heres what i tried:





but i get the error:
Quote: "
Declaration is not valid at line 21.
"


keep in mind im not done with it yet, but i was wondering if its even possible to make a type inside a function.


edit:tried it a diffrent way still diddnt work:




gave me error message "Could not understand command at line 21."
anybody care to shed some light?
Darkzombies
13
Years of Service
User Offline
Joined: 25th Dec 2010
Location: In multiple tabs, most likely youtube.
Posted: 3rd Nov 2011 07:33 Edited at: 3rd Nov 2011 07:36
No. But there's no reason to anyway. Make your types at the beginning of your code or in a subroutine.

Also "Butt_Text" is probably better named as "Button_Text" (You don't want to cause some akward conversations, do you lol.)

fllwthewolves
13
Years of Service
User Offline
Joined: 4th Sep 2011
Location:
Posted: 3rd Nov 2011 07:54
well the idea is to make a single command i can put in a header file for my games so i dont have to type out a button command everytime.

also i see your point. maybe i will save butt_text for the words on a girls sweatpants in my game then.
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 3rd Nov 2011 10:08 Edited at: 3rd Nov 2011 10:10
Quote: "gave me error message "Could not understand command at line 21.""


You had the right idea. The BOX command doesn't need parenthesis.

What you have:


What it should be:


Just changing that does work but you won't see it because you keep clearing the screen and writing bright white text over a box that's bright white. You can change the color with the INK command so you can see it actually working.




Quote: "is it possible to make a type within a function?"


It would work if you took that UDT and array out of the function and put it at the top of your code. This also shows the dangers of using names that are too long.



fllwthewolves
13
Years of Service
User Offline
Joined: 4th Sep 2011
Location:
Posted: 3rd Nov 2011 21:05
doh. ok thanks for pointing that out i dont know how i missed it.

but i also realized that i was way over complicating things for all intensive purposes. heres my finished function:




its not pretty but i found it very useful for when i was just playing around with ideas.

Login to post a reply

Server time is: 2024-11-24 00:59:31
Your offset time is: 2024-11-24 00:59:31