skatefilter5 Posted September 2, 2017 Share Posted September 2, 2017 I was testing the txd image and the game freezes or crashes when I type "txd" I did load dictionary with 0390 first without another wait after 0ACD. {$CLEO .cs}0000: NOP:STARTwait 0if0ADC: test_cheat "txd"jf @STARTwait 00390: load_txd_dictionary 'TEST/VC1.txd'0ACD: show_text_highpriority "TEST" time 2000038F: load_texture "vc1" as [email protected] // Load dictionary with 0390 first038D: draw_texture [email protected] position [email protected] [email protected] size [email protected] [email protected] RGBA 128 128 128 255wait 40000391: release_texturesend_thread Link to comment Share on other sites More sharing options...
fastman92 Posted September 2, 2017 Share Posted September 2, 2017 (edited) 'TEST/VC1.txd' the TXD must be inside of models\txd and only a name without an extension must be passed to the command 0390. end_threadIt shouldn't be used in CLEO scripts. You've got a long road of learning ahead of you before you can confidently say you know basics of coding at least. Edited September 2, 2017 by fastman92 deltaCJ, dkluin and Arya_Eto 3 Link to comment Share on other sites More sharing options...
ZAZ Posted September 3, 2017 Share Posted September 3, 2017 (edited) Also the content of the local vars aren't given, so the game should display a texture with size of 0.0 x 0.0 can you use your brain first before posting such sh*t? Edited September 3, 2017 by ZAZ deltaCJ 1 CLEO MODS CLEO Script Tutorial Link to comment Share on other sites More sharing options...
TheSiggi Posted September 3, 2017 Share Posted September 3, 2017 (edited) ZAZ and fastman92 have a point. Go through your code multiple times and try to find what's causing the error yourself. This will significantly improve your script writing, as it's very likely you won't make a mistake twice after having figured out what caused it. The script below is not tested, but I think it might work. Please take your time to read through it and compare it with your own. What's different and why. Also read the comments. {$CLEO .cs}0000: NOP// Play around with these values [email protected] = 0.0 // X-coordinate on [email protected] = 0.0 // Y-coordinate on [email protected] = 4.0 // X-Axis size multiplier of [email protected] = 4.0 // Y-Axis size multiplier of texture:STARTwait 10 if and Player.Defined($PLAYER_CHAR)0ADC: test_cheat "TXD" jf @START 0ACD: show_text_highpriority "TEST" time 2000 wait 20000A99: chdir 0 // set the directory for 0AAB: to the game root folder if 0AAB: file_exists 'models/txd/VC1.txd' // always a good idea to check whether the file actually existsjf @SHOW_ERROR 0390: load_txd_dictionary 'VC1' 038F: load_texture "VC1" as 1 // Load dictionary with 0390 first 038D: draw_texture 1 position [email protected] [email protected] size [email protected] [email protected] RGBA 128 128 128 255 // according to opcodes.txt // you can load and draw the texture with adigit as handle, not a var as handle // if you want to find out how it's used, decompile main.scm and // look how the developers used itwait 4000 0391: release_textures jump @START :SHOW_ERROR0ACA: show_text_box "ERROR: TXD FILE NOT FOUND!" // if txd does not exist show error and end thread:END0A93: end_custom_thread // in CLEO always use this, never 0043: end_thread High-level version {$CLEO}0000:// Play around with these values [email protected] = 0.0 // X-coordinate on [email protected] = 0.0 // Y-coordinate on [email protected] = 4.0 // X-Axis size multiplier of [email protected] = 4.0 // Y-Axis size multiplier of texturewhile true wait 10 if and 0256: player $PLAYER_CHAR defined 0ADC: test_cheat "txd" then 0ACD: show_text_highpriority "TEST" time 2000 wait 2000 0A99: chdir 0 // set the directory for 0AAB: to the game root folder if 0AAB: file_exists 'models/txd/VC1.txd' // always a good idea to check whether the file actually exists then // 0390: load_txd_dictionary 'VC1' 038F: load_texture "vc1" as 1 // Load dictionary with 0390 first 038D: draw_texture 1 position [email protected] [email protected] size [email protected] [email protected] RGBA 128 128 128 255 // according to opcodes.txt // you can load and draw the texture with adigit as handle, not a var as handle // if you want to find out how it's used, decompile main.scm and // look how the developers used it wait 4000 0391: release_textures else 0ACA: show_text_box "ERROR: TXD FILE NOT FOUND!" break end endend0A93: end_custom_thread // in CLEO scripts use this instead of 004E: end_thread Another hint for the future: Stick close to your scripting tutorial and try everything new in small testing scripts and play around with it. This will improve your coding and broaden your knowledge. SCM Coding for Dummies and ZAZ's CLEO scripting tutorial are excellent choices. I hope i could help out (and the code actually works ) cheers Edited September 3, 2017 by TheSiggi Link to comment Share on other sites More sharing options...
Guest Posted September 4, 2017 Share Posted September 4, 2017 You don't need decorate your code with WAIT. Use it only to avoid infinite loop. 0390: load_txd_dictionary 'TEST/VC1.txd' The parameter of this opcode can't exceed 8 chars. And... you should be sure this file exists. If you don't obey these limitations, the program behavoir is unexpected. 038F: load_texture "vc1" as [email protected] // Load dictionary with 0390 first This opcode doesn't return a value. You should push a ordinal number of a slot in array of sprites. Link to comment Share on other sites More sharing options...
TheSiggi Posted September 4, 2017 Share Posted September 4, 2017 The wait for two and four seconds are just there to provide enought time to spot the differences in rendering, when he plays around with the values. There is no reason to use a loop checking for a local script timer over a wait for these purposes. Link to comment Share on other sites More sharing options...
Guest Posted September 6, 2017 Share Posted September 6, 2017 That comment (about WAIT) has been to topic's author. Link to comment Share on other sites More sharing options...
skatefilter5 Posted September 6, 2017 Author Share Posted September 6, 2017 Okay I'll try that code, I didn't know I can't only put it in models/txd only but good to know Link to comment Share on other sites More sharing options...
spaceeinstein Posted September 12, 2017 Share Posted September 12, 2017 (edited) If you're working on III/VC, here is a short example code for VC that slides the KChat icon across the screen: 0390: load_txd_dictionary 'HUD' // loads from .\models for III/VC, .\models\txd for SA038F: load_texture 'RKCHAT' as 1 // use " (double quotes) for [email protected] = 100.003F0: enable_text_draw 1 while true wait 0 if 00E1: player 0 pressed_button 13 // camera key then 03F0: enable_text_draw 0 break end 038D: draw_texture 1 position [email protected] 100.0 size 64.0 64.0 RGBA 255 255 255 255 [email protected] += 1.0end"HUD" refers to .\models\hud.txd. III/VC and SA has some differences but the concept should be the same. Like 033E that draws text on the screen, you should use 03F0 when drawing textures on the screen. This will likely conflict with other mods or parts of the game that does the same thing so be aware of that. Edited September 13, 2017 by spaceeinstein MW_29 1 Link to comment Share on other sites More sharing options...
deltaCJ Posted September 23, 2017 Share Posted September 23, 2017 Also the content of the local vars aren't given, so the game should display a texture with size of 0.0 x 0.0 can you use your brain first before posting such sh*t? He does this every day. He posts stuff without even thinking. Arya_Eto 1 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