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 / functions malfunctions

Author
Message
TKD guy
18
Years of Service
User Offline
Joined: 18th Feb 2006
Location:
Posted: 6th Apr 2007 05:15 Edited at: 6th Apr 2007 05:16
ok, here's a quick, simple funtion that is just designed to make x# equal to one.



...But, here's the thing. My screen always returns a zero as a value for x#. Could this be a bug, because I'm stumped. Even better, could someone send me a SHORT code with a simple function in it and tell me what it does on your computer so i can see if it works on mine?
Slayer93
20
Years of Service
User Offline
Joined: 5th Aug 2004
Location: I wish I knew
Posted: 6th Apr 2007 05:23
When you use variables in functions they are local to only the functions meaning x# equals 1 in the function but not in the entire program. You would have to either global x# by doing something like global x# or use an array which are always global.

Also the # means float and you don't need it if your not going to use floats and only integers.

Hope that explains things

Current Projects - Zio Engine: RPG Engine and OMMO

TKD guy
18
Years of Service
User Offline
Joined: 18th Feb 2006
Location:
Posted: 6th Apr 2007 06:11
thanks slayer!

I used this code...



...and it works perfectly!
Zergei
19
Years of Service
User Offline
Joined: 9th Feb 2005
Location: Everywhere
Posted: 6th Apr 2007 06:41
Or you could do it like this...



Further on my stuff at...

Login to post a reply

Server time is: 2024-09-25 21:29:50
Your offset time is: 2024-09-25 21:29:50