nyolc8 Posted February 16, 2015 Share Posted February 16, 2015 I want to make a script with a subscript in a different file. I made the main script (myscript.cs) and the subscript (sub.s). I made the myscript.cs like this: $myglobalvar = 880A92: create_custom_thread "sub.s":nothingwait 1000jump @nothingand my sub.s like this: 03A4: name_thread 'BLAH'while $myglobalvar == 88 wait 1000end0AD1: print_formatted_now "test text" time 3000 00A93: end_custom_threadAnd the problem is, sub.s doesn't even see that the $myglobalvar is exist or not... "test text" appearing but it shouldn't. Subscripts doesn't support globar vars? Or what is the problem? Link to comment Share on other sites More sharing options...
ZAZ Posted February 16, 2015 Share Posted February 16, 2015 (edited) 03A4: name_thread 'BLAH'while $myglobalvar == 88 wait 1000end0AD1: print_formatted_now "test text" time 3000 00A93: end_custom_thread code stucks in a loop as long as global var = 88 while not $myglobalvar == 88 wait 1000 end code can pass the loop as soon as global var isn't 88 but... ...don't use global vars in cleoscripts, but instead use opcode 0AB3: and 0AB4: The expression var together with a number, <var><space><number> builds the "Special Global Cleo Variable" 0AB3: var 0 = 10or0006: [email protected] = 10 // integer values0AB3: var 0 = [email protected]: [email protected]= var 0var 0 up to var 999 will be stored, in exemble var 0 is stored with 10 to get then the stored value into your script needs to allocate the content into a local var: 0AB4: [email protected] = var 44if 0039: [email protected] == 1 // integer valuesthen //do somethingend... and btw. opcode 0A92: create_custom_thread can transfer more information to the script which should be started This opcode can be extended with up to 30 values or variables as parameters exemble: 0A92: create_custom_thread "sub.s" 1 2 0 [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected]The started thread recieves these parameter values by following rule[email protected] get value of 1.parameter [email protected] get value of 2.parameter [email protected] get value of 3.parameter [email protected] get value of 4.parameter [email protected] get value of 5.parameter etc... example: myscript.cs 0A92: create_custom_thread "sub.s" 88:nothingwait 1000jump @nothingsub.s 03A4: name_thread 'BLAH'while truewait 0 if [email protected] == 88 then 0AD1: print_formatted_now "test text" time 3000 0 0A93: end_custom_thread endend Edited February 16, 2015 by ZAZ CLEO MODS CLEO Script Tutorial Link to comment Share on other sites More sharing options...
nyolc8 Posted February 16, 2015 Author Share Posted February 16, 2015 code stucks in a loop as long as global var = 88Yeah it should stuck... but it isn't. This is my problem. This is what I don't understand. Anyway, I'll try with 0AB3 and 0AB4. Thanks! Link to comment Share on other sites More sharing options...
nyolc8 Posted February 17, 2015 Author Share Posted February 17, 2015 Is 0D2E usable with custom threads? Because it gives me opcode error in game. Anyone knows this? Link to comment Share on other sites More sharing options...
ZAZ Posted February 22, 2015 Share Posted February 22, 2015 Is 0D2E usable with custom threads? Because it gives me opcode error in game. Anyone knows this?I never used that code, you could ask in the "NewOpcodes" support topic or write a pm to DK22Pac CLEO MODS CLEO Script Tutorial Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now