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
MateiSoft Romania
11
Years of Service
User Offline
Joined: 16th Oct 2013
Location:
Posted: 31st Dec 2013 14:57
Hello Community!

Does anyone know how can i do the following thing:

I want to make multiple lets say cubes by tapping the number "1" button. I know that i must increase(inc) the object. But i can't manage to operate the name assigned to inc (inc cbe) to object exist...
If object exist cbe then...bla bla...
It gives me an error...

Really appreciate all the previous answers and help and the current help!

Thank You!

Alex Matei CEO
www.alexmatei.com
Derek Darkly
13
Years of Service
User Offline
Joined: 22nd Sep 2011
Location: Whats Our Vector, Victor?
Posted: 31st Dec 2013 16:10 Edited at: 31st Dec 2013 16:14
???



D.D.
MateiSoft Romania
11
Years of Service
User Offline
Joined: 16th Oct 2013
Location:
Posted: 31st Dec 2013 16:53
Thanks for the response but i don't seem to get pass the error object illegal. Here's my code





Alex Matei CEO
www.alexmatei.com
Derek Darkly
13
Years of Service
User Offline
Joined: 22nd Sep 2011
Location: Whats Our Vector, Victor?
Posted: 31st Dec 2013 17:29 Edited at: 31st Dec 2013 17:32
Why do you have SHOW OBJECT 50?

I think that's the problem.... this would be called before there was an object number 50.

D.D.
MateiSoft Romania
11
Years of Service
User Offline
Joined: 16th Oct 2013
Location:
Posted: 31st Dec 2013 19:04
Sorry Derek Darkly...This was not the problem...

Alex Matei CEO
www.alexmatei.com
Derek Darkly
13
Years of Service
User Offline
Joined: 22nd Sep 2011
Location: Whats Our Vector, Victor?
Posted: 31st Dec 2013 22:48 Edited at: 31st Dec 2013 22:50
Quote: "Sorry Derek Darkly...This was not the problem..."


Here is your code above placed inside a loop... it works for me, how about you?



D.D.
MateiSoft Romania
11
Years of Service
User Offline
Joined: 16th Oct 2013
Location:
Posted: 1st Jan 2014 12:39
Yes this works...but the object exist command when incrementing the cube does not work...i think i am doing something wrong in the code

Alex Matei CEO
www.alexmatei.com
Derek Darkly
13
Years of Service
User Offline
Joined: 22nd Sep 2011
Location: Whats Our Vector, Victor?
Posted: 1st Jan 2014 16:52 Edited at: 1st Jan 2014 17:01
Quote: "Yes this works...but the object exist command when incrementing the cube does not work...i think i am doing something wrong in the code"


The snippet you posted before wasn't inside a loop, so I couldn't just run it and see the result. If you would, post a small sample code inside a loop with the object exist command that doesn't work for you.

I'm sure this issue has to be something minor.

Obviously you only want to MAKE OBJECT n if OBJECT EXIST(n)=0
and you'll only want to SHOW/HIDE/ROTATE/MOVE/etc. if OBJECT EXIST(n)=1

D.D.
MateiSoft Romania
11
Years of Service
User Offline
Joined: 16th Oct 2013
Location:
Posted: 2nd Jan 2014 01:09


Alex Matei CEO
www.alexmatei.com
Mobiius
Valued Member
22
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 2nd Jan 2014 02:05
Quote: "`When input is detected place cube
if keystate(2) = 1
inc 25
make object cube 25,25
`set object 25,1,4,1,0,1
show object 4
endif"

The bold italic line is a mistake. 25 is not a variable so cannot be incremented.

Since 25 is not a variable, you keep trying to add a new object with that number, which is also a mistake.

Derek Darkly
13
Years of Service
User Offline
Joined: 22nd Sep 2011
Location: Whats Our Vector, Victor?
Posted: 2nd Jan 2014 02:51 Edited at: 2nd Jan 2014 02:54
And there it is...

Yes, you'll want to replace

inc 25
make object cube 25,25


with something like

inc ObjNum,1 (the ',1' is optional - indicates the increment amount, the default is 1 anyway)
make object cube ObjNum,25

D.D.
MateiSoft Romania
11
Years of Service
User Offline
Joined: 16th Oct 2013
Location:
Posted: 2nd Jan 2014 13:21
I did....that worked yes...
And then it comes again to the first problem that i wanted to be resolved....If object exist(objnum) = 1 then blah blah blah...It gives me the same error with object illegal...Sorry if i am annoying but really the problem wasn't resolved

Alex Matei CEO
www.alexmatei.com
Derek Darkly
13
Years of Service
User Offline
Joined: 22nd Sep 2011
Location: Whats Our Vector, Victor?
Posted: 2nd Jan 2014 15:16 Edited at: 2nd Jan 2014 15:23
Quote: "If object exist(objnum) = 1 then blah blah blah...It gives me the same error with object illegal...Sorry if i am annoying but really the problem wasn't resolved
"


No problem...
Let's see your updated code snippet, and make sure you have replaced all of those "25" for object exist/make object/etc. with the ObjNum variable throughout the entire code.

D.D.
MateiSoft Romania
11
Years of Service
User Offline
Joined: 16th Oct 2013
Location:
Posted: 3rd Jan 2014 19:26


Alex Matei CEO
www.alexmatei.com
Mobiius
Valued Member
22
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 3rd Jan 2014 20:52
I've not ran this, but test it out...


Derek Darkly
13
Years of Service
User Offline
Joined: 22nd Sep 2011
Location: Whats Our Vector, Victor?
Posted: 3rd Jan 2014 21:30 Edited at: 3rd Jan 2014 21:32
@ Matei

I thought it was a little strange to see that you had your main loop inside a function...
I'm pretty sure that you want to call functions only when needed and then immediately return to the main loop.

Perhaps Mobiius can confirm/explain this better.

D.D.
MateiSoft Romania
11
Years of Service
User Offline
Joined: 16th Oct 2013
Location:
Posted: 4th Jan 2014 02:20
I tested out your code Mobiius and at the third press of the button to make a cube it says object already exist at line blah blah

It partially works

Alex Matei CEO
www.alexmatei.com
MateiSoft Romania
11
Years of Service
User Offline
Joined: 16th Oct 2013
Location:
Posted: 4th Jan 2014 21:35
Alright i looked up on my code and with this help i managed to see what i missed to include in my code in order not to give me an illegal object number! Thanks a lot guys!!!

Alex Matei CEO
www.alexmatei.com
Mobiius
Valued Member
22
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 5th Jan 2014 15:04
Glad you sorted it!

But for the benefit of other users having this problem, what did you change in your code to fix this issue?

Login to post a reply

Server time is: 2025-05-16 15:04:19
Your offset time is: 2025-05-16 15:04:19