Hi! Welcome to the forum for Platinum Arts Sandbox Free 3D Game Maker. I currently have the forums locked as I am attempting to properly update them.

In the meantime please join the new Discord Server!

If you have any questions please e-mail me through the Platinum Arts website.

Cond questions

Having issues not related to a specific Sandbox game mode? Get help here!
Please also read the rules for support when posting support requests.
Failure to comply with the forum rules may result in your topic being locked without resolution.
Locked
User avatar
Sircameron
Member
Member
Posts: 62
Joined: March 6th, 2012, 9:13 pm
Name: Cameron
Location: Indiana

Cond questions

Post by Sircameron »

So ive been trying to figure out how to get cond to work in a test script and im clueless at this point. Ive read the cubescript reference page, and im familiar with the "else if" statement.. Ive probably editted this script over 60 times trying to get it to work, and decided to post it here to get some help.. Im not asking you to write the script just point out the flaws, so i can figure out what goes where, which containers to use and when.. Or if using another method would be better. I thought about using case but i dont understand it fully.. Anyways here's the script

Code: Select all

 r_script_signal interact [ 
r_global_set $item_counter (+ (r_global_get $item_counter) 1)
echo The item counter is at (r_global_get $item_counter)

if (= (r_global_get $item_counter) $itemlvl) [
itemlvl = [
 cond [= ((r_global_get $item_counter)) 10] [
 echo "you have gained a level with this item"
] [= ((r_global_get $item_counter)) 15] [
 echo "you have gained a level with this item"
] [= ((r_global_get $item_counter)) 25] [
 echo "you have gained a level with this item"
]

]
]

*Editted the brackets, but the cond still isnt working. The problem starts at the if statement. I dont know if im using in the correct way.. Do i need the if statement to run the cond?
Last edited by Sircameron on March 29th, 2012, 5:35 pm, edited 2 times in total.
Hirato
Developer
Developer
Posts: 689
Joined: May 30th, 2009, 1:23 pm
IRC Username: hirato

Re: Cond questions

Post by Hirato »

case and cond are very similar.
The format is basically, the formats for cond and case is basically
cond cond action cond action cond action ...
case value cond action cond action cond action ...
(notice a pattern there?)

I'm not quite sure what you're trying to do.. but you did put the condition's brackets in the wrong place and effectively changed its format to ...
cond cond [action cond [action cond [ ... ]]
This is not a url, clicking it is pointless
User avatar
Sircameron
Member
Member
Posts: 62
Joined: March 6th, 2012, 9:13 pm
Name: Cameron
Location: Indiana

Re: Cond questions

Post by Sircameron »

Cool thanks! The brackets confuse me a lot! i'll rewrite it again, and see what happens.

what im trying to do is every time you "interact" it counts that number, and then after so many times (i.e 5x, 10x, 15x, etc) it sends the echo message..

big picture : items that gain "levels" after so many uses.. Obviously i plan to add/edit it way more. Because right now (even if it did work) it would only tell you that "you've gained a level blah".. Not actually set the level itself..


Just to let you know that im testing it with "r_script_signal interact" so i can make sure its working as intended..
Locked