Quantcast

Jump to content

» «
Photo

cleo file structure

44 replies to this topic
Deji
  • Deji

    Coding like a Rockstar!

  • Feroci
  • Joined: 24 Dec 2007
  • None

#31

Posted 06 May 2012 - 02:00 AM

'THREAD' isn't the native-y name for that. In pure SCR coding, a thread only occurs on sweaters.

Bad.boy!
  • Bad.boy!

    SA modder

  • Feroci
  • Joined: 20 Jun 2010
  • Netherlands

#32

Posted 06 May 2012 - 08:14 AM Edited by Bad.boy!, 06 May 2012 - 12:18 PM.

QUOTE (Deji @ Sunday, May 6 2012, 04:00)
'THREAD' isn't the native-y name for that. In pure SCR coding, a thread only occurs on sweaters.

That fixes the thread bug, it's SCRIPT_NAME in my compiler

EDIT:
Also fixed the wrong int bug, my compiler didn't switch from 8bit to 16bit int.


EDIT2: It's alive!
CODE
SCRIPT_NAME "WHILE"

WHILE IS_PLAYER_PLAYING PLAYER
   WAIT 0
GET_CHAR_HEALTH PLAYER_CHAR health

IF health < 150i
 health += 5i
 IF health > 150i
  health = 150i
 ENDIF
 
 SET_CHAR_HEALTH PLAYER health
ENDIF
ENDWHILE

CODE
{$CLEO .cs}

//-------------MAIN---------------
thread "WHILE"

:WHILE_9
wait 0
0@ = Actor.Health($PLAYER_ACTOR)
if
  not 0@ >= 150
else_jump @WHILE_82
0@ += 5
if
 0@ > 150
else_jump @WHILE_74
0@ = 150

:WHILE_74
Actor.Health($PLAYER_CHAR) = 0@

:WHILE_82
  Player.Defined($PLAYER_CHAR)
else_jump @WHILE_9


I still have to add labels and jumps, and then add more opcodes.

Bad.boy!
  • Bad.boy!

    SA modder

  • Feroci
  • Joined: 20 Jun 2010
  • Netherlands

#33

Posted 09 May 2012 - 03:55 PM

Opcodes that uses integers can use float too, right?

Like
wait 100000000000000 = wait 100000000000000.0 (float)

Don't know why someone wants to use numbers higher than 32bit ints. But I'll make it just in case.

I've finished the GOTO opcode. Next up is gosub (easier version of goto, should be done quickly).

LINK/2012
  • LINK/2012

    LIVIN' IN CODE

  • Feroci
  • Joined: 30 Jan 2011
  • Brazil

#34

Posted 09 May 2012 - 03:58 PM

But the game will not read this right, the game expects a integer in wait.

Deji
  • Deji

    Coding like a Rockstar!

  • Feroci
  • Joined: 24 Dec 2007
  • None

#35

Posted 10 May 2012 - 08:51 AM

The game will handle a float value just fine. The game reads floats and integer with the same function, which reads the data type and decides how to read the value.

LINK/2012
  • LINK/2012

    LIVIN' IN CODE

  • Feroci
  • Joined: 30 Jan 2011
  • Brazil

#36

Posted 10 May 2012 - 03:46 PM Edited by Link2012, 10 May 2012 - 03:50 PM.

Maybe you didn't understand what I mean...
Yes, the game will read the float fine, but will not send the correct (in integer) value to CScriptThread::wakeTime.

The game will read the float, and will not do any kind of conversion to integer, since wait is expecting a integer, will not go right.

so
wait 1.0
will be like doing
wait 1065353216

I know that the float and integer is get in the same function (CScriptThread::getNumberParams).
Did you understood what I mean?

Deji
  • Deji

    Coding like a Rockstar!

  • Feroci
  • Joined: 24 Dec 2007
  • None

#37

Posted 10 May 2012 - 08:04 PM

I knew that, but its not really a reason for the compiler to not support using floats in place of integers. Also I dont get why you're having to add these opcodes individually. Something like an xml file with opcode information should be the only thing that has to be changed per-opcode.

Bad.boy!
  • Bad.boy!

    SA modder

  • Feroci
  • Joined: 20 Jun 2010
  • Netherlands

#38

Posted 10 May 2012 - 08:34 PM

I'll leave the float instead of int. I didn't want to use numbers that high anyway.

QUOTE
Also I dont get why you're having to add these opcodes individually. Something like an xml file with opcode information should be the only thing that has to be changed per-opcode.

I wanted to add opcodes in a xml or something, but I skipped it and added a few opcodes to test the compiler.

I've still got loads of work to do. I've recently discovered some bugs with "GOTO", I have to make the opcode list, make something to tell the user what they did wrong instead of a crash, the design of the program and maybe a popup menu in the textbox which shows opcodes, like visual studio does.

And if I get everything to work maybe improving the calculating part, now you have to end the senctence with i(nt) or f(loat).

LINK/2012
  • LINK/2012

    LIVIN' IN CODE

  • Feroci
  • Joined: 30 Jan 2011
  • Brazil

#39

Posted 10 May 2012 - 08:47 PM

QUOTE (Deji @ Thursday, May 10 2012, 17:04)
I knew that, but its not really a reason for the compiler to not support using floats in place of integers. Also I dont get why you're having to add these opcodes individually. Something like an xml file with opcode information should be the only thing that has to be changed per-opcode.

I understood his question as something like "If I put a float in WAIT the game will read good as a INTEGER?"

Bad.boy!
  • Bad.boy!

    SA modder

  • Feroci
  • Joined: 20 Jun 2010
  • Netherlands

#40

Posted 10 May 2012 - 09:08 PM

That was my question, I was wondering because Sanny Builder converts ints that are higher than 32bit int to float.

Bad.boy!
  • Bad.boy!

    SA modder

  • Feroci
  • Joined: 20 Jun 2010
  • Netherlands

#41

Posted 11 May 2012 - 02:57 PM

Is there some sort of rule of order of opcode parameters?

CODE
0223: set_actor 2@ health_to 500 = OPCODE + VAR + INT
009A: 2@ = create_actor_pedtype 4 model #MALE01 at 0.0 0.0 0.0  = OPCODE + INT + INT + FLOAT + FLOAT + FLOAT + VAR
01C8: 40@ = create_actor_pedtype 23 model #SPECIAL01 in_car 35@ passenger_seat 0  = OPCODE + VAR + INT + INT + INT VAR

Bad.boy!
  • Bad.boy!

    SA modder

  • Feroci
  • Joined: 20 Jun 2010
  • Netherlands

#42

Posted 13 May 2012 - 08:09 PM

I'll leave the order problem to the user (me).

I completed the read opcodes from xml file and changed something in the design. I'll have to edit the main code again because it got really messy and to leave the possibility open to maybe add scm files in the future. The program also takes much memory compared to Sanny Builder (almost twice the memory whilst doing nothing).

Bad.boy!
  • Bad.boy!

    SA modder

  • Feroci
  • Joined: 20 Jun 2010
  • Netherlands

#43

Posted 28 May 2012 - 09:49 AM

It's been some time since I worked on this thing, anyway I've got a question about this datatype:
CODE
09 immediate 8 byte string


Especially the last bytes, are they a random value or do they actually do something?

For example:
CODE
AI = 09 48 41 00 00 B2 00 00 00 // .HA.....
HAIS = 09 48 41 49 53 53 00 54 00 // .HAISS.T.


------------------------------------
Calculating works, if-then-end works, if-then-else-end works. Comparing works, conditions works. Basically it's finished for simple scripts.

LINK/2012
  • LINK/2012

    LIVIN' IN CODE

  • Feroci
  • Joined: 30 Jan 2011
  • Brazil

#44

Posted 28 May 2012 - 11:07 AM

They're nothing specific, just some memory trash after the null terminator.

Bad.boy!
  • Bad.boy!

    SA modder

  • Feroci
  • Joined: 20 Jun 2010
  • Netherlands

#45

Posted 28 May 2012 - 06:44 PM

Does anyone know a good font for the compiler, or what is Sanny Builder's font?




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users