Code: Select all
global variable (1,example)
scirpt,start,begin
example := 100
end
Code: Select all
example := 100
^
expected argument name, but found global variable example
Moderators: marionline, SDHawk
Code: Select all
global variable (1,example)
scirpt,start,begin
example := 100
end
Code: Select all
example := 100
^
expected argument name, but found global variable example
Globals are still the best way to store numbers, but storing strings in globals is obsolete.Matokage wrote:so, let me understand. Globals are basicaly obsolet, since you can save strings to slices and to saved games. but how do I Call those strings and it's values for a script?
You can copy strings to/from text slices using "set slice text" and "get slice text"Matokage wrote:But, in this case a want a string from a global so i can add its value to a text slice.
Code: Select all
global variable (1,AP)
global variable (2,APMAX)
Code: Select all
variable (APmeter,APmeterMAX)
globals to string (1,1,3)
globals to string (2,2,3)
APmeter := create text
set slice text (APmeter,1)
put slice (APmeter,50,50)
APmeterMAX := create text
set slice text (APmeterMAX,2)
put slice (APmeterMAX,50,55)
Code: Select all
# Start with any number, stored in any kind of variable
num := 100
# clear a temporary string ID
$1=""
# convert the number into a string
append number(1, num)
# copy the temporary string into a string slice handle
set slice text(sl, 1)
Code: Select all
variable (APmeter,APmeterMAX)
APmeter := create text
$1=""
append number(1, AP)
set slice text (APmeter,1)
put slice (APmeter,50,50)
APmeterMAX := create text
$1=""
append number(1, APMAX)
set slice text (APmeterMAX,1)
put slice (APmeterMAX,50,55)