I am setting up my game for the battle system with *input_text so they can enter commands. I went to run random test and found it freezes up at that point. Does this mean I will have to rethink my game system as I know it has to pass both quick test and random test to be published. Or is there a work around?
Something like *if not(choice_random), just not 100% sure on the variable name.
Thanks I will try it out tonight and play around with it, right now chasing a bug that is driving crazy.
*if (target_1_armor=-25) *set d_target_1_armor 25 *return
getting the error Invalid expression, I take it as I am checking for a negative number I need to write this different
*edit
Seems I may have found the solution
((target_1_armor +25) =0)
testing after rewriting this section
**Edit This did not resolve the problem but I did find thid thread Negative stats that gave me a work around. I need to flip the number for player view so not to confuse them. A bit of a long work around but at least it will work well.
***Edit after spending many many hours I have come to realize working with negatives is not a good way to work with CS. So if you can avoid all the better as you save yourself many a headache.
An alternative, and how I work with negatives, is thus:
*if (my_varaible = (0 - 25))
And of course setting a negative number is:
*create my_variable 0 *set my_variable -25
So everything is working but 1 min and 1 hour, have no clue why.
*title clock *comment vars needed *create sec 0 *create min 0 *create hour 0 *create day 1 *create day_count 1 *create month 1 *create year 2016 *comment CS can display the var but I like it to look more like a digital cloak so add the following va. make sure you set d_var the same *create d_sec "00" *create d_min "00" *create d_hour "00" *create d_day "01" *create d_month "January" *comment Remove after testing *label test ${d_hour}:${d_min}:${d_sec} ${d_month} ${day}, ${year} *choice Time #Seconds *choice #1 second *set sec +1 *gosub time *goto test #5 seconds *set sec +5 *gosub time *goto test #50 seconds *set sec *50 *gosub time *goto test #60 seconds *set sec +60 *gosub time *goto test #Minutes *choice #1 minute *set min *1 *gosub time *goto test #2 minute *set min *2 *gosub time *goto test #3 minutes *set min +3 *gosub time *goto test #5 minutes *set min +5 *gosub time *goto test #50 minutes *set min +50 *gosub time *goto test #Hours *choice #1 hour *set hour *1 *gosub time *goto test #5 hours *set hour +5 *gosub time *goto test #23 hours *set hour +50 *gosub time *goto test #Days *choice #1 day *set day +1 *gosub time *goto test #5 days *set day +5 *gosub time *goto test #20 days *set day +20 *gosub time *goto test #Months *choice #1 month *set month +1 *gosub time *goto test #10 months *set month +10 *gosub time *goto test *comment End remove *label time *gosub sec_check *gosub sec_display *gosub min_check *gosub min_display *gosub hour_check *gosub hour_display *gosub day_count *gosub day_check *gosub day_display *gosub month_display *return *label day_check *if (month=12) *if (day>=32) *set day -31 *set month 1 *return *else *return *if (month=11) *if (day>=31) *set day -30 *set month 12 *return *else *return *if (month=10) *if (day>=32) *set day -31 *set month 11 *return *else *return *if (month=9) *if (day>=31) *set day -30 *set month 10 *return *else *return *if (month=8) *if (day>=32) *set day -31 *set month 9 *return *else *return *if (month=7) *if (day>=32) *set day -31 *set month 8 *return *else *return *if (month=6) *if (day>=31) *set day -30 *set month 7 *return *else *return *if (month=5) *if (day>=32) *set day -31 *set month 6 *return *else *return *if (month=4) *if (day>=31) *set day -30 *set month 5 *return *else *return *if (month=3) *if (day>=32) *set day -31 *set month 4 *return *else *return *if (month=2) *if (day>=30) *set day -29 *set month 3 *return *else *return *if (month=1) *if (day>=32) *set day -31 *set month 4 *return *else *return *label day_count *if (day_count>=366) *set day_count -365 *set year +1 *return *else *return *label hour_check *if (hour>=24) *set day +1 *set hour -24 *return *else *return *label min_check *if (min>=60) *set hour +1 *set min -60 *return *else *return *label sec_check *if (sec>=60) *set min +1 *set sec -60 *return *else *return *label day_display *if (day=31) *set d_day "31" *return *if (day=30) *set d_day "30" *return *if (day=29) *set d_day "29" *return *if (day=28) *set d_day "28" *return *if (day=27) *set d_day "27" *return *if (day=26) *set d_day "26" *return *if (day=25) *set d_day "25" *return *if (day=24) *set d_day "24" *return *if (day=23) *set d_day "23" *return *if (day=22) *set d_day "22" *return *if (day=21) *set d_day "21" *return *if (day=20) *set d_day "20" *return *if (day=19) *set d_day "19" *return *if (day=18) *set d_day "18" *return *if (day=17) *set d_day "17" *return *if (day=16) *set d_day "16" *return *if (day=15) *set d_day "15" *return *if (day=14) *set d_day "14" *return *if (day=13) *set d_day "13" *return *if (day=12) *set d_day "12" *return *if (day=11) *set d_day "11" *return *if (day=10) *set d_day "10" *return *if (day=9) *set d_day "09" *return *if (day=8) *set d_day "08" *return *if (day=7) *set d_day "07" *return *if (day=6) *set d_day "06" *return *if (day=5) *set d_day "05" *return *if (day=4) *set d_day "04" *return *if (day=3) *set d_day "03" *return *if (day=2) *set d_day "02" *return *if (day=1) *set d_day "01" *return *label month_display *if (month=12) *set d_month "Dec" *return *if (month=11) *set d_month "Nov" *return *if (month=10) *set d_month "Oct" *return *if (month=9) *set d_month "Sep" *return *if (month=8) *set d_month "Aug" *return *if (month=7) *set d_month "Jul" *return *if (month=6) *set d_month "Jun" *return *if (month=5) *set d_month "May" *return *if (month=4) *set d_month "Apl" *return *if (month=3) *set d_month "Mar" *return *if (month=2) *set d_month "Feb" *return *if (month=1) *set d_month "Jan" *return *label hour_display *if (hour=24) *set d_hour "00" *return *if (hour=23) *set d_hour "23" *return *if (hour=22) *set d_hour "22" *return *if (hour=21) *set d_hour "21" *return *if (hour=20) *set d_hour "20" *return *if (hour=19) *set d_hour "19" *return *if (hour=18) *set d_hour "18" *return *if (hour=17) *set d_hour "17" *return *if (hour=16) *set d_hour "16" *return *if (hour=15) *set d_hour "15" *return *if (hour=14) *set d_hour "14" *return *if (hour=13) *set d_hour "13" *return *if (hour=12) *set d_hour "12" *return *if (hour=11) *set d_hour "11" *return *if (hour=10) *set d_hour "10" *return *if (hour=9) *set d_hour "09" *return *if (hour=8) *set d_hour "08" *return *if (hour=7) *set d_hour "07" *return *if (hour=6) *set d_hour "06" *return *if (hour=6) *set d_hour "06" *return *if (hour=5) *set d_hour "05" *return *if (hour=4) *set d_hour "04" *return *if (hour=3) *set d_hour "03" *return *if (hour=2) *set d_hour "02" *return *if (hour=1) *set d_hour "01" *return *if (hour=0) *set d_hour "00" *return *label sec_display *if (sec=60) *set d_sec "00" *return *if (sec=59) *set d_sec "59" *return *if (sec=58) *set d_sec "58" *return *if (sec=57) *set d_sec "57" *return *if (sec=56) *set d_sec "56" *return *if (sec=55) *set d_sec "55" *return *if (sec=54) *set d_sec "54" *return *if (sec=53) *set d_sec "53" *return *if (sec=52) *set d_sec "52" *return *if (sec=51) *set d_sec "51" *return *if (sec=50) *set d_sec "50" *return *if (sec=49) *set d_sec "49" *return *if (sec=48) *set d_sec "48" *return *if (sec=47) *set d_sec "47" *return *if (sec=46) *set d_sec "46" *return *if (sec=45) *set d_sec "45" *return *if (sec=44) *set d_sec "44" *return *if (sec=43) *set d_sec "43" *return *if (sec=42) *set d_sec "42" *return *if (sec=41) *set d_sec "41" *return *if (sec=40) *set d_sec "40" *return *if (sec=39) *set d_sec "39" *return *if (sec=38) *set d_sec "38" *return *if (sec=37) *set d_sec "37" *return *if (sec=36) *set d_sec "36" *return *if (sec=35) *set d_sec "35" *return *if (seC=34) *set d_sec "34" *return *if (sec=33) *set d_sec "33" *return *if (sec=32) *set d_sec "32" *return *if (sec=31) *set d_sec "31" *return *if (sec=30) *set d_sec "30" *return *if (sec=29) *set d_sec "29" *return *if (sec=28) *set d_sec "28" *return *if (sec=27) *set d_sec "27" *return *if (sec=26) *set d_sec "26" *return *if (sec=25) *set d_sec "25" *return *if (sec=24) *set d_sec "24" *return *if (sec=23) *set d_sec "23" *return *if (sec=22) *set d_sec "22" *return *if (sec=21) *set d_sec "21" *return *if (sec=20) *set d_sec "20" *return *if (sec=19) *set d_sec "19" *return *if (sec=18) *set d_sec "18" *return *if (sec=17) *set d_sec "17" *return *if (sec=16) *set d_sec "16" *return *if (sec=15) *set d_sec "15" *return *if (sec=14) *set d_sec "14" *return *if (sec=13) *set d_sec "13" *return *if (sec=12) *set d_sec "12" *return *if (sec=11) *set d_sec "11" *return *if (sec=10) *set d_sec "10" *return *if (sec=9) *set d_sec "09" *return *if (sec=8) *set d_sec "08" *return *if (sec=7) *set d_sec "07" *return *if (sec=6) *set d_sec "06" *return *if (sec=5) *set d_sec "05" *return *if (sec=4) *set d_sec "04" *return *if (sec=3) *set d_sec "03" *return *if (sec=2) *set d_sec "02" *return *if (sec=1) *set d_sec "01" *return *if (sec=0) *set d_sec "00" *return *label min_display *if (min=60) *set d_min "00" *return *if (min=59) *set d_min "59" *return *if (min=58) *set d_min "58" *return *if (min=57) *set d_min "57" *return *if (min=56) *set d_min "56" *return *if (min=55) *set d_min "55" *return *if (min=54) *set d_min "54" *return *if (min=53) *set d_min "53" *return *if (min=52) *set d_min "52" *return *if (min=51) *set d_min "51" *return *if (min=50) *set d_min "50" *return *if (min=49) *set d_min "49" *return *if (min=48) *set d_min "48" *return *if (min=47) *set d_min "47" *return *if (min=46) *set d_min "46" *return *if (min=45) *set d_min "45" *return *if (min=44) *set d_min "44" *return *if (min=43) *set d_min "43" *return *if (min=42) *set d_min "42" *return *if (min=41) *set d_min "41" *return *if (min=40) *set d_min "40" *return *if (min=39) *set d_min "39" *return *if (min=38) *set d_min "38" *return *if (min=37) *set d_min "37" *return *if (min=36) *set d_min "36" *return *if (min=35) *set d_min "35" *return *if (min=34) *set d_min "34" *return *if (min=33) *set d_min "33" *return *if (min=32) *set d_min "32" *return *if (min=31) *set d_min "31" *return *if (min=30) *set d_min "30" *return *if (min=29) *set d_min "29" *return *if (min=28) *set d_min "28" *return *if (min=27) *set d_min "27" *return *if (min=26) *set d_min "26" *return *if (min=25) *set d_min "25" *return *if (min=24) *set d_min "24" *return *if (min=23) *set d_min "23" *return *if (min=22) *set d_min "22" *return *if (min=21) *set d_min "21" *return *if (min=20) *set d_min "20" *return *if (min=19) *set d_min "19" *return *if (min=18) *set d_min "18" *return *if (min=17) *set d_min "17" *return *if (min=16) *set d_min "16" *return *if (min=15) *set d_min "15" *return *if (min=14) *set d_min "14" *return *if (min=13) *set d_min "13" *return *if (min=12) *set d_min "12" *return *if (min=11) *set d_min "11" *return *if (min=10) *set d_min "10" *return *if (min=9) *set d_min "09" *return *if (min=8) *set d_min "08" *return *if (min=7) *set d_min "07" *return *if (min=6) *set d_min "06" *return *if (min=5) *set d_min "05" *return *if (min=4) *set d_min "04" *return *if (min=3) *set d_min "03" *return *if (min=2) *set d_min "02" *return *if (min=1) *set d_min "01" *return *if (min=0) *set d_min "00" *return
Out of curiosity, why are the min_display
and sec_display
sections so long? If Iām not mistaken, couldnāt you just do:
*set d_sec = sec
for example? Is there a particular reason?
It has to do how I want it to display, the var sec if 1 will display just 1 where as I have it to display as a clock format. so sec =1 but displays 01.
I see, I know itās unrelated, but why not add a clause:
*if sec > 9 ->${d_sec}:29:04:2016 *else ->0${d_sec}:29:04:2016
Because I am not a coder and do not completely follow the code you just put up and would not know how to write the rest of the code this way. lol.
*Edit Ok I think I got it the -> way throwing me off you should use < pre > to format code. But thank you I will see what I can do.
There we go, I knew there was a way to do, apologies for the code in my first post, Iām a bit rusty with actual CS since I havenāt used it in a while, to set a variable = to another variable:
*create myfirstvar 226 *create thesecondvar "boop"
*set thesecondvar "${myfirstvar}"
/*Write out the new variable's value*/ ${thesecondvar} /*Outputs "226"*/
*EDIT: If nothing else, this should help shorten and clean the amount of code you need to use to get what you want done.
??? Ok that just went over my head lol. I will try to wrap my poor head around this. Thank you for helping.
*Edit Owwwwww I think I am starting to see what you are saying may be a bit to totally get it but I can see how much that can reduce the code.
Thank you I have finally have a lot smaller code dropped out at least 100 lines of code or more. Going back in to rewrite test and post. Thanks again.
No problem, always happy to help,
Just to clarify for anyone else as well:
Basically, first we *create two variables, one (in our case the one called āthesecondvarā) is just *created with a placeholder, which we will later switch out with the value of the important variable (in our case the once called āmyfirstvarā, but in your real life case, letās say the āsecā variable, which is what the ād_secā gets based off of).
Putting the curly brackets with the sign around something (as you most likely well know) tells CS that we want it to output that (the variable in the curly braces) varible's value, but while it's all well and good to just go `{avariable}` without quotes in normal text, in our case (where we want to output that variableās value and set another variable to it), you need to use quotes to turn it into a string since otherwise, CS canāt understand what you want it to do, so what weāre actually doing is taking the output from the first variable, turning it into a string by putting it in quotes, and then setting the second variable to that string.
So:
${avariable}
Outside of commands, this above outputs a string since CS automatically interprets it that way, however within a command CS doesnāt automatically interpret, instead letting you decide whether its a string ex: āboopā, a number ex: 3, or a boolean ex: true, which means it looks for a type of variable first, and interprets later, which is why when CS sees this:
*set avariable ${theothervariablesvalue}
it doesnāt know what to do since '{}' isn't recognized as a type (string, boolean, or number), that's why we do this:
`
*set avariable "{theothervariablesvalue}"
`
and surround it in quotes to get it to calm down first and recognize the type of thing it is (a string) and then get the value of the variable in the ${}'s
I have reduced the code for just the seconds code, not in the manner you have provided as I will need to read through and stretch those brain cells to figure it out, but it did set me on the right path. But I did find a way to reduce the code for the second by a rather large sum. Took this code on its own and tested and seems to be very stable, now moving on to min then hours. By removing all of these extra code I cut the lines of code down by 1100. Thanks for making me think smarter about the code.
*Edit I found the error that caused me to originally post this, had * instead of + in a few places. So problem solved and reduced code.
*title clock *comment vars needed *create sec 0 *create min 0 *create hour 0 *create day 1 *create day_count 1 *create month 5 *create year 2016 *comment CS can display the var but I like it to look more like a digital cloak so add the following va. make sure you set d_var the same *create d_sec "0" *create d_min "0" *create d_hour "0" *create d_day "1" *create d_month "May" *label test *gosub sec_check *set d_min min *set d_hour hour *if (((sec<=9) and (min<=9)) and (hour<=9)) 0${d_hour}:0${d_min}:0${d_sec} *goto next *if (((sec<=9) and (min<=9)) and (hour>=10)) ${d_hour}:0${d_min}:0${d_sec} *goto next *if (((sec<=9) and (min>=10)) and (hour>=10)) ${d_hour}:${d_min}:0${d_sec} *goto next *if (((sec<=9) and (min>=10)) and (hour<=9)) 0${d_hour}:${d_min}:0${d_sec} *goto next *if (((sec>10) and (min<=9)) and (hour<=9)) 0${d_hour}:0${d_min}:${d_sec} *goto next *if (((sec>10) and (min<=9)) and (hour>=10)) ${d_hour}:0${d_min}:${d_sec} *goto next *if (((sec>10) and (min>=10)) and (hour<=9)) ${d_hour}:0${d_min}:${d_sec} *goto next *label next *choice #Seconds *choice #1 second *set sec +1 *gosub time *goto test #5 seconds *set sec +5 *gosub time *goto test #50 seconds *set sec +50 *gosub time *goto test #60 seconds *set sec +60 *gosub time *goto test *label time *label sec_check *if (sec>=60) *set min +1 *set sec -60 *set d_sec sec *return *else *set d_sec sec *return
Oho, interesting, so it does work without turning it into a string first, I need to investigate that behaviour. Otherwise awesome to hear itās resolved.
Well you gave me the idea so thank you
I thought I put this up here now that it works really well. of course I had a lot of help along the way Reduced the code from 1657 to 650 SWEET!
*title clock *comment vars needed *create sec 0 *create min 0 *create hour 0 *create day 1 *create day_count 1 *create month 1 *create year 2016 *comment CS can display the var but I like it to look more like a digital cloak so add the following va. make sure you set d_var the same *create d_sec "0" *create d_min "0" *create d_hour "0" *create d_day "1" *create d_month "Jan" *label test *gosub time *if (((sec<=9) and (min<=9)) and (hour<=9)) 0${d_hour}:0${d_min}:0${d_sec} *goto step1 *if (((sec<=9) and (min<=9)) and (hour>=10)) ${d_hour}:0${d_min}:0${d_sec} *goto step1 *if (((sec<=9) and (min>=10)) and (hour>=10)) ${d_hour}:${d_min}:0${d_sec} *goto step1 *if (((sec<=9) and (min>=10)) and (hour<=9)) 0${d_hour}:${d_min}:0${d_sec} *goto step1 *if (((sec>=10) and (min<=9)) and (hour<=9)) 0${d_hour}:0${d_min}:${d_sec} *goto step1 *if (((sec>=10) and (min<=9)) and (hour>=10)) ${d_hour}:0${d_min}:${d_sec} *goto step1 *if (((sec>=10) and (min>=10)) and (hour>=10)) ${d_hour}:0${d_min}:${d_sec} *goto step1 *if (((sec>=10) and (min>=10)) and (hour<=9)) ${d_hour}:0${d_min}:${d_sec} *goto step1 *label step1 *if (day<=9) ${d_month}/0${d_day}/${year} *goto step2 *if (day>=10) ${d_month}/${d_day}/${year} *goto step2 *label step2 *choice #Seconds *choice #1 second *set sec +1 *gosub time *goto test #5 seconds *set sec +5 *gosub time *goto test #50 seconds *set sec +50 *gosub time *goto test #60 seconds *set sec +60 *gosub time *goto test #Minutes *choice #1 minute *set min +1 *gosub time *goto test #2 minute *set min +2 *gosub time *goto test #3 minutes *set min +3 *gosub time *goto test #5 minutes *set min +5 *gosub time *goto test #50 minutes *set min +50 *gosub time *goto test #Hours *choice #1 hour *set hour +1 *gosub time *goto test #5 hours *set hour +5 *gosub time *goto test #23 hours *set hour +23 *gosub time *goto test #Days *choice #1 day *set day +1 *gosub time *goto test #5 days *set day +5 *gosub time *goto test #20 days *set day +20 *gosub time *goto test #Months *choice #1 month *set month +1 *gosub time *goto test #10 months *set month +10 *gosub time *goto test *label time *gosub sec_check *gosub min_check *gosub hour_check *gosub day_count *gosub day_check *gosub month_display *return *label sec_check *if (sec>=60) *set min +1 *set sec -60 *set d_sec sec *return *else *set d_sec sec *return *label min_check *if (min>=60) *set hour +1 *set min -60 *set d_min min *return *else *set d_min min *return *label hour_check *if (hour>=24) *set day +1 *set day_count +1 *set hour -24 *set d_hour hour *return *else *set d_hour hour *return *label day_count *if (day_count>=366) *set day_count -365 *set year +1 *set d_day day *return *else *set d_day day *return *label day_check *if (month>=13) *set month -12 *set year +1 *return *if (month=12) *if (day>=32) *set day -31 *set month 1 *return *else *return *if (month=11) *if (day>=31) *set day -30 *set month 12 *return *else *return *if (month=10) *if (day>=32) *set day -31 *set month 11 *return *else *return *if (month=9) *if (day>=31) *set day -30 *set month 10 *return *else *return *if (month=8) *if (day>=32) *set day -31 *set month 9 *return *else *return *if (month=7) *if (day>=32) *set day -31 *set month 8 *return *else *return *if (month=6) *if (day>=31) *set day -30 *set month 7 *return *else *return *if (month=5) *if (day>=32) *set day -31 *set month 6 *return *else *return *if (month=4) *if (day>=31) *set day -30 *set month 5 *return *else *return *if (month=3) *if (day>=32) *set day -31 *set month 4 *return *else *return *if (month=2) *if (day>=30) *set day -29 *set month 3 *return *else *return *if (month=1) *if (day>=32) *set day -31 *set month 4 *return *else *return *label month_display *if (month=12) *set d_month "Dec" *return *if (month=11) *set d_month "Nov" *return *if (month=10) *set d_month "Oct" *return *if (month=9) *set d_month "Sep" *return *if (month=8) *set d_month "Aug" *return *if (month=7) *set d_month "Jul" *return *if (month=6) *set d_month "Jun" *return *if (month=5) *set d_month "May" *return *if (month=4) *set d_month "Apl" *return *if (month=3) *set d_month "Mar" *return *if (month=2) *set d_month "Feb" *return *if (month=1) *set d_month "Jan" *return
Felt I should have a working sample up and I have change the code some, so questions, want to download the file, or need help with it just hit me up. The link example is not compiled so runs a tad slow but it works without a delay once compiled.
https://dl.dropboxusercontent.com/u/80005171/clock_calander/web/mygame/index.html
Hello, i would like to ask. I want to make an income per month (having village that produces money every month) but I dont rally know how to get onto that. Or is there some not that hard to make (like 30 day system) without need of seconds hours etc. Hope you reply and help! Thanks in advance